From a715d7143d9d17da17e67fec6af1c01409a71a31 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 8 Apr 2014 22:19:48 +0800 Subject: Prevent ## to appear at start or end of macro --- tests/tests2/65_macro_concat_start.c | 2 ++ tests/tests2/65_macro_concat_start.expect | 1 + tests/tests2/66_macro_concat_end.c | 2 ++ tests/tests2/66_macro_concat_end.expect | 1 + tests/tests2/Makefile | 4 +++- 5 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/tests2/65_macro_concat_start.c create mode 100644 tests/tests2/65_macro_concat_start.expect create mode 100644 tests/tests2/66_macro_concat_end.c create mode 100644 tests/tests2/66_macro_concat_end.expect (limited to 'tests') diff --git a/tests/tests2/65_macro_concat_start.c b/tests/tests2/65_macro_concat_start.c new file mode 100644 index 0000000..d63d67a --- /dev/null +++ b/tests/tests2/65_macro_concat_start.c @@ -0,0 +1,2 @@ +#define paste(A,B) ##A B +paste(x,y) diff --git a/tests/tests2/65_macro_concat_start.expect b/tests/tests2/65_macro_concat_start.expect new file mode 100644 index 0000000..88ed6c5 --- /dev/null +++ b/tests/tests2/65_macro_concat_start.expect @@ -0,0 +1 @@ +65_macro_concat_start.c:1: error: '##' invalid at start of macro diff --git a/tests/tests2/66_macro_concat_end.c b/tests/tests2/66_macro_concat_end.c new file mode 100644 index 0000000..55dcaef --- /dev/null +++ b/tests/tests2/66_macro_concat_end.c @@ -0,0 +1,2 @@ +#define paste(A,B) A B## +paste(x,y) diff --git a/tests/tests2/66_macro_concat_end.expect b/tests/tests2/66_macro_concat_end.expect new file mode 100644 index 0000000..224e5c9 --- /dev/null +++ b/tests/tests2/66_macro_concat_end.expect @@ -0,0 +1 @@ +66_macro_concat_end.c:2: error: '##' invalid at end of macro diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile index 36d84dc..41adb2d 100644 --- a/tests/tests2/Makefile +++ b/tests/tests2/Makefile @@ -79,7 +79,9 @@ TESTS = \ 61_undefined_enum.test \ 62_enumerator_redefinition.test \ 63_local_enumerator_redefinition.test \ - 64_macro_nesting.test + 64_macro_nesting.test \ + 65_macro_concat_start.test \ + 66_macro_concat_end.test # 30_hanoi.test -- seg fault in the code, gcc as well # 34_array_assignment.test -- array assignment is not in C standard -- cgit v1.3.1