summaryrefslogtreecommitdiff
path: root/bindgen-integration/cpp/Test.h
diff options
context:
space:
mode:
authorDarren Kulp <darren@kulp.ch>2020-05-23 07:14:09 -0700
committerEmilio Cobos Álvarez <emilio@crisal.io>2020-06-21 01:40:52 +0200
commitd2e0407563156ed6c2449474c6f8a35389e7171e (patch)
tree0a77e1544232c80a35007508aa9489ad1efd61b4 /bindgen-integration/cpp/Test.h
parent63b05cb96e552e541835d1793329bbe31147d375 (diff)
Introduce tests for functional macros
Diffstat (limited to 'bindgen-integration/cpp/Test.h')
-rw-r--r--bindgen-integration/cpp/Test.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/bindgen-integration/cpp/Test.h b/bindgen-integration/cpp/Test.h
index a20cf4b7..f8b2263f 100644
--- a/bindgen-integration/cpp/Test.h
+++ b/bindgen-integration/cpp/Test.h
@@ -7,6 +7,19 @@
#define TESTMACRO_STRING_EXPANDED TESTMACRO_STRING
#define TESTMACRO_CUSTOMINTKIND_PATH 123
+// The following two macros are parsed the same by cexpr, but are semantically
+// different.
+#define TESTMACRO_NONFUNCTIONAL (TESTMACRO_INTEGER)
+#define TESTMACRO_FUNCTIONAL_EMPTY(TESTMACRO_INTEGER)
+#define TESTMACRO_FUNCTIONAL_NONEMPTY(TESTMACRO_INTEGER)-TESTMACRO_INTEGER
+#define TESTMACRO_FUNCTIONAL_TOKENIZED( a, b ,c,d,e ) a/b c d ## e
+#define TESTMACRO_FUNCTIONAL_SPLIT( a, \
+ b) b,\
+ a
+//#define TESTMACRO_INVALID("string") // A conforming preprocessor rejects this
+#define TESTMACRO_STRING_EXPR ("string")
+#define TESTMACRO_STRING_FUNC_NON_UTF8(x) (x "˙˙") /* invalid UTF-8 on purpose */
+
#include <cwchar>
enum {