This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix maybe-used-uninitialised warning.


    Hi,

  Here are two small fixes shown up by more sensitive warnings in gcc-4.5.0.
In hookapi.cc, it notices that the loop might not run even once; in
fhandler_tty, it appears to miss that the loops can never exit.  That probably
needs fixing upstream (but it may be some odd artifact of C++ language rules,
since it only happens there, not in plain C; something to do with exceptional
exits, maybe), but until then it seemed harmless to add a trivial return zero;
it'll only add a handful of bytes to the dll.  (I tested attribute noreturn
and it didn't help.)

winsup/cygwin/ChangeLog:

	* hookapi.cc (hook_or_detect_cygwin): Initialise i earlier to avoid
	warning.

  OK?

winsup/cygwin/ChangeLog:

	* fhandler_tty.cc (process_input): Add redundant final return to
	silence (bogus?) warning.

  OK, or wait to see what upstream says about it?

    cheers,
      DaveK
Index: winsup/cygwin/hookapi.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/hookapi.cc,v
retrieving revision 1.19
diff -p -u -r1.19 hookapi.cc
--- winsup/cygwin/hookapi.cc	11 Sep 2008 04:34:23 -0000	1.19
+++ winsup/cygwin/hookapi.cc	9 Jan 2010 08:24:29 -0000
@@ -252,7 +252,7 @@ hook_or_detect_cygwin (const char *name,
   fh.origfn = NULL;
   fh.hookfn = fn;
   char *buf = (char *) alloca (strlen (name) + sizeof ("_64"));
-  int i;
+  int i = -1;
   // Iterate through each import descriptor, and redirect if appropriate
   for (PIMAGE_IMPORT_DESCRIPTOR pd = pdfirst; pd->FirstThunk; pd++)
     {
Index: winsup/cygwin/fhandler_tty.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_tty.cc,v
retrieving revision 1.190
diff -p -u -r1.190 fhandler_tty.cc
--- winsup/cygwin/fhandler_tty.cc	24 Jul 2009 20:54:33 -0000	1.190
+++ winsup/cygwin/fhandler_tty.cc	9 Jan 2010 08:25:06 -0000
@@ -225,6 +225,7 @@ process_input (void *)
 	  == line_edit_signalled)
 	tty_master->console->eat_readahead (-1);
     }
+  return 0;
 }
 
 bool
@@ -438,6 +439,7 @@ process_ioctl (void *)
 				  : (void *) &ttyp->arg);
       SetEvent (tty_master->ioctl_done_event);
     }
+  return 0;
 }
 
 /**********************************************************************/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]