[PATCH] Fix maybe-used-uninitialised warning.

Dave Korn dave.korn.cygwin@googlemail.com
Sat Jan 9 19:28:00 GMT 2010

Christopher Faylor wrote:
> On Sat, Jan 09, 2010 at 11:31:03AM +0000, Dave Korn wrote:

>> winsup/cygwin/ChangeLog:
>> 	* hookapi.cc (hook_or_detect_cygwin): Initialise i earlier to avoid
>> 	warning.
>>  OK?
> I'd prefer i be initialized to zero.

  I don't understand why, please explain?  It looks to me like i should only
ever be -1 before the first call to makename.  Is it conceivable that the code
could make it past the loop without ever setting i from 0 to -1?  Well, we may
not want to support it, but what if a win32/cygload exe tried to use the
CW_HOOK functionality?  So I thought it would be best to initialise i with the
value that it will need to have if it ever gets used.

>> winsup/cygwin/ChangeLog:
>> 	* fhandler_tty.cc (process_input): Add redundant final return to
>> 	silence (bogus?) warning.
> These are ok.  As usual, I hate that we have to make these pointless
> accommodations.  But I've been hating that for many years so it's
> nothing newo.

  Let's hold on this one; upstream have confirmed it's a bug(*), so it might
be fixed before we need it anyway.


(*) - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42674

More information about the Cygwin-patches mailing list