GNOME Bugzilla – Bug 346730
some warnings about enums and macros
Last modified: 2008-05-06 12:54:06 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.
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..
Created attachment 68454 [details] [review] patch to remove extra commas at end of enums
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
commited the gstmessage.h fix.
Wim, is this completely fixed now ?
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...
Vincent: does reversing the order as suggested above help?
i'm sorry but I can't check the modifications right now (i'm on holydays with a windows box...)
i've swapped the 2 #define, but the warnings are still there
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.
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.
Ok, let's close this as WONTFIX then.