OSDN Git Service

* tradcpp.c (rescan): Do not recognize directives when the #
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jul 2000 20:37:26 +0000 (20:37 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Jul 2000 20:37:26 +0000 (20:37 +0000)
is indented.

* gcc.dg/cpp/tr-direct.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35139 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/tr-direct.c [new file with mode: 0644]
gcc/tradcpp.c

index 54c2514..fb8c21b 100644 (file)
@@ -1,5 +1,10 @@
 2000-07-19  Zack Weinberg  <zack@wolery.cumb.org>
 
+       * tradcpp.c (rescan): Do not recognize directives when the #
+       is indented.
+
+2000-07-19  Zack Weinberg  <zack@wolery.cumb.org>
+
        Implement C++ named operators.
 
        * cpplib.h (TTYPE_TABLE): Move CPP_MIN and CPP_MAX into block
index d6b01a6..c9d7cf3 100644 (file)
@@ -1,5 +1,7 @@
 2000-07-19  Zack Weinberg  <zack@wolery.cumb.org>
 
+       * gcc.dg/cpp/tr-direct.c: New test.
+
        * gcc.dg/cpp/directiv.c, gcc.dg/cpp/macsyntx.c,
        gcc.dg/cpp/undef1.c: Tweak error regexps.
 
diff --git a/gcc/testsuite/gcc.dg/cpp/tr-direct.c b/gcc/testsuite/gcc.dg/cpp/tr-direct.c
new file mode 100644 (file)
index 0000000..309ec49
--- /dev/null
@@ -0,0 +1,11 @@
+/* Test for some basic aspects of -traditional directive processing.  */
+
+/* { dg-do preprocess } */
+/* { dg-options -traditional } */
+
+/* There is no #error directive.  */
+
+#error bad     /* { dg-bogus "bad" } */
+
+/* Directives with their #s indented are not recognized.  */
+ #if 0 /* { dg-bogus "unterminated" } */
index 971dfef..d48510c 100644 (file)
@@ -1187,32 +1187,11 @@ do { ip = &instack[indepth];            \
       if (ident_length)
        goto specialchar;
 
-      /* # keyword: a # must be first nonblank char on the line */
+      /* # keyword: a # must be the first char on the line */
       if (beg_of_line == 0)
        goto randomchar;
-      {
-       U_CHAR *bp;
-
-       /* Scan from start of line, skipping whitespace, comments
-          and backslash-newlines, and see if we reach this #.
-          If not, this # is not special.  */
-       bp = beg_of_line;
-       while (1) {
-         if (is_hor_space[*bp])
-           bp++;
-         else if (*bp == '\\' && bp[1] == '\n')
-           bp += 2;
-         else if (*bp == '/' && (newline_fix (bp + 1), bp[1]) == '*') {
-           bp += 2;
-           while (!(*bp == '*' && (newline_fix (bp + 1), bp[1]) == '/'))
-             bp++;
-           bp += 1;
-         }
-         else break;
-       }
-       if (bp + 1 != ibp)
-         goto randomchar;
-      }
+      if (beg_of_line + 1 != ibp)
+       goto randomchar;
 
       /* This # can start a directive.  */