bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoid gcc 4.6.2 'may be used before set' warnings in dfa.c


From: Aharon Robbins
Subject: Re: avoid gcc 4.6.2 'may be used before set' warnings in dfa.c
Date: Fri, 17 Feb 2012 14:23:51 +0200
User-agent: Heirloom mailx 12.4 7/29/08

Hi Paul.

> Date: Wed, 15 Feb 2012 15:57:09 -0800
> From: Paul Eggert <address@hidden>
> To: Aharon Robbins <address@hidden>
> CC: address@hidden
> Subject: Re: avoid gcc 4.6.2 'may be used before set' warnings in dfa.c
>
> On 02/15/2012 10:54 AM, Aharon Robbins wrote:
> > -  int c, c1, c2;
> > +  int c = 0, c1 = 0, c2 = 0;
>
> Sorry, I don't see why this patch (and the other) is needed.
> grep's copy of src/dfa.h says this:
>
> extern void dfaerror (const char *) __attribute__ ((noreturn));

This would seem to be the difference. I don't have the __attribute__
in my copy of dfa.h.  I don't remember the details, just that it caused
some compilation problems on non-GCC compilers, so I removed it.

> and all paths to the first use of c or wc lead
> through either an initialization of them, or a call
> to dfaerror.
>
> Also, all def-use paths for c1, c2, wc1, and wc2
> seem sound, at least in grep's copy of dfa.c, so why
> do they need to be initialized?

The initializations don't hurt anything, either, and it's good practice
to initialize one's variables.

So, this falls into the nice-to-have category, but if y'all decide
not to apply it I won't make a fuss, either.

Thanks,

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]