OSDN Git Service

(rescan): Preserve newlines after macro names at the top level since
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Oct 1994 22:47:09 +0000 (22:47 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Oct 1994 22:47:09 +0000 (22:47 +0000)
this is more likely to do the right thing with line numbers.

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

gcc/cccp.c

index b434300..7f3613d 100644 (file)
@@ -3276,9 +3276,17 @@ startagain:
              
              /* This is now known to be a macro call.
                 Discard the macro name from the output,
-                along with any following whitespace just copied.  */
+                along with any following whitespace just copied,
+                but preserve newlines at the top level since this
+                is more likely to do the right thing with line numbers.  */
              obp = op->buf + obufp_before_macroname;
-             op->lineno = op_lineno_before_macroname;
+             if (ip->macro != 0)
+               op->lineno = op_lineno_before_macroname;
+             else {
+               int newlines = op->lineno - op_lineno_before_macroname;
+               while (0 < newlines--)
+                 *obp++ = '\n';
+             }
 
              /* Prevent accidental token-pasting with a character
                 before the macro call.  */