OSDN Git Service

Fri Oct 16 17:26:10 1998 Dave Brolley <brolley@cygnus.com>
authorbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Oct 1998 14:28:40 +0000 (14:28 +0000)
committerbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Oct 1998 14:28:40 +0000 (14:28 +0000)
        * cpplib.c (cpp_get_token): Replace whitespace that occurs between
        a macro name and the next token with a single blank if that whitespace
        is in a macro buffer and the next token is not '('.

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

gcc/ChangeLog
gcc/cpplib.c

index 5b0f83b..52eff08 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct 16 17:26:10 1998  Dave Brolley  <brolley@cygnus.com>
+
+       * cpplib.c (cpp_get_token): Replace whitespace that occurs between
+       a macro name and the next token with a single blank if that whitespace
+       is in a macro buffer and the next token is not '('.
+
 Fri Oct 16 15:44:02 1998  Dave Brolley  <brolley@cygnus.com>
 
         * cccp.c (rescan): Handle multibyte chartacters ending in backslash.
index b56790e..016b160 100644 (file)
@@ -5099,29 +5099,43 @@ cpp_get_token (pfile)
            if (hp->type == T_MACRO && hp->value.defn->nargs >= 0)
            {
              struct parse_marker macro_mark;
-             int is_macro_call;
-             while (CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
-               {
-                 cpp_buffer *next_buf;
-                 cpp_skip_hspace (pfile);
-                 if (PEEKC () != EOF)
-                   break;
-                 next_buf = CPP_PREV_BUFFER (CPP_BUFFER (pfile));
-                 (*CPP_BUFFER (pfile)->cleanup) (CPP_BUFFER (pfile), pfile);
-                 CPP_BUFFER (pfile) = next_buf;
-               }
+             int is_macro_call, macbuf_whitespace = 0;
+
              parse_set_mark (&macro_mark, pfile);
              for (;;)
                {
                  cpp_skip_hspace (pfile);
                  c = PEEKC ();
                  is_macro_call = c == '(';
-                 if (c != '\n')
-                   break;
-                 FORWARD (1);
+                 if (c != EOF)
+                   {
+                     if (c != '\n')
+                       break;
+                     FORWARD (1);
+                   }
+                  else
+                    {
+                      if (CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
+                        {
+                          if (macro_mark.position !=
+                              (CPP_BUFFER (pfile)->cur
+                               - CPP_BUFFER (pfile)->buf))
+                             macbuf_whitespace = 1;
+
+                          parse_clear_mark (&macro_mark);
+                          cpp_pop_buffer (pfile);
+                          parse_set_mark (&macro_mark, pfile);
+                        }
+                      else
+                        break;
+                    }
                }
              if (!is_macro_call)
-               parse_goto_mark (&macro_mark, pfile);
+                {
+                  parse_goto_mark (&macro_mark, pfile);
+                  if (macbuf_whitespace)
+                    CPP_PUTC (pfile, ' ');
+                }
              parse_clear_mark (&macro_mark);
              if (!is_macro_call)
                return CPP_NAME;