From 5df92b7423bb3d07b3b87c27ca9eab1e6f964362 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 18 May 2001 16:00:54 +0000 Subject: [PATCH] Use compile checks for ISO C99 and GNU extension varargs macros syntax and Fri May 18 10:52:23 2001 Owen Taylor * configure.in gmessages.h: Use compile checks for ISO C99 and GNU extension varargs macros syntax and store result in glibconfig.h (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying on checking predefined macros. --- ChangeLog | 9 ++++++++- ChangeLog.pre-2-0 | 9 ++++++++- ChangeLog.pre-2-10 | 9 ++++++++- ChangeLog.pre-2-12 | 9 ++++++++- ChangeLog.pre-2-2 | 9 ++++++++- ChangeLog.pre-2-4 | 9 ++++++++- ChangeLog.pre-2-6 | 9 ++++++++- ChangeLog.pre-2-8 | 9 ++++++++- configure.in | 34 ++++++++++++++++++++++++++++++++++ glib/gmessages.h | 6 +++--- gmessages.h | 6 +++--- 11 files changed, 104 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 637a1b78c..6b3896145 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 637a1b78c..6b3896145 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Fri May 18 10:52:23 2001 Owen Taylor + + * configure.in gmessages.h: Use compile checks for ISO C99 and GNU + extension varargs macros syntax and store result in glibconfig.h + (G_HAVE_ISO_VARARGS, G_HAVE_GNUC_VARARGS) rather than relying + on checking predefined macros. + 2001-05-18 Michael Natterer * gmarkup.c: don't g_strdup()/g_free() all parsed attributes and @@ -60,7 +67,7 @@ Sun May 13 10:31:17 2001 Owen Taylor Thu May 10 23:21:30 2001 Owen Taylor - * gmessages.c (g_log_write_prefix): Avoid using stderr + * gmessages.c (g_log_write_prefix): Avoid using stdio to be as robust as possible in out-of-memory. * gmessages.c (g_log_default_handler): Remove some dead diff --git a/configure.in b/configure.in index 3f4f488e8..e2f6b2ffa 100644 --- a/configure.in +++ b/configure.in @@ -376,6 +376,23 @@ case x$glib_cv_hasinline in xyes) AC_DEFINE(G_HAVE_INLINE,1,[Have inline keyword]) esac +# check for flavours of varargs macros +AC_MSG_CHECKING(for ISO C99 varargs macros) +AC_TRY_COMPILE([],[ +int a(int p1, int p2, int p3); +#define call_a(...) a(1,__VA_ARGS__) +call_a(2,3); +],g_have_iso_varargs=yes,g_have_iso_varargs=no) +AC_MSG_RESULT($g_have_iso_varargs) + +AC_MSG_CHECKING(for GNUC varargs macros) +AC_TRY_COMPILE([],[ +int a(int p1, int p2, int p3); +#define call_a(params...) a(1,params) +call_a(2,3); +],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no) +AC_MSG_RESULT($g_have_gnuc_varargs) + # check for bytesex stuff AC_C_BIGENDIAN @@ -1627,6 +1644,20 @@ $glib_inline #endif /* !__cplusplus */ _______EOF + if test x$g_have_iso_varargs ; then + cat >>$outfile <<_______EOF + +#define G_HAVE_ISO_VARARGS +_______EOF + fi + if test x$g_have_gnuc_varargs ; then + cat >>$outfile <<_______EOF + +#define G_HAVE_GNUC_VARARGS +_______EOF + fi + + echo >>$outfile if test x$g_have_eilseq = xno; then cat >>$outfile <<_______EOF @@ -1907,6 +1938,9 @@ if test x$glib_cv_has__inline__ = xyes; then #define G_HAVE___INLINE__ 1" fi +g_have_gnuc_varargs=$g_have_gnuc_varargs +g_have_iso_varargs=$g_have_iso_varargs + case xyes in x$ac_cv_c_bigendian) g_byte_order=G_BIG_ENDIAN diff --git a/glib/gmessages.h b/glib/gmessages.h index aa10eaf35..817957def 100644 --- a/glib/gmessages.h +++ b/glib/gmessages.h @@ -97,7 +97,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #ifndef G_LOG_DOMAIN #define G_LOG_DOMAIN ((gchar*) 0) #endif /* G_LOG_DOMAIN */ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#ifdef G_HAVE_ISO_VARARGS #define g_error(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ __VA_ARGS__) @@ -110,7 +110,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #define g_warning(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_WARNING, \ __VA_ARGS__) -#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4) +#elif defined(G_HAVE_GNUC_VARARGS) #define g_error(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ format) @@ -123,7 +123,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #define g_warning(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_WARNING, \ format) -#else /* !__GNUC__ */ +#else /* no varargs macros */ static void g_error (const gchar *format, ...) diff --git a/gmessages.h b/gmessages.h index aa10eaf35..817957def 100644 --- a/gmessages.h +++ b/gmessages.h @@ -97,7 +97,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #ifndef G_LOG_DOMAIN #define G_LOG_DOMAIN ((gchar*) 0) #endif /* G_LOG_DOMAIN */ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#ifdef G_HAVE_ISO_VARARGS #define g_error(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ __VA_ARGS__) @@ -110,7 +110,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #define g_warning(...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_WARNING, \ __VA_ARGS__) -#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4) +#elif defined(G_HAVE_GNUC_VARARGS) #define g_error(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_ERROR, \ format) @@ -123,7 +123,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); #define g_warning(format...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_WARNING, \ format) -#else /* !__GNUC__ */ +#else /* no varargs macros */ static void g_error (const gchar *format, ...)