* parser.c (cp_parser_declaration_seq_opt): Handle pending_lang_change.
authorMark Mitchell <mark@codesourcery.com>
Mon, 30 Dec 2002 20:18:38 +0000 (20:18 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 30 Dec 2002 20:18:38 +0000 (20:18 +0000)
From-SVN: r60644

gcc/cp/ChangeLog
gcc/cp/parser.c

index 050ba952a5140a613992284a53325ef7f564f0b6..db212ba8f5c5410f677e1d4e5e16cebe282b8e57 100644 (file)
@@ -1,3 +1,7 @@
+2002-12-30  Mark Mitchell  <mark@codesourcery.com>
+
+       * parser.c (cp_parser_declaration_seq_opt): Handle pending_lang_change.
+
 2002-12-30  David Edelsohn  <edelsohn@gnu.org>
 
        * parser.c (cp_parser_parameter_declaration_clause): Treat system
index 94742504145d90b0eee75ab7efc57f290a46dd1a..cb8dbe97b160bf23bba8bee5972d62fd115a120a 100644 (file)
@@ -6456,6 +6456,20 @@ cp_parser_declaration_seq_opt (parser)
          continue;
        }
 
+      /* The C lexer modifies PENDING_LANG_CHANGE when it wants the
+        parser to enter or exit implict `extern "C"' blocks.  */
+      while (pending_lang_change > 0)
+       {
+         push_lang_context (lang_name_c);
+         --pending_lang_change;
+       }
+      while (pending_lang_change < 0)
+       {
+         pop_lang_context ();
+         ++pending_lang_change;
+       }
+
+      /* Parse the declaration itself.  */
       cp_parser_declaration (parser);
     }
 }