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 346730 - some warnings about enums and macros
some warnings about enums and macros
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.8
Other Linux
: Normal trivial
: 0.10.9
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-07-06 07:32 UTC by Vincent Torri
Modified: 2008-05-06 12:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to remove extra commas at end of enums (4.13 KB, patch)
2006-07-06 09:18 UTC, Wim Taymans
committed Details | Review

Description Vincent Torri 2006-07-06 07:32:49 UTC
hello,

while compiling avisynth3 on amd64 (on Compile Farm), I get these warnings (I compile with -ansi -pedantic -Wall -W -Wpointer-arith -Wconversion -Wstrict-prototypes -Wmissing-declarations):

* About enumerators:
gstclock.h:236: warning: comma at end of enumerator list
gstclock.h:333: warning: comma at end of enumerator list
gstiterator.h:44: warning: comma at end of enumerator list
gstiterator.h:60: warning: comma at end of enumerator list
gstevent.h:52: warning: comma at end of enumerator list
gsttask.h:63: warning: comma at end of enumerator list
gstpad.h:72: warning: comma at end of enumerator list
gstpad.h:175: warning: comma at end of enumerator list
gstbus.h:69: warning: comma at end of enumerator list
gstplugin.h:76: warning: comma at end of enumerator list

gstmessage.h:86: warning: ISO C restricts enumerator values to range of `int'

* About macros:
gstinfo.h (several lines): warning: anonymous variadic macros were introduced in C99

I suppose that the last warnings can't be suppressed, nor the previous one , in C ANSI. But the others can be fixed easily.
Comment 1 Wim Taymans 2006-07-06 09:14:33 UTC
The commas are an easy fix (see patch).

I suspect the 0xfffffff in gstmessage.h is overflowing the int, could be made 0x7fffffff, I guess. Can you try if this works?

Can you say which of the macro constructs it is complaining about? Normally glib should define what the compiler supports, but being supported probably does not mean the compiler won't complain about it..
Comment 2 Wim Taymans 2006-07-06 09:18:59 UTC
Created attachment 68454 [details] [review]
patch to remove extra commas at end of enums
Comment 3 Vincent Torri 2006-07-06 11:11:00 UTC
for gstmessage.h, the value 0x7fffffff is good. No more warning

for the macros, here are the warnings:

gstinfo.h:399:44: warning: anonymous variadic macros were introduced in C99
gstinfo.h:589:38: warning: anonymous variadic macros were introduced in C99
gstinfo.h:590:40: warning: anonymous variadic macros were introduced in C99
gstinfo.h:591:37: warning: anonymous variadic macros were introduced in C99
gstinfo.h:592:38: warning: anonymous variadic macros were introduced in C99
gstinfo.h:593:36: warning: anonymous variadic macros were introduced in C99
gstinfo.h:595:27: warning: anonymous variadic macros were introduced in C99
gstinfo.h:596:29: warning: anonymous variadic macros were introduced in C99
gstinfo.h:597:26: warning: anonymous variadic macros were introduced in C99
gstinfo.h:598:27: warning: anonymous variadic macros were introduced in C99
gstinfo.h:599:25: warning: anonymous variadic macros were introduced in C99
gstinfo.h:601:30: warning: anonymous variadic macros were introduced in C99
gstinfo.h:602:32: warning: anonymous variadic macros were introduced in C99
gstinfo.h:603:29: warning: anonymous variadic macros were introduced in C99
gstinfo.h:604:30: warning: anonymous variadic macros were introduced in C99
gstinfo.h:605:28: warning: anonymous variadic macros were introduced in C99
gstinfo.h:607:19: warning: anonymous variadic macros were introduced in C99
gstinfo.h:608:21: warning: anonymous variadic macros were introduced in C99
gstinfo.h:609:18: warning: anonymous variadic macros were introduced in C99
gstinfo.h:610:19: warning: anonymous variadic macros were introduced in C99
gstinfo.h:611:17: warning: anonymous variadic macros were introduced in C99
Comment 4 Wim Taymans 2006-07-07 11:45:06 UTC
commited the gstmessage.h fix.
Comment 5 Thomas Vander Stichele 2006-07-12 19:24:02 UTC
Wim, is this completely fixed now ?
Comment 6 Wim Taymans 2006-07-17 10:48:48 UTC
no, the macros are still triggering a warning. One possible solution could be to reverse the order, like:

#ifdef G_HAVE_ISO_VARARGS
#define GST_CAT_LEVEL_LOG(cat,level,object,...) ...
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define GST_CAT_LEVEL_LOG(cat,level,object,args...) ...
#else /* no variadic macros, use inline */
static inline void
GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
    GstDebugLevel level, gpointer object, const char *format, va_list varargs)
#endif
#endif /* G_HAVE_ISO_VARARGS */

becomes:

#ifdef G_HAVE_GNUC_VARARGS
#define GST_CAT_LEVEL_LOG(cat,level,object,args...) ...
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_ISO_VARARGS
#define GST_CAT_LEVEL_LOG(cat,level,object,...) ...
#else /* no variadic macros, use inline */
static inline void
GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
    GstDebugLevel level, gpointer object, const char *format, va_list varargs)
#endif
#endif /* G_HAVE_ISO_VARARGS */

Comments in the source suggest that this used to be the case at some point...

Comment 7 Tim-Philipp Müller 2006-08-10 16:20:53 UTC
Vincent: does reversing the order as suggested above help?
Comment 8 Vincent Torri 2006-08-10 22:18:38 UTC
i'm sorry but I can't check the modifications right now (i'm on holydays with a windows box...)
Comment 9 Vincent Torri 2006-08-13 14:01:48 UTC
i've swapped the 2 #define, but the warnings are still there
Comment 10 Tim-Philipp Müller 2006-10-12 11:56:59 UTC
Any progress on this one?

Do we really want to fix every warning, even if the warning comes up only with hardcore options like -ansi -pedantic? Seems a bit pointless to me.
Comment 11 David Schleef 2006-10-12 20:29:46 UTC
It's good to have clean header files.  It makes it easier for other people to use whatever compiler warnings they choose.

GStreamer (and glib) headers are not c89 compliant if they are not built with a c89 compiler.  This is a limitation of glib's headers.  In particular, glibconfig.h doesn't know that when the -ansi option is specified that c99 variadic macros are not allowed.

I suppose this bug could be reassigned to glib, but I doubt there's a way to fix it.
Comment 12 Sebastian Dröge (slomo) 2008-05-06 12:54:06 UTC
Ok, let's close this as WONTFIX then.