cpp oddities. was: sparc-sun-solaris2.8 headers: fixinc, cpplib
Neil Booth
neil@daikokuya.demon.co.uk
Mon Dec 18 11:30:00 GMT 2000
Robert Lipe wrote:-
> typedef
> long
> daddr_t
> ;
Probably couldn't get this effect if I'd tried :-)
Here's a trivial patch and testcase, for which I didn't do a
bootstrap, since it can't really affect anything. I ran the CPP
regression tester before and after the patch, though.
Neil.
* cppmain.c: Update print.lineno with -P.
* gcc.dg/cpp/cmdlne-P.c: New testcase.
Index: cppmain.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmain.c,v
retrieving revision 1.48
diff -u -p -r1.48 cppmain.c
--- cppmain.c 2000/12/18 19:00:26 1.48
+++ cppmain.c 2000/12/18 19:27:46
@@ -284,7 +284,10 @@ maybe_print_line (line)
}
if (print.no_line_dirs)
- return;
+ {
+ print.lineno = line;
+ return;
+ }
/* print.lineno is zero if this is the first token of the file. We
handle this specially, so that a first line of "# 1 "foo.c" in
Index: testsuite/gcc.dg/cpp/cmdlne-P.c
===================================================================
RCS file: cmdlne-P.c
diff -N cmdlne-P.c
--- /dev/null Tue May 5 13:32:27 1998
+++ cmdlne-P.c Mon Dec 18 11:28:01 2000
@@ -0,0 +1,13 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-P" } */
+
+/* Test that we don't stair-step output with -P. Source: Neil Booth,
+ 18 Dec 2000. */
+
+int x = 1;
+
+/* { dg-final { if ![file exists cmdlne-P.i] { return } } }
+ { dg-final { if { [grep cmdlne-P.i "^int x = 1;$"] != "" } { return } } }
+ { dg-final { fail "cmdlne-P.c: stair-stepping with -P" } } */
More information about the Gcc-patches
mailing list