mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-28 02:20:04 +01:00
USE __COUNTER__ instead of __LINE__ when available
I've seen builds fail with nm-connection.c:119:691: error: declaration of '_GStaticAssertCompileTimeAssertion_119' shadows a previous local [-Werror=shadow] because several compile-time assertions ended up on the same line. __COUNTER__ is meant specifically for the purpose of constructing identifiers, so use it when available.
This commit is contained in:
parent
c51fa1852d
commit
97b0b36ae3
@ -147,7 +147,11 @@
|
||||
#ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */
|
||||
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
|
||||
#define G_PASTE(identifier1,identifier2) G_PASTE_ARGS (identifier1, identifier2)
|
||||
#ifdef __COUNTER__
|
||||
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
|
||||
#else
|
||||
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1]
|
||||
#endif
|
||||
#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user