]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR preprocessor/19077 (Internal compiler error compiling MPlayer)
authorEric Christopher <echristo@redhat.com>
Wed, 16 Feb 2005 23:07:47 +0000 (23:07 +0000)
committerEric Christopher <echristo@gcc.gnu.org>
Wed, 16 Feb 2005 23:07:47 +0000 (23:07 +0000)
2005-02-16  Eric Christopher  <echristo@redhat.com>

PR preprocessor/19077
* gcc.dg/cpp/20050215-1.c: New file.

2005-02-16  Eric Christopher  <echristo@redhat.com>

PR preprocessor/19077
* cppmacro.c (cpp_macro_definition): Move handling of whitespace
        to PREV_WHITE conditional. Remove overloading of len
        variable.

From-SVN: r95123

gcc/ChangeLog
gcc/cppmacro.c
gcc/testsuite/ChangeLog

index 1dc072dae45149b2d7a8ea1973fafe647ddd6f90..71f52ab73c2847fa7385702d6bf175d2e1c041c1 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-16  Eric Christopher  <echristo@redhat.com>
+
+       PR preprocessor/19077
+       * cppmacro.c (cpp_macro_definition): Move handling of whitespace
+        to PREV_WHITE conditional. Remove overloading of len
+        variable.
+
 2005-02-16  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR target/19715
index 11ac09f12e1dc8799e18ed57b6f8a2736c64b023..2298c854ec55e655c45de44e349f5186ea61bb78 100644 (file)
@@ -1626,6 +1626,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
        len += NODE_LEN (macro->params[i]) + 1; /* "," */
     }
 
+  /* This should match below where we fill in the buffer.  */
   if (CPP_OPTION (pfile, traditional))
     len += _cpp_replacement_text_len (macro);
   else
@@ -1637,11 +1638,14 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
          if (token->type == CPP_MACRO_ARG)
            len += NODE_LEN (macro->params[token->val.arg_no - 1]);
          else
-           len += cpp_token_len (token) + 1; /* Includes room for ' '.  */
+           len += cpp_token_len (token);
+
          if (token->flags & STRINGIFY_ARG)
            len++;                      /* "#" */
          if (token->flags & PASTE_LEFT)
            len += 3;           /* " ##" */
+         if (token->flags & PREV_WHITE)
+           len++;              /* " " */
        }
     }
 
@@ -1701,10 +1705,10 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
 
          if (token->type == CPP_MACRO_ARG)
            {
-             len = NODE_LEN (macro->params[token->val.arg_no - 1]);
              memcpy (buffer,
-                     NODE_NAME (macro->params[token->val.arg_no - 1]), len);
-             buffer += len;
+                     NODE_NAME (macro->params[token->val.arg_no - 1]),
+                     NODE_LEN (macro->params[token->val.arg_no - 1]));
+             buffer += NODE_LEN (macro->params[token->val.arg_no - 1]);
            }
          else
            buffer = cpp_spell_token (pfile, token, buffer);
index 46062a4ba2864a908d7d44185d82411e3297073f..d473fff1c42a7f3b1534baab995861bb4c2ecce5 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-16  Eric Christopher  <echristo@redhat.com>
+
+       PR preprocessor/19077
+       * gcc.dg/cpp/20050215-1.c: New file.
+
 2005-02-12  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/14479