diff options
author | Tom Schouten <doelie@users.sourceforge.net> | 2012-11-01 23:47:27 +0000 |
---|---|---|
committer | Tom Schouten <doelie@users.sourceforge.net> | 2012-11-01 23:47:27 +0000 |
commit | 7514a663506af67f9aeab84e60428d81c942addc (patch) | |
tree | 6a471998deca0d35280d11905d2d2b168536af53 /modules | |
parent | dd0afaa4554f62911779906cfbf585f9e6f1dd8d (diff) |
creb: proper ifdefs for __COUNTER__ macro
svn path=/trunk/externals/creb/; revision=16514
Diffstat (limited to 'modules')
-rw-r--r-- | modules/extlib_util.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/extlib_util.h b/modules/extlib_util.h index b1ceff1..50b0c20 100644 --- a/modules/extlib_util.h +++ b/modules/extlib_util.h @@ -23,14 +23,19 @@ #include <math.h> #include "m_pd.h" -/* Compile-time asserts. */ -/* On OSX it seems that _GENSYM(_ctassert_) expands to - '_ctassert___COUNTER__ i.e. the __COUNTER__ built-in symbol is not - expanded before it is concatenated. As a workaround it is disabled - on OSX. This seems OK since CT_ASSERTs serve their purpose in the - Linux build. */ -#ifdef __APPLE__ -#define CT_ASSERT(x) +// __COUNTER__ is a CPP extension enabled in gcc >= 4.3 +#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ >= 3 +#define HAVE_COUNTER +#endif +#if defined __GNUC__ && __GNUC__ >= 5 +#define HAVE_COUNTER +#endif +#ifdef __clang__ // Should we check version here? +#define HAVE_COUNTER +#endif +#ifndef HAVE_COUNTER +#warning CT_ASSERT() disabled +#define CT_ASSERT(...) #else #define CT_NAMED_ASSERT(name,x) \ typedef int _GENSYM(name ## _ctassert_)[-((x)==0)] |