Patch for %P spec expansion: number of underscores: Review missin g
Unruh, Erwin
Erwin.Unruh@fujitsu-siemens.com
Tue Apr 9 00:53:00 GMT 2002
Hello,
some time ago I submitted a patch to correct the handling of trailing
underscores in %P spec expansion. It did not get into 3.1.
Please have a look at it. It was submitted as
http://gcc.gnu.org/ml/gcc-patches/2001-11/msg01371.html
Here is a complete re-post:
The code handling the %P spec is faulty. When handling a define with an
underscore in one of the last two characters, it does not append the right
number of underscores.
My patch corrects this behaviour.
It is difficult to write a testcase without modifying the specs.
Erwin
* gcc.c (do_spec_1): correct number of underscores in %P expansion
Index: gcc.c
===================================================================
RCS file: /usr/local/cvscpp/archive/gcc/gcc/gcc.c,v
retrieving revision 1.4
diff -u -c -3 -p -r1.4 gcc.c
*** gcc.c 2001/10/26 13:35:48 1.4
--- gcc.c 2001/11/20 08:34:57
*************** do_spec_1 (spec, inswitch, soft_matched_
*** 4629,4638 ****
if (flag)
{
! if (x[-1] != '_')
{
if (x[-2] != '_')
*x++ = '_';
*x++ = '_';
}
}
--- 4629,4642 ----
if (flag)
{
! if (x[-1] == '_')
{
if (x[-2] != '_')
*x++ = '_';
+ }
+ else
+ {
+ *x++ = '_';
*x++ = '_';
}
}
Erwin Unruh, Fujitsu Siemens Computers, C/C++ compiler group
More information about the Gcc-patches
mailing list