Re: ## issue with glib.h
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Re: ## issue with glib.h
- Date: 21 Aug 2000 23:14:13 -0400
Raja R Harinath <harinath@cs.umn.edu> writes:
> Hi,
>
> I had confused the GCC varargs syntax for the ISO C 1999 syntax:
> thanks to Owen for clearing that up. The final draft of the standard
> is even available online -- I shouldn't have been confused ;-)
>
> Darin Adler <darin@eazel.com> writes:
> > on 8/9/00 5:00 PM, Owen Taylor at otaylor@redhat.com wrote:
> > > The best way of fixing it is probably to check for __VA_ARGS__
> > > in configure, and if found, use that even for GCC. Moving
> > > to Raja's variant above will remove the warning, but does
> > > not get rid of the use of a GCC extension.
>
> I think we should just use the __STDC_VERSION__ define -- no need for
> autoconf.
>
> #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
> # define g_message(...) g_log (DOM, LOG_MSG, __VA_ARGS__)
> #elif defined __GNUC__
> # define g_message(format_args...) g_log (DOM, LOG_MSG, format_args)
> #else
> ...
> #endif
This looks good. I've checked the following into both stable and
head glib... it seems to work fine, but let me know if I've
done anything stupid.
Owen
Index: glib.h
===================================================================
RCS file: /cvs/gnome/glib/glib.h,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -r1.186 -r1.187
--- glib.h 2000/08/17 21:37:18 1.186
+++ glib.h 2000/08/21 18:46:52 1.187
@@ -1470,19 +1470,32 @@
#ifndef G_LOG_DOMAIN
#define G_LOG_DOMAIN ((gchar*) 0)
#endif /* G_LOG_DOMAIN */
-#ifdef __GNUC__
-#define g_error(format, args...) g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_ERROR, \
- format, ##args)
-#define g_message(format, args...) g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_MESSAGE, \
- format, ##args)
-#define g_critical(format, args...) g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_CRITICAL, \
- format, ##args)
-#define g_warning(format, args...) g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_WARNING, \
- format, ##args)
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define g_error(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_ERROR, \
+ __VA_ARGS__)
+#define g_message(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_MESSAGE, \
+ __VA_ARGS__)
+#define g_critical(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ __VA_ARGS__)
+#define g_warning(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_WARNING, \
+ __VA_ARGS__)
+#elif defined (__GNUC__)
+#define g_error(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_ERROR, \
+ format)
+#define g_message(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_MESSAGE, \
+ format)
+#define g_critical(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ format)
+#define g_warning(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_WARNING, \
+ format)
#else /* !__GNUC__ */
static void
g_error (const gchar *format,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]