summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/tests/122-redefine-whitespace.c
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2014-06-11 18:02:54 -0700
committerCarl Worth <[email protected]>2014-07-09 12:05:13 -0700
commit1d862a0b39dfd2723aac6c64f9a7609c205b3cdc (patch)
tree3a1e750d5abdcca7f25187fbf70adf65c947449b /src/glsl/glcpp/tests/122-redefine-whitespace.c
parenta6e9cd14cad555520ad98213adf541a7687a7498 (diff)
glsl/glcpp: Fixup glcpp tests for redefining a macro with whitespace changes.
Previously, the test suite was expecting the compiler to allow a redefintion of a macro with whitespace added, but gcc is more strict and allows only for changes in the amounts of whitespace, (but insists that whitespace exist or not in exactly the same places). See: https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html: These definitions are effectively the same: #define FOUR (2 + 2) #define FOUR (2 + 2) #define FOUR (2 /* two */ + 2) but these are not: #define FOUR (2 + 2) #define FOUR ( 2+2 ) #define FOUR (2 * 2) #define FOUR(score,and,seven,years,ago) (2 + 2) This change adjusts the existing "redefine-macro-legitimate" test to work with the more strict understanding, and adds a new "redefine-whitespace" test to verify that changes in the position of whitespace are flagged as errors. Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/glsl/glcpp/tests/122-redefine-whitespace.c')
-rw-r--r--src/glsl/glcpp/tests/122-redefine-whitespace.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/glsl/glcpp/tests/122-redefine-whitespace.c b/src/glsl/glcpp/tests/122-redefine-whitespace.c
new file mode 100644
index 00000000000..ae7ea09f67e
--- /dev/null
+++ b/src/glsl/glcpp/tests/122-redefine-whitespace.c
@@ -0,0 +1,16 @@
+/* Original definitions. */
+#define TWO ( 1+1 )
+#define FOUR (2 + 2)
+#define SIX (3 + 3)
+
+/* Redefinitions with whitespace in same places, but different amounts, (so no
+ * error). */
+#define TWO ( 1+1 )
+#define FOUR (2 + 2)
+#define SIX (3/*comment is whitespace*/+ /* collapsed */ /* to */ /* one */ /* space */ 3)
+
+/* Redefinitions with whitespace in different places. Each of these should
+ * trigger an error. */
+#define TWO (1 + 1)
+#define FOUR ( 2+2 )
+#define SIX (/*not*/3 + 3/*expected*/)