diff --git a/src/seq/Makefile b/src/seq/Makefile index 59fb18e89e5a95f22ecae9e92e5f7ac3ff5b71c2..7a12b127899d4f3be7212064a1c08263b31de18a 100644 --- a/src/seq/Makefile +++ b/src/seq/Makefile @@ -7,6 +7,7 @@ include $(TOP)/configure/CONFIG # Include files INC += seqCom.h INC += seq_release.h +INC += seq_static_assert.h # seq library LIBRARY = seq diff --git a/src/snc/static_assert.h b/src/seq/seq_static_assert.h similarity index 76% rename from src/snc/static_assert.h rename to src/seq/seq_static_assert.h index 7ee80fe9ad23a5acaf47655d9edca7c24cbd22c5..e363a0342cd88ac06a6a639b3ab3ac06583a0b5e 100644 --- a/src/snc/static_assert.h +++ b/src/seq/seq_static_assert.h @@ -10,15 +10,18 @@ in the file LICENSE that is included with this distribution. #ifndef INCLstatic_asserth #define INCLstatic_asserth -#define CONCAT2(x,y) x ## y -#define CONCAT(x,y) CONCAT2(x,y) -#define STATIC_ASSERT(cond,msg) \ - typedef struct { int CONCAT(static_assertion_failed_,msg) : !!(cond); } \ - CONCAT(static_assertion_failed_,__COUNTER__) +#ifndef STATIC_ASSERT + +#define STATIC_JOIN(x, y) STATIC_JOIN2(x, y) +#define STATIC_JOIN2(x, y) x ## y +#define STATIC_ASSERT(expr) \ + typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \ + [ (expr) ? 1 : -1 ] /* * usage: * STATIC_ASSERT(condition_to_assert, identifier_that_explains_the_assertion); */ +#endif #endif /*INCLstatic_asserth*/ diff --git a/src/snc/types.h b/src/snc/types.h index 2f13f69ef9655d84b0450a6dedafb5f94fc7c7f9..31125701430722e809d9b99f2a1364410550d933 100644 --- a/src/snc/types.h +++ b/src/snc/types.h @@ -14,7 +14,7 @@ in the file LICENSE that is included with this distribution. #include <epicsVersion.h> -#include "static_assert.h" +#include "seq_static_assert.h" #include "var_types.h" #ifndef TRUE @@ -310,7 +310,7 @@ enum expr_type /* description [child expressions...] */ }; /* make sure we have no more expression types than bits */ -STATIC_ASSERT(NUM_EXPR_TYPES <= 8*sizeof(TypeMask), expr_types_fit_into_TypeMask); +STATIC_ASSERT(NUM_EXPR_TYPES <= 8*sizeof(TypeMask)); /* Accessors for child expressions. Would like to define structs for the various expression types with children, but then we could no longer