OSDN Git Service

* parser.c (cp_lexer_new_main): Get the first token, first, before
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Jan 2005 22:05:07 +0000 (22:05 +0000)
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Jan 2005 22:05:07 +0000 (22:05 +0000)
        doing anything.
Radar 3929334

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

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/pch/pch.C [new file with mode: 0644]
gcc/testsuite/g++.dg/pch/pch.Hs [new file with mode: 0644]

index d0ccb13..1baaf0b 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-31  Mike Stump  <mrs@apple.com>
+
+       * parser.c (cp_lexer_new_main): Get the first token, first, before
+       doing anything.
+
 2005-01-31  Mark Mitchell  <mark@codesourcery.com>
 
        * decl.c (start_decl): Add missing parentheses.
 2005-01-31  Mark Mitchell  <mark@codesourcery.com>
 
        * decl.c (start_decl): Add missing parentheses.
index 1599d9c..ab2a103 100644 (file)
@@ -238,16 +238,19 @@ cp_lexer_new_main (void)
   size_t space;
   cp_token *buffer;
 
   size_t space;
   cp_token *buffer;
 
+  /* It's possible that lexing the first token will load a PCH file,
+     which is a GC collection point.  So we have to grab the first
+     token before allocating any memory.  Pragmas must not be deferred
+     as -fpch-preprocess can generate a pragma to load the PCH file in
+     the preprocessed output used by -save-temps.  */
+  cp_lexer_get_preprocessor_token (NULL, &first_token);
+
   /* Tell cpplib we want CPP_PRAGMA tokens.  */
   cpp_get_options (parse_in)->defer_pragmas = true;
 
   /* Tell c_lex not to merge string constants.  */
   c_lex_return_raw_strings = true;
 
   /* Tell cpplib we want CPP_PRAGMA tokens.  */
   cpp_get_options (parse_in)->defer_pragmas = true;
 
   /* Tell c_lex not to merge string constants.  */
   c_lex_return_raw_strings = true;
 
-  /* It's possible that lexing the first token will load a PCH file,
-     which is a GC collection point.  So we have to grab the first
-     token before allocating any memory.  */
-  cp_lexer_get_preprocessor_token (NULL, &first_token);
   c_common_no_more_pch ();
 
   /* Allocate the memory.  */
   c_common_no_more_pch ();
 
   /* Allocate the memory.  */
diff --git a/gcc/testsuite/g++.dg/pch/pch.C b/gcc/testsuite/g++.dg/pch/pch.C
new file mode 100644 (file)
index 0000000..4539396
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-options "-save-temps -fpch-preprocess -I." }
+
+#include "pch.H"
+int main() 
+{
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pch/pch.Hs b/gcc/testsuite/g++.dg/pch/pch.Hs
new file mode 100644 (file)
index 0000000..4bd8276
--- /dev/null
@@ -0,0 +1 @@
+// empty file