[glib/ebassi/c99-macro-varargs] Require C99's __VA_ARGS__




commit 8d26e8ca3d8880340f71133b93dbde3dcc88e707
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jun 29 18:12:55 2022 +0100

    Require C99's __VA_ARGS__
    
    We have fallback in places for GNU's variadic arguments in macros, and
    for static inline functions with variadic arguments as an fallback of
    last resort, but going forward we are going to depend on `__VA_ARGS__`
    for macros that cannot be re-implemented using a static inline function.
    
    Fixes: #2681

 docs/toolchain-requirements.md |  6 +++---
 glib/glibconfig.h.in           |  3 +--
 meson.build                    | 14 ++++----------
 3 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/docs/toolchain-requirements.md b/docs/toolchain-requirements.md
index fe5804a7c7..8028cd509e 100644
--- a/docs/toolchain-requirements.md
+++ b/docs/toolchain-requirements.md
@@ -40,12 +40,12 @@ features’ are assumed.  Those are detailed below.
 
 GLib additionally requires Python 3 to build.
 
-Varargs macros
+C99 Varargs macros
 ---
 
-_Not a hard requirement._
+_Hard requirement._
 
-GLib can work with either C99 or GNU style varargs macros.
+GLib requires C99 ``__VA_ARG__`` support for both C and C++ compilers.
 
 Symbol visibility control
 ---
diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in
index e66748d95d..ffedee1d2a 100644
--- a/glib/glibconfig.h.in
+++ b/glib/glibconfig.h.in
@@ -118,8 +118,7 @@ typedef unsigned @glib_intptr_type_define@ guintptr;
 
 @glib_vacopy@
 
-@g_have_iso_c_varargs@
-@g_have_iso_cxx_varargs@
+#define G_HAVE_ISO_VARARGS 1
 
 /* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
  * is passed ISO vararg support is turned off, and there is no work
diff --git a/meson.build b/meson.build
index 5c85db9b2f..6f83a72cfe 100644
--- a/meson.build
+++ b/meson.build
@@ -1715,11 +1715,8 @@ g_have_iso_c_varargs = cc.compiles('''
     call_a(2,3);
   }''', name : 'ISO C99 varargs macros in C')
 
-if g_have_iso_c_varargs
-  glibconfig_conf.set('g_have_iso_c_varargs', '''
-#ifndef __cplusplus
-# define G_HAVE_ISO_VARARGS 1
-#endif''')
+if not g_have_iso_c_varargs
+  error('GLib requires a C compiler with support for C99 __VA_ARG__ in macros.')
 endif
 
 g_have_iso_cxx_varargs = cxx.compiles('''
@@ -1729,11 +1726,8 @@ g_have_iso_cxx_varargs = cxx.compiles('''
     call_a(2,3);
   }''', name : 'ISO C99 varargs macros in C++')
 
-if g_have_iso_cxx_varargs
-  glibconfig_conf.set('g_have_iso_cxx_varargs', '''
-#ifdef __cplusplus
-# define G_HAVE_ISO_VARARGS 1
-#endif''')
+if not g_have_iso_cxx_varargs
+  error('GLib requires a C++ compiler with support for C99 __VA_ARG__ in macros.')
 endif
 
 g_have_gnuc_varargs = cc.compiles('''


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]