summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-02 22:33:38 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-02 22:33:38 +0000
commite3905c417c729df1d42b6e94acf45effa3044127 (patch)
tree7ab539a90ee483860f9ad0ca078bf615173ee548 /gcc
parented9cd839cd3c91ce9d733716865bf9cb471faaec (diff)
downloadppe42-gcc-e3905c417c729df1d42b6e94acf45effa3044127.tar.gz
ppe42-gcc-e3905c417c729df1d42b6e94acf45effa3044127.zip
* cpptrad.c: Update comment.
testsuite: * gcc.dg/cpp/trad/directive.c: Add test. * gcc.dg/cpp/trad/macroargs.c: Add test. * gcc.dg/cpp/trad/recurse-3.c: Add tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55196 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/cpptrad.c3
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/directive.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/macroargs.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c9
6 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5b75217644c..8dae99bae5e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-03 Neil Booth <neil@daikokuya.co.uk>
+
+ * cpptrad.c: Update comment.
+
2002-07-02 Neil Booth <neil@daikokuya.co.uk>
* doc/cpp.texi: Update for traditional preprocessing changes.
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c
index 4ae1e9c7cb0..915dceb24f7 100644
--- a/gcc/cpptrad.c
+++ b/gcc/cpptrad.c
@@ -491,7 +491,8 @@ scan_out_logical_line (pfile, macro)
if ((lex_state == ls_fun_open || lex_state == ls_fun_close)
&& !pfile->state.in_directive)
{
- /* Newlines in arguments become a space. */
+ /* Newlines in arguments become a space, but we don't
+ clear any in-progress quote. */
if (lex_state == ls_fun_close)
out[-1] = ' ';
continue;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ed70f610537..62ce01d600e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2002-07-03 Neil Booth <neil@daikokuya.co.uk>
+
+ * gcc.dg/cpp/trad/directive.c: Add test.
+ * gcc.dg/cpp/trad/macroargs.c: Add test.
+ * gcc.dg/cpp/trad/recurse-3.c: Add tests.
+
2002-07-02 Neil Booth <neil@daikokuya.co.uk>
* gcc.dg/cpp/cmdlne-M.c: New test.
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/directive.c b/gcc/testsuite/gcc.dg/cpp/trad/directive.c
index 5139c3322f9..04203097b24 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/directive.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/directive.c
@@ -10,3 +10,11 @@
#if 0 /* { dg-bogus "unterminated" } */
#wrong /* { dg-error "invalid" } */
+
+#define foo 2
+#define bar + 3
+#define foobar 6
+
+#if foo/**/bar != 5
+# error Comments in directive is a separator /* { dg-bogus "error" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c b/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c
index 12effa75004..ce28cccf995 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c
@@ -4,6 +4,7 @@
/* { dg-do run } */
#define f(x, y) "x y"
+#define g(x) x
extern void abort (void);
@@ -20,5 +21,10 @@ foo
if (strcmp (str1, str2))
abort ();
+ /* Verify that quoted state is preserved over a newline. */
+ if (strcmp (g /* { dg-bogus "unterminated 2" } */ ("1
+, 2"), "1 , 2"))
+ abort ();
+
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c b/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c
index 8ff65cc801f..91485ae5f45 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c
@@ -14,3 +14,12 @@ f(f,f,f,f,f,f,f,f,f) /* { dg-bogus "detected recursion" } */
sources so let's try it too. */
#define foo(x,y) bar (x (y,0), y)
foo (foo, baz); /* { dg-bogus "detected recursion" } */
+
+#define mac mac/**/ro
+mac /* { dg-bogus "detected recursion" } */
+
+#define mac2 mac2
+"mac2" /* { dg-bogus "detected recursion" } */
+
+#define macro "macro
+macro mac2 /* { dg-bogus "detected recursion" } */
OpenPOWER on IntegriCloud