This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cpplib: asm unknown directive fix


I think this fixes the bug where an unknown directive in asm was
processed and then gave EOF <g>.  It bit Andreas and Geoff.

If it bootstraps and passes the preprocessor tests, I'll commit it.

In the near future I'm adding a bunch of testcases, and I'll add
something for this.

Neil.

	* cpplex.c (lex_line): Drop the EOF token for unknown
	directives in assembler.

Index: cpplex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplex.c,v
retrieving revision 1.98
diff -u -p -r1.98 cpplex.c
--- cpplex.c	2000/09/18 18:43:04	1.98
+++ cpplex.c	2000/09/19 19:50:24
@@ -1669,11 +1669,6 @@ lex_line (pfile, list)
   first->flags |= BOL;
   pfile->first_directive_token = first;
 
-  /* Drop the EOF unless really at EOF or in a directive.  */
-  if (!(cur_token == first || pfile->state.in_directive
-	|| !pfile->done_initializing))
-    list->tokens_used--;
-
   /* Don't complain about the null directive, nor directives in
      assembly source: we don't know where the comments are, and # may
      introduce assembler pseudo-ops.  Don't complain about invalid
@@ -1696,6 +1691,11 @@ lex_line (pfile, list)
       _cpp_clear_toklist (list);
       goto retry;
     }
+
+  /* Drop the EOF unless really at EOF or in a directive.  */
+  if (cur_token != first && !KNOWN_DIRECTIVE (list)
+      && pfile->done_initializing)
+    list->tokens_used--;
 
   pfile->state.in_lex_line = 0;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]