From 105e2137d67b98c24251be3586985fb61aeaf28a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 23:19:01 -0700 Subject: [PATCH] glcpp: Add two new tests for testing redefined macros. The specification says that redefining a macro is an error, unless the new definitions is identical to the old one, (identical replacement lists but ignoring differing amounts of whitespace). --- .../glcpp/tests/088-redefine-macro-legitimate.c | 5 ++++ .../tests/088-redefine-macro-legitimate.c.expected | 6 +++++ src/glsl/glcpp/tests/089-redefine-macro-error.c | 17 ++++++++++++ .../tests/089-redefine-macro-error.c.expected | 30 ++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 src/glsl/glcpp/tests/088-redefine-macro-legitimate.c create mode 100644 src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected create mode 100644 src/glsl/glcpp/tests/089-redefine-macro-error.c create mode 100644 src/glsl/glcpp/tests/089-redefine-macro-error.c.expected diff --git a/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c new file mode 100644 index 0000000..0e0666b --- /dev/null +++ b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c @@ -0,0 +1,5 @@ +#define abc 123 +#define abc 123 + +#define foo(x) (x)+23 +#define foo(x) ( x ) + 23 diff --git a/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected new file mode 100644 index 0000000..6fb66a5 --- /dev/null +++ b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/089-redefine-macro-error.c b/src/glsl/glcpp/tests/089-redefine-macro-error.c new file mode 100644 index 0000000..b3d1391 --- /dev/null +++ b/src/glsl/glcpp/tests/089-redefine-macro-error.c @@ -0,0 +1,17 @@ +#define x y +#define x z + +#define abc 123 +#define abc() 123 + +#define foo() bar +#define foo(x) bar + +#define bar() baz +#define bar baz + +#define biff(a,b) a+b +#define biff(a,b,c) a+b + +#define oper(a,b) a+b +#define oper(a,b) a*b diff --git a/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected b/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected new file mode 100644 index 0000000..6209ead --- /dev/null +++ b/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected @@ -0,0 +1,30 @@ +0:2(9): preprocessor error: Redefinition of macro x + +0:5(9): preprocessor error: Redefinition of macro abc + +0:8(9): preprocessor error: Redefinition of macro foo + +0:11(9): preprocessor error: Redefinition of macro bar + +0:14(9): preprocessor error: Redefinition of macro biff + +0:17(9): preprocessor error: Redefinition of macro oper + + + + + + + + + + + + + + + + + + + -- 2.7.4