diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-11 08:43:56 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-11 08:43:56 +0000 |
commit | 23391b1ec7a976d72702a4efbb551bf65e40df12 (patch) | |
tree | b752ab06bbefdbddddf43f5724b9a97a28a6af2e | |
parent | 75bc0e156a08f45a746e0cd04115a4ff04f1f53c (diff) | |
download | gcc-23391b1ec7a976d72702a4efbb551bf65e40df12.tar.gz |
* cpphash.c (collect_funlike_expansion): Make "# is not
followed by a macro argument name" a pedwarn, not an error.
Preserve the # in the output. Suppress the warning if lang_asm.
* gcc.dg/dg.exp: Scan .S files as well as .c files.
* gcc.dg/20000510-1.S: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33841 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cpphash.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/20000510-1.S | 20 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dg.exp | 3 |
5 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5889f0a467a..fdf67d018aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-05-11 Zack Weinberg <zack@wolery.cumb.org> + + * cpphash.c (collect_funlike_expansion): Make "# is not + followed by a macro argument name" a pedwarn, not an error. + Preserve the # in the output. Suppress the warning if lang_asm. + Thu May 11 01:19:31 2000 Jeffrey A Law (law@cygnus.com) * configure.in (hppa*64*-*-hpux11*): New target for PA64 support. diff --git a/gcc/cpphash.c b/gcc/cpphash.c index 81e9368dc31..1e61dafea1a 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -639,7 +639,22 @@ collect_funlike_expansion (pfile, list, arglist, replacement) default: norm: if (last_token == STRIZE) - cpp_error (pfile, "# is not followed by a macro argument name"); + { + /* This is a mandatory diagnostic (6.10.3.2 para 1), but + in assembly language # may have some other + significance we don't know about, so suppress the + warning. */ + if (! CPP_OPTION (pfile, lang_asm)) + cpp_pedwarn (pfile, + "# is not followed by a macro argument name"); + if (TOK_PREV_WHITE (list, i)) + CPP_ADJUST_WRITTEN (pfile, -1); + if (TOK_PREV_WHITE (list, i-1)) + CPP_PUTC (pfile, ' '); + CPP_PUTC (pfile, '#'); + if (TOK_PREV_WHITE (list, i)) + CPP_PUTC (pfile, ' '); + } CPP_PUTS (pfile, tok, len); last_token = NORM; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db283462b5d..9c57a8d2732 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2000-05-11 Zack Weinberg <zack@wolery.cumb.org> + + * gcc.dg/dg.exp: Scan .S files as well as .c files. + * gcc.dg/20000510-1.S: New. + 2000-05-08 Catherine Moore <clm@cygnus.com> * gcc.dg/unused-3.c: New. diff --git a/gcc/testsuite/gcc.dg/20000510-1.S b/gcc/testsuite/gcc.dg/20000510-1.S new file mode 100644 index 00000000000..7d6508b3af5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20000510-1.S @@ -0,0 +1,20 @@ +/* Regression test - in assembly language, # may have some significance + other than 'stringize macro argument' and therefore must be preserved + in the output, and should not be warned about. */ +/* { dg-do preprocess } */ + +#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */ + +entry: + foo() + +/* + { dg-final { if ![file exists 20000510-1.i] { return } } } + { dg-final { set tmp [grep 20000510-1.i # line] } } + { dg-final { if {[string length $tmp] > 0} \{ } } + { dg-final { pass "20000510-1.S: # preservation" } } + { dg-final { \} else \{ } } + { dg-final { fail "20000510-1.S: # preservation" } } + { dg-final { \} } } +*/ + diff --git a/gcc/testsuite/gcc.dg/dg.exp b/gcc/testsuite/gcc.dg/dg.exp index 6edb5dcae01..e4b4a1fbf53 100644 --- a/gcc/testsuite/gcc.dg/dg.exp +++ b/gcc/testsuite/gcc.dg/dg.exp @@ -63,7 +63,8 @@ if ![info exists DEFAULT_CFLAGS] then { dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" $DEFAULT_CFLAGS +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS # All done. dg-finish |