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
This commit is contained in:
Emmanuele Bassi 2022-06-29 18:12:55 +01:00
parent 89b34963e7
commit 2a12de5b1d
3 changed files with 8 additions and 15 deletions

View File

@ -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
---

View File

@ -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

View File

@ -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('''