programs/winecfg/libraries.c warnings regressions

Marcus Meissner marcus at jet.franken.de
Sat Oct 16 15:38:34 CDT 2004


On Sat, Oct 16, 2004 at 12:31:49PM -0400, Vincent Béron wrote:
> Le sam 16/10/2004 à 09:11, Gerald Pfeifer a écrit :
> [snip]
> > 
> >    libraries.c:261: warning: `mode' might be used uninitialized in this function
> >    libraries.c:264: warning: `str' might be used uninitialized in this function
> > 
> > (which are the only ones of this kind for a full Wine build).
> 
> Depends on which gcc version you use, because here (3.2) I don't have
> them.
> 
> The mode warning is somewhat safe (there's an assert if it's not set).
> 
> The str warning is in the same boat (there's also an assert if it's not
> set).
> 
> It could be argued that it'd be good practice to initialize them
> regardless.

There is an assert() blocking the default switch() case. However, the assert
goes away completely with -DNDEBUG, so following patch should be applied.

Ciao, Marcus

Changelog:
	return out of the default case, assert() is removed with -DNDEBUG.

Index: programs/winecfg/libraries.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/libraries.c,v
retrieving revision 1.3
diff -u -r1.3 libraries.c
--- programs/winecfg/libraries.c	28 Sep 2004 03:55:16 -0000	1.3
+++ programs/winecfg/libraries.c	16 Oct 2004 20:36:45 -0000
@@ -274,6 +274,7 @@
         CONVERT( DISABLE );
 
         default: assert( FALSE ); /* should not be reached  */
+		 return;
     }
 
 #undef CONVERT
@@ -291,6 +292,7 @@
         case NATIVE_BUILTIN: str = "native, builtin"; break;
         case DISABLE: str = ""; break;
         default: assert( FALSE ); /* unreachable  */
+		 return;
     }
     WINE_TRACE("Setting %s to %s\n", dll->name, str);
     



More information about the wine-devel mailing list