GNOME Bugzilla – Bug 373041
Location of G_GNUC_INTERNAL breaks Solaris build
Last modified: 2011-11-11 10:03:55 UTC
gnome-system-monitor makes extensive use of the G_GNUC_INTERNAL macro. For the Solaris forte compiler this must be placed at the start of the line. Can you please apply the attached patch this does this 91 times for various gnome-system-monitor files. This will not affect gcc - it does not care where the macro is placed.
Created attachment 76288 [details] [review] Move G_GNUC_INTERNAL to start of line to build on Solaris
This is compiler safe - see discussion with gtk-engines at http://bugzilla.gnome.org/show_bug.cgi?id=350606
I was part of that discussion and haven't change my mind. I don't expect a compiler that is not the GNU compiler to expand G_GNUC macros. That's what the documentation says. G_GNUC_INTERNAL #define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) Expands to the GNU C visibility(hidden) attribute if the compiler supports it (currently only gcc). This attribute can be used for marking library functions as being used internally to the lib only, to not create inefficient PLT entries. Note that static functions do not need to be marked as internal in this way. See the GNU C documentation for details.
"currently only gcc" - that is an inaccurate statement. Forte supports it, but it needs to have it placed at the start of the line.
Then the other guy from AIX comes to me 'Location of G_GNUC_INTERNAL breaks AIX build' requesting G_GNUC_INTERNAL to be at end of declaration...
AIX? They still make that ;) gtk-engines (bug 350606), GIMP (bug 352268), gnome-applets (bug 352271) and libgnomeui (bug 352274) have all accepted equivalent patches, so they are happy that AIX and other OS will not be affected. In cairo they don't expand the macro when it's not gcc or not Solaris. http://gitweb.freedesktop.org/?p=cairo;a=blobdiff;h=9d1c789d2209aab3f969cc1e6baef5a997826e85;hp=447c1ac0bb8fba938495c26abefaecb3e1f87f78;hb=04757a3aa8deeff3265719ebe01b021638990ec6;f=src/cairoint.h
I do agree that it would be better if a new macro that doesn't have GCC in its name were created and the current macro made obsolete. Since so many other modules (Xorg code, cairo, etc.) put the macro at the beginning, I don't see that it should be a problem to standardize its location there. Note that currently GCC allows the macro to be placed anywhere in the declaration (before, after, etc), so this doesn't break GCC. If you review the current GNOME code there is no consistancy about where the macro is placed. These bugs at least standardize the location to the same location as used in Xorg, at the beginning. Some consistancy is better than none, I think. I don't see any problem with accepting this patch. If another compiler comes along with other requirements, then we can deal with that when the time comes.
The glib documentation has been changed by Matthais Clasen (bug 373041).
glib accepted a similar patch recently see bug #438873.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.