This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fixincludes: replacement for machine_name fix
- To: Bruce Korb <autogen at linuxbox dot com>
- Subject: Re: fixincludes: replacement for machine_name fix
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Wed, 19 Jan 2000 21:38:59 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- References: <20000119140749.A6323@wolery.cumb.org> <3886419C.6EF205B0@sco.com>
On Wed, Jan 19, 2000 at 02:58:36PM -0800, Bruce Korb wrote:
> Zack Weinberg wrote:
> >
> > #if defined linux || defined __linux__
> >
> > then it will not be modified. (Yes, that's a real-world example.)
> > This cuts in half the number of headers modified on my system.
>
> Cool! Faster, too, I bet.
Not a whole lot, but yes. It takes (+/-) 4m15s with the patch, 4m30s
without.
I did some poking at performance. Compiling with optimization on
makes no measurable difference. Neither does NO_BOGOSITY. Diking
gnu-regex.o out of the build (which causes us to fall back to libc)
cuts the time to *nine seconds*. Copying glibc's regex.c over to
gnu-regex.c cuts the time to 27 seconds. I am confused. glibc's
regex.c is a newer version of our regex.c; the differences are small,
but I guess they're significant.
> > Bruce: this patch removes the only use of exesel, and therefore will
> > allow us to throw that away.
>
> Good. I never liked it anyway. Do it under separate cover
> after this has been installed and tested.
Will do.
...
> > + Helper routine and data for the machine_name test and fix.
> > + machname.h is created by black magic in the Makefile. */
> > +
> > +#include "machname.h"
> > +
> > +tSCC mn_label_pat[] = "^[ \t]*#[ \t]*if(def)?[ \t]+";
>
> tSCC mn_label_pat[] = "^[ \t]*#[ \t]*(if|ifndef|ifdef)[ \t]+";
Doh! Thanks for pointing that out.
>
> You can combine the three 'if's, but I think
>
> tSCC mn_label_pat[] = "^[ \t]*#[ \t]*if(ndef|def)?[ \t]+";
>
> is less readable and maybe even harder to process,
Agree.
...
> > + return sizeof mn_name_pat;
>
> You know, of course, that this is the wrong value.
> If there is only one name in the MN_NAME_PAT, it is
> even guaranteed to be too small. Pick a random number
> like 64 and blow up if "__some-sort-of-long-name__"
> exceeds that size. Do it back in fixfixes and don't
> return a value here.
By a handy coincidence, '\<foo\>' is exactly the same length as
'__foo__'. It is, however, not very nice. I'll make it as you suggest.
> < + because comments on #if/#ifdef lines are rare, and strings on
> < + such lines are illegal.
> ----
> > + because comments on #if/#ifdef/#ifndef lines are rare,
> > + and strings on such lines are illegal.
Right.
Revised patch in a few minutes.
zw