macros: simplify static assert fallback to use __COUNTER__

It is rather annoying that the other sizeof form doesn't work with Clang.
This at least gets things working (assuming you have __COUNTER__ support)
which most things we care about do at this point (including MSVC).
This commit is contained in:
Christian Hergert
2020-08-14 12:59:29 -07:00
parent 620f1f0ff0
commit 691b6ef342

View File

@ -75,7 +75,7 @@
#elif SYSPROF_GNUC_CHECK_VERSION(4, 6)
# define SYSPROF_STATIC_ASSERT(expr, msg) _Static_assert(expr, msg)
#else
# define SYSPROF_STATIC_ASSERT(expr, msg) ((void) sizeof (char[(expr) ? 1 : -1]))
# define SYSPROF_STATIC_ASSERT(expr, msg) char __static_assert_##__COUNTER__ [(expr) ? 0 : -1];
#endif
#if INT_MAX == LONG_MAX