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 708793 - glib build fails with clang < 3.1: error: expected ';' after top level declarator
glib build fails with clang < 3.1: error: expected ';' after top level declar...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
2.38.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 710044 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-09-25 23:48 UTC by Ryan Schmidt
Modified: 2013-10-14 23:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build log (110.85 KB, application/octet-stream)
2013-09-25 23:48 UTC, Ryan Schmidt
Details

Description Ryan Schmidt 2013-09-25 23:48:25 UTC
Created attachment 255733 [details]
build log

I'm the maintainer of glib in MacPorts, and I just discovered that after updating our glib2 port to 2.38.0, it now fails to build with clang 2.9 and 3.0. (Some versions of clang distributed with older versions of Xcode were based on these versions.) It builds fine with clang 3.1 and later (and current versions of Xcode). This was reported to the MacPorts project here: https://trac.macports.org/ticket/40590

The error is:


In file included from deprecated/gallocator.c:1:
In file included from deprecated/gallocator.c:25:
../glib/gmessages.h:192:49: error: expected ';' after top level declarator
         ...) __attribute__((analyzer_noreturn))
                                                ^
                                                ;
../glib/gmessages.h:251:1: error: unknown type name 'GPrintFunc'
GPrintFunc g_set_print_handler (GPrintFunc func);
^
../glib/gmessages.h:251:33: error: unknown type name 'GPrintFunc'
GPrintFunc g_set_print_handler (GPrintFunc func);
                                ^
../glib/gmessages.h:256:1: error: unknown type name 'GPrintFunc'
GPrintFunc g_set_printerr_handler (GPrintFunc func);
^
../glib/gmessages.h:256:36: error: unknown type name 'GPrintFunc'
GPrintFunc g_set_printerr_handler (GPrintFunc func);
                                   ^
5 errors generated.
Comment 1 Ryan Schmidt 2013-09-26 00:34:44 UTC
Note that gmessages.h gets installed, and that a similar build error occurs when trying to compile software that uses gmessages.h, like pango or poppler. So while it's easy to mark glib2 in MacPorts as requiring clang 3.1 or later, it's more difficult to identify all the other ports that use gmessages.h and mark them as well. So we'd prefer to fix gmessages.h so that it can be compiled by clang < 3.1. I should also mention that simply adding a semicolon at location indicated in the error message does not result in a successful compile.
Comment 2 Dan Winship 2013-09-26 14:10:04 UTC
does it work if you change it to:

  static void g_error (const gchar *format,
                       ...) G_ANALYZER_NORETURN;
  
  static void
  g_error (const gchar *format,
           ...)
  {
    ...
Comment 3 Ryan Schmidt 2013-09-26 14:25:44 UTC
Ah yes, that does compile with clang 3.0! The same change is needed for g_critical.
Comment 4 Dan Winship 2013-09-28 16:32:55 UTC
fixed in git
Comment 5 Behdad Esfahbod 2013-10-14 23:31:12 UTC
*** Bug 710044 has been marked as a duplicate of this bug. ***