From: Neil Booth Date: Tue, 2 Jul 2002 22:33:38 +0000 (+0000) Subject: cpptrad.c: Update comment. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0879540b3daea61f92dfc224046f36fbe837785c;p=gcc.git cpptrad.c: Update comment. * 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. From-SVN: r55196 --- 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 + + * cpptrad.c: Update comment. + 2002-07-02 Neil Booth * 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 + + * 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 * 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" } */