From ce12aee15c797f8036bb881a00daa466f9458d7a Mon Sep 17 00:00:00 2001
From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de>
Date: Mon, 20 Aug 2012 11:56:14 +0000
Subject: [PATCH] make static assertions compatible with the existing version
 in base

---
 src/seq/Makefile                                    |  1 +
 .../static_assert.h => seq/seq_static_assert.h}     | 13 ++++++++-----
 src/snc/types.h                                     |  4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)
 rename src/{snc/static_assert.h => seq/seq_static_assert.h} (76%)

diff --git a/src/seq/Makefile b/src/seq/Makefile
index 59fb18e8..7a12b127 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 7ee80fe9..e363a034 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 2f13f69e..31125701 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
-- 
GitLab