summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-17 13:19:04 -0700
committerCarl Worth <cworth@cworth.org>2010-05-17 13:21:13 -0700
commit1a29500e72ac338c1fb243742aff1c167e1059db (patch)
tree0ee7e546ab5d2ba21b4c86be0450f47ac9830b24 /tests
parent796e1f0eadcfbbc6e4d79778b2378975204bb97c (diff)
Fix (and add test for) function-like macro invocation with newlines.
The test has a newline before the left parenthesis, and newlines to separate the parentheses from the argument. The fix involves more state in the lexer to only return a NEWLINE token when termniating a directive. This is very similar to our previous fix with extra lexer state to only return the SPACE token when it would be significant for the parser. With this change, the exact number and positioning of newlines in the output is now different compared to "gcc -E" so we add a -B option to diff when testing to ignore that.
Diffstat (limited to 'tests')
-rw-r--r--tests/026-define-func-extra-newlines.c6
-rwxr-xr-xtests/glcpp-test2
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/026-define-func-extra-newlines.c b/tests/026-define-func-extra-newlines.c
new file mode 100644
index 0000000000..0d83740530
--- /dev/null
+++ b/tests/026-define-func-extra-newlines.c
@@ -0,0 +1,6 @@
+#define foo(a) bar
+
+foo
+(
+1
+)
diff --git a/tests/glcpp-test b/tests/glcpp-test
index bd204de1e2..673a4f45e9 100755
--- a/tests/glcpp-test
+++ b/tests/glcpp-test
@@ -5,5 +5,5 @@ for test in *.c; do
../glcpp < $test > $test.out
gcc -E $test -o $test.gcc
grep -v '^#' < $test.gcc > $test.expected
- diff -w -u $test.expected $test.out
+ diff -B -w -u $test.expected $test.out
done