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 598508 - Make prototype warning in gtkitemfactory.h:47 go away
Make prototype warning in gtkitemfactory.h:47 go away
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-10-15 02:05 UTC by Lennart Poettering
Modified: 2010-02-23 17:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Lennart Poettering 2009-10-15 02:05:10 UTC
If one compiles a Gtk+ program with -Wstrict-prototypes enabled, one will encounter this message:

/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

This is quite annoying. An easy fix would be to use 

#pragma GCC diagnostic ignored "-Wno-strict-prototypes"

at the top of the header files, which disables strict prototype checking. That #pragma is new in some GCC 4.x version, so it might make sense to protect this:

#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#pragma GCC diagnostic ignored "-Wno-strict-prototypes"
#endif

Of course, using this will disable the warning for the entire .c file. However, I'd argue that this shouldn't be much of a problem, since the -Wstrict-prototypes output is useless anyway here. Also, the user could still manually reenable that flag.

http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html

Haven't prepped a patch for this yet. Can do if requested.
Comment 1 Jean Bréfort 2010-02-14 08:07:55 UTC
It's easier to fix the prototype, just needs to add void:
typedef	void	(*GtkItemFactoryCallback)  (void);
Comment 2 Jean Bréfort 2010-02-14 08:20:41 UTC
Hmm forget my comment, I should have read the comment before :(
Comment 3 Matthias Clasen 2010-02-23 17:03:35 UTC
Can't fix this compatibly. Its all deprecated anyway
Comment 4 Lennart Poettering 2010-02-23 17:11:03 UTC
Matthias, what's wrong with my suggestion above? What's not comaptible about that?

And the fact that this part is deprecated doesn't really matter much given that gtk.h includes it and hence it shows up everywhere.
Comment 5 Matthias Clasen 2010-02-23 17:31:25 UTC
Its going away in gtk3. no need to muck around with cosmetics before then.