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: Fix assembler preprocessing bug


This has bootstrapped on i586 Linux.  It fixes a rare bug where we
don't preprocess assembler files properly.

Test case included.

Neil.

	* cpplib.c (_cpp_handle_directive): Use buffer->was_skipping,
	not pfile->skipping (== 0).
	* gcc.dg/cpp/assembl2.S: New test case.

Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.c,v
retrieving revision 1.236
diff -u -p -r1.236 cpplib.c
--- cpplib.c	2001/01/13 18:39:26	1.236
+++ cpplib.c	2001/01/18 06:29:39
@@ -349,7 +349,7 @@ _cpp_handle_directive (pfile, indented)
 	    }
 	}
     }
-  else if (dname.type != CPP_EOF && ! pfile->skipping)
+  else if (dname.type != CPP_EOF && ! buffer->was_skipping)
     {
       /* An unknown directive.  Don't complain about it in assembly
 	 source: we don't know where the comments are, and # may
Index: testsuite/gcc.dg/cpp/assembl2.S
===================================================================
RCS file: assembl2.S
diff -N assembl2.S
--- /dev/null	Tue May  5 13:32:27 1998
+++ assembl2.S	Wed Jan 17 22:29:39 2001
@@ -0,0 +1,19 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+
+/* Source: Bug report of Jonathan Larmour.  Tweaked for test suite by
+   Neil Booth, 17 Jan 2000.  */
+
+/* We would not test the buffer->was_skipping variable when skipping,
+   meaning that some false directives confused CPP.  */
+
+#if 0
+        # foo
+        # fee
+        # fie
+        # foe
+        # fum
+#elif 0
+        # bundy
+#endif

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