mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 00:48:53 +02:00
gmacros: Use G_C_STD_CHECK_VERSION to define C-std dependent items
This commit is contained in:
@@ -109,19 +109,19 @@
|
|||||||
|
|
||||||
/* Every compiler that we target supports inlining, but some of them may
|
/* Every compiler that we target supports inlining, but some of them may
|
||||||
* complain about it if we don't say "__inline". If we have C99, or if
|
* complain about it if we don't say "__inline". If we have C99, or if
|
||||||
* we are using C++, then we can use "inline" directly. Unfortunately
|
* we are using C++, then we can use "inline" directly.
|
||||||
* Visual Studio does not support __STDC_VERSION__, so we need to check
|
|
||||||
* whether we are on Visual Studio 2013 or earlier to see that we need to
|
|
||||||
* say "__inline" in C mode.
|
|
||||||
* Otherwise, we say "__inline" to avoid the warning.
|
* Otherwise, we say "__inline" to avoid the warning.
|
||||||
|
* Unfortunately Visual Studio does not define __STDC_VERSION__ (if not
|
||||||
|
* using /std:cXX) so we need to check whether we are on Visual Studio 2013
|
||||||
|
* or earlier to see whether we need to say "__inline" in C mode.
|
||||||
*/
|
*/
|
||||||
#define G_CAN_INLINE
|
#define G_CAN_INLINE
|
||||||
#ifndef G_CXX_STD_VERSION
|
#ifdef G_C_STD_VERSION
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# if (_MSC_VER < 1900)
|
# if (_MSC_VER < 1900)
|
||||||
# define G_INLINE_DEFINE_NEEDED
|
# define G_INLINE_DEFINE_NEEDED
|
||||||
# endif
|
# endif
|
||||||
# elif !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199900)
|
# elif !G_C_STD_CHECK_VERSION (99)
|
||||||
# define G_INLINE_DEFINE_NEEDED
|
# define G_INLINE_DEFINE_NEEDED
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -862,8 +862,8 @@
|
|||||||
#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */
|
#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */
|
||||||
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
|
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
|
||||||
#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2)
|
#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2)
|
||||||
#if !defined(G_CXX_STD_VERSION) && defined(__STDC_VERSION__) && \
|
#if (G_C_STD_CHECK_VERSION (11) || \
|
||||||
(__STDC_VERSION__ >= 201112L || g_macro__has_feature(c_static_assert) || g_macro__has_extension(c_static_assert))
|
g_macro__has_feature(c_static_assert) || g_macro__has_extension(c_static_assert))
|
||||||
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
|
#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
|
||||||
#elif G_CXX_STD_CHECK_VERSION (11)
|
#elif G_CXX_STD_CHECK_VERSION (11)
|
||||||
#define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false")
|
#define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false")
|
||||||
@@ -873,7 +873,7 @@
|
|||||||
#else
|
#else
|
||||||
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] G_GNUC_UNUSED
|
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1] G_GNUC_UNUSED
|
||||||
#endif
|
#endif
|
||||||
#endif /* __STDC_VERSION__ */
|
#endif /* G_C_STD_CHECK_VERSION (11) */
|
||||||
#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
|
#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
|
||||||
#endif /* !__GI_SCANNER__ */
|
#endif /* !__GI_SCANNER__ */
|
||||||
|
|
||||||
@@ -887,7 +887,7 @@
|
|||||||
/* Provide a string identifying the current function, non-concatenatable */
|
/* Provide a string identifying the current function, non-concatenatable */
|
||||||
#if defined (__GNUC__) && defined (G_CXX_STD_VERSION)
|
#if defined (__GNUC__) && defined (G_CXX_STD_VERSION)
|
||||||
#define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
|
#define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
|
||||||
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
#elif G_C_STD_CHECK_VERSION (99)
|
||||||
#define G_STRFUNC ((const char*) (__func__))
|
#define G_STRFUNC ((const char*) (__func__))
|
||||||
#elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300))
|
#elif defined (__GNUC__) || (defined(_MSC_VER) && (_MSC_VER > 1300))
|
||||||
#define G_STRFUNC ((const char*) (__FUNCTION__))
|
#define G_STRFUNC ((const char*) (__FUNCTION__))
|
||||||
@@ -1018,8 +1018,7 @@
|
|||||||
*
|
*
|
||||||
* Since: 2.60
|
* Since: 2.60
|
||||||
*/
|
*/
|
||||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \
|
#if G_C_STD_CHECK_VERSION (11)
|
||||||
!defined(G_CXX_STD_VERSION)
|
|
||||||
#define G_ALIGNOF(type) _Alignof (type) \
|
#define G_ALIGNOF(type) _Alignof (type) \
|
||||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||||
#else
|
#else
|
||||||
@@ -1082,7 +1081,7 @@
|
|||||||
/* Use MSVC specific syntax. */
|
/* Use MSVC specific syntax. */
|
||||||
# define G_NORETURN __declspec (noreturn)
|
# define G_NORETURN __declspec (noreturn)
|
||||||
/* Use ISO C11 syntax when the compiler supports it. */
|
/* Use ISO C11 syntax when the compiler supports it. */
|
||||||
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112
|
#elif G_C_STD_CHECK_VERSION (11)
|
||||||
# define G_NORETURN _Noreturn
|
# define G_NORETURN _Noreturn
|
||||||
#else
|
#else
|
||||||
# define G_NORETURN /* empty */
|
# define G_NORETURN /* empty */
|
||||||
|
Reference in New Issue
Block a user