cppmacro.c (paste_tokens): Only allow / to paste with =.
authorNeil Booth <neil@daikokuya.co.uk>
Wed, 9 Oct 2002 09:56:09 +0000 (09:56 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Wed, 9 Oct 2002 09:56:09 +0000 (09:56 +0000)
* cppmacro.c (paste_tokens): Only allow / to paste with =.
testsuite:
* gcc.dg/cpp/paste13.c: New test.

From-SVN: r57978

gcc/ChangeLog
gcc/cppmacro.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/paste13.c [new file with mode: 0644]

index 87408b9d28a63701b8f8fc34a60861477a718037..6653ea4a41d4da5c2ba8a3efc8c16c81059fdafb 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-09  Neil Booth  <neil@daikokuya.co.uk>
+
+       * cppmacro.c (paste_tokens): Only allow / to paste with =.
+
 2002-10-09  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000.md (movdf splitter): Use gen_int_mode on
index 113b20dac24da3c6eb262ce4348ac4f8cf2bcb8f..fe78993bc4d6ac7de2645eff200cf147d1277427 100644 (file)
@@ -442,8 +442,7 @@ paste_tokens (pfile, plhs, rhs)
      It is simpler to insert a space here, rather than modifying the
      lexer to ignore comments in some circumstances.  Simply returning
      false doesn't work, since we want to clear the PASTE_LEFT flag.  */
-  if (lhs->type == CPP_DIV
-      && (rhs->type == CPP_MULT || rhs->type == CPP_DIV))
+  if (lhs->type == CPP_DIV && rhs->type != CPP_EQ)
     *end++ = ' ';
   end = cpp_spell_token (pfile, rhs, end);
   *end = '\0';
index 9b3a86e86d598f524afc17a1c7cedeb18d50f0e3..f51687f7a50af16e6eb8a73978cde3742249db2b 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-09  Neil Booth  <neil@daikokuya.co.uk>
+
+       * gcc.dg/cpp/paste13.c: New test.
+
 2002-10-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.c-torture/execute/20020720-1.x: Take out sparc XFAILs.  For
diff --git a/gcc/testsuite/gcc.dg/cpp/paste13.c b/gcc/testsuite/gcc.dg/cpp/paste13.c
new file mode 100644 (file)
index 0000000..e59c209
--- /dev/null
@@ -0,0 +1,9 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+
+/* This used to be recognized as a comment when lexing after pasting
+   spellings.  Neil Booth, 9 Oct 2002.  */
+
+#define a /##/=
+a                      /* { dg-warning "valid preprocessing tok" } */