After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751672 - -Wduplicate-decl-specifier in glib/tests/keyfile.c
-Wduplicate-decl-specifier in glib/tests/keyfile.c
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.44.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-06-29 19:05 UTC by Daniel Macks
Modified: 2015-06-30 01:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Fix compiler warning (1.31 KB, patch)
2015-06-29 19:15 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Daniel Macks 2015-06-29 19:05:31 UTC
glib-2.44.1 on OS X 10.8 (clang 5.1):

  CC       keyfile.o
keyfile.c:511:15: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
  const gchar const *list[3];
              ^

Putting "const" before or after "gchar" is equivalent. It looks like the intent was to have a const-pointer to an array of const-strings? That would be:

  const gchar * const list[3];

but that is an *error* because list[] are assigned later:

  list[0] = "one";
  list[1] = "two;andahalf";
  list[2] = "3";

But then they are not changed after that, so the declaration could simply assign the values:

  const gchar * const list[] = {
    "one",
    "two;andahalf",
    "3" };
Comment 1 Emmanuele Bassi (:ebassi) 2015-06-29 19:15:44 UTC
Created attachment 306317 [details] [review]
tests: Fix compiler warning

Use `const gchar * const` to define a const array of const strings, and
initialize the array when declaring it.
Comment 2 Emmanuele Bassi (:ebassi) 2015-06-29 19:17:11 UTC
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to
obtain that newer version.

Attachment 306317 [details] pushed as 475445e - tests: Fix compiler warning