From 33df64519d53b29731b889772ed1eff39cbf5215 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 21 Aug 2000 18:46:52 +0000 Subject: [PATCH] Fix a couple of trivial bugs that were causing warnings. Mon Aug 21 14:46:23 2000 Owen Taylor * tests/gio-test.c: Fix a couple of trivial bugs that were causing warnings. 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 | 13 +++++++++++++ ChangeLog.pre-2-0 | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-12 | 13 +++++++++++++ ChangeLog.pre-2-2 | 13 +++++++++++++ ChangeLog.pre-2-4 | 13 +++++++++++++ ChangeLog.pre-2-6 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ glib.h | 39 ++++++++++++++++++++++++++------------- glib/glib.h | 39 ++++++++++++++++++++++++++------------- tests/gio-test.c | 4 ++-- 11 files changed, 158 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 843ac4ae..9a600498 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 843ac4ae..9a600498 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Mon Aug 21 14:46:23 2000 Owen Taylor + + * tests/gio-test.c: Fix a couple of trivial bugs that + were causing warnings. + +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) + 2000-08-17 Darin Adler * glib.h: diff --git a/glib.h b/glib.h index 72ccbfba..726dea52 100644 --- a/glib.h +++ b/glib.h @@ -1470,19 +1470,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_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, diff --git a/glib/glib.h b/glib/glib.h index 72ccbfba..726dea52 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -1470,19 +1470,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_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, diff --git a/tests/gio-test.c b/tests/gio-test.c index 80a94492..f0c087e4 100644 --- a/tests/gio-test.c +++ b/tests/gio-test.c @@ -63,7 +63,7 @@ read_all (int fd, { guint left = nbytes; guint nb; - GIOError error; + GIOError error = G_IO_ERROR_NONE; char *bufp = buffer; /* g_io_channel_read() doesn't necessarily return all the @@ -150,7 +150,7 @@ recv_message (GIOChannel *channel, if (seq != seqtab[i].seq) { g_print ("gio-test: ...from %d: invalid sequence number %d, expected %d\n", - seq, seqtab[i].seq); + fd, seq, seqtab[i].seq); g_assert_not_reached (); } seqtab[i].seq++; -- 2.34.1