OSDN Git Service

PR preprocessor/7526
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2002 20:17:55 +0000 (20:17 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2002 20:17:55 +0000 (20:17 +0000)
* cpplib.c (run_directive): Kludge so _Pragma dependency works.
testsuite:
* gcc.dg/cpp/_Pragma3.c: New test.

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

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

index afd4ac2..a411d93 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-14  Neil Booth  <neil@daikokuya.co.uk>
+
+       PR preprocessor/7526
+       * cpplib.c (run_directive): Kludge so _Pragma dependency works.
+
 2002-08-14  Nathan Sidwell  <nathan@codesourcery.com>
 
        * doc/invoke.texi (-a): Remove documentation.
index 935a0e0..0e9c4a1 100644 (file)
@@ -459,6 +459,9 @@ run_directive (pfile, dir_no, buf, count)
 {
   cpp_push_buffer (pfile, (const uchar *) buf, count,
                   /* from_stage3 */ true, 1);
+  /* Disgusting hack.  */
+  if (dir_no == T_PRAGMA)
+    pfile->buffer->inc = pfile->buffer->prev->inc;
   start_directive (pfile);
   /* We don't want a leading # to be interpreted as a directive.  */
   pfile->buffer->saved_flags = 0;
@@ -467,6 +470,8 @@ run_directive (pfile, dir_no, buf, count)
     prepare_directive_trad (pfile);
   (void) (*pfile->directive->handler) (pfile);
   end_directive (pfile, 1);
+  if (dir_no == T_PRAGMA)
+    pfile->buffer->inc = NULL;
   _cpp_pop_buffer (pfile);
 }
 
index a6d3d69..e9fd927 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-14  Neil Booth  <neil@daikokuya.co.uk>
+
+       * gcc.dg/cpp/_Pragma3.c: New test.
+
 2002-08-13  Mark Mitchell  <mark@codesourcery.com>
 
        * g++.dg/template/inherit3: New test.
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma3.c b/gcc/testsuite/gcc.dg/cpp/_Pragma3.c
new file mode 100644 (file)
index 0000000..7d1b42a
--- /dev/null
@@ -0,0 +1,11 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+
+/* Pragma buffers have a NULL "inc" member, which we would dereference
+   when getting a file's date and time.
+
+   Based on PR 7526.  14 Aug 2002.  */
+
+#define GCC_PRAGMA(x) _Pragma (#x)
+GCC_PRAGMA(GCC dependency "mi1c.h")