From 182b22c75412c6ab43349ec6183fe3d698020e94 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 22 Aug 2000 03:14:08 +0000 Subject: [PATCH] Use C99 varargs macros where possible (check __STDC_VERSION__), otherwise, Mon Aug 21 14:39:36 2000 Owen Taylor * glib.h: Use C99 varargs macros where possible (check __STDC_VERSION__), otherwise, on gcc, use an alternate form of gcc varargs which is more likely to be supported going forward. (Based on some code from Raja Harinath) --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-0 | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-12 | 8 ++++++++ ChangeLog.pre-2-2 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ glib.h | 36 ++++++++++++++++++++++++++---------- glib/glib.h | 36 ++++++++++++++++++++++++++---------- 10 files changed, 116 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6c21e7f84..b5fcb5c0a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Mon Aug 21 14:39:36 2000 Owen Taylor + + * glib.h: Use C99 varargs macros where possible + (check __STDC_VERSION__), otherwise, on gcc, use an alternate + form of gcc varargs which is more likely + to be supported going forward. (Based on some code + from Raja Harinath) + Wed Aug 9 14:12:03 2000 Owen Taylor * glib.h: Backport correct descriptive comment from diff --git a/glib.h b/glib.h index a471fa097..827c1ecc2 100644 --- a/glib.h +++ b/glib.h @@ -1291,16 +1291,32 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #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_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, diff --git a/glib/glib.h b/glib/glib.h index a471fa097..827c1ecc2 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -1291,16 +1291,32 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #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_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,