Re: Re: [Chromium-dev] Chromium 1.9 second release candidate

Michael Barnes <[email protected]>
Newsgroups gmane.comp.graphics.chromium.user,gmane.comp.graphics.chromium.devel
Message-ID <[email protected]>
All,

I may have a better patch attached.  If -Werror is needed for building
cromium, then it might be better just to shut up gcc's bogus warning
about something that "may be used unitialized".  The flag that shuts
this up is -Wno-uninitialized.

From gcc's manpage:

      These warnings are made optional because GNU CC is not smart
      enough to see all the reasons why the code might be correct
      despite appearing to have an error.

Uninitialized variables are bugs.  Warnings about them maybe being
uninitilized being turned into errors, when they are not unitialized,
is a waste of our time.

Please consider the attached patch.

The patch is against 1.8, but it should apply cleanly to 1.9.

Mike


On Wed, May 24, 2006 at 01:19:29PM -0700, Eric Sandall wrote:
> And again when the above is fixed:
> Rebuilding dependencies for state_program.c
> Compiling state_program.c
> cc1: warnings being treated as errors
> state_program.c: In function ‘crStateGetVertexAttribdvARB’:
> state_program.c:1113: warning: ‘floatParams[0]’ is used
> uninitialized in this function
> state_program.c:1111: warning: ‘floatParams[1]’ may be used
> uninitialized in this function
> state_program.c:1111: warning: ‘floatParams[2]’ may be used
> uninitialized in this function
> state_program.c:1111: warning: ‘floatParams[3]’ may be used
> uninitialized in this function
> gmake[2]: *** [../built/crstate/Linux/state_program.o] Error 1
> gmake[1]: *** [dep] Error 2
> make: *** [state_tracker.subdir] Error 2
> --- state_tracker/state_program.c	2006-05-24 13:17:36.000000000 -0700
> +++ /tmp/state_program.c	2006-05-24 13:16:42.000000000 -0700
> @@ -1094,7 +1094,8 @@
>  
>  void STATE_APIENTRY crStateGetVertexAttribivARB(GLuint index, GLenum pname, GLint *params)
>  {
> -	 GLfloat floatParams[4];
> +	 /* init vars to prevent compiler warnings/errors */
> +	 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 };
>  	 crStateGetVertexAttribfvARB(index, pname, floatParams);
>  	 params[0] = (GLint) floatParams[0];
>  	 if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {
> @@ -1107,7 +1108,8 @@
>  
>  void STATE_APIENTRY crStateGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params)
>  {
> -	 GLfloat floatParams[4];
> +	 /* init vars to prevent compiler warnings/errors */
> +	 GLfloat floatParams[4] = { 0.0, 0.0, 0.0, 0.0 };
>  	 crStateGetVertexAttribfvARB(index, pname, floatParams);
>  	 params[0] = floatParams[0];
>  	 if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) {


-- 
/-----------------------------------------\
| Michael Barnes <[email protected]> |
| UNIX/Linux HPC Systems Administrator    |
| College of William and Mary             |
| Phone: (757) 879-3930 (cell)            |
\-----------------------------------------/
cr.diff (text/plain, 3.2 KB)
Only in cr-1.8.uninitfix/: bin
Only in cr-1.8.uninitfix/: built
diff -u --recursive cr-1.8/config/FreeBSD.mk cr-1.8.uninitfix/config/FreeBSD.mk
--- cr-1.8/config/FreeBSD.mk	Thu Mar 24 11:29:13 2005
+++ cr-1.8.uninitfix/config/FreeBSD.mk	Wed May 24 17:04:17 2006
@@ -7,12 +7,12 @@
 CXX = g++
 CC = gcc
 
-CXXFLAGS          += -DFREEBSD -Wall -Werror -I/usr/X11R6/include \
+CXXFLAGS          += -DFREEBSD -Wall -Werror -Wno-uninitialized -I/usr/X11R6/include \
                      -fno-strict-aliasing -fPIC
 CXX_RELEASE_FLAGS += -O3 -DNDEBUG
 CXX_DEBUG_FLAGS   += -g
 
-CFLAGS            += -DFREEBSD -Wall -Werror -I/usr/X11R6/include \
+CFLAGS            += -DFREEBSD -Wall -Werror -Wno-uninitialized -I/usr/X11R6/include \
                      -fno-strict-aliasing -fPIC
 C_RELEASE_FLAGS   += -O3 -DNDEBUG
 C_DEBUG_FLAGS     += -g
diff -u --recursive cr-1.8/config/Linux.mk cr-1.8.uninitfix/config/Linux.mk
--- cr-1.8/config/Linux.mk	Thu Mar 24 11:29:13 2005
+++ cr-1.8.uninitfix/config/Linux.mk	Wed May 24 17:04:40 2006
@@ -12,11 +12,11 @@
 # P4/Xeon systems:
 #-O3 -DNDEBUG -fno-strict-aliasing -fomit-frame-pointer -fexpensive-optimizations -falign-functions=4 -funroll-loops -malign-double -fprefetch-loop-arrays -march=pentium4 -mcpu=pentium4 -msse2 -mfpmath=sse 
 
-CXXFLAGS          += -DLINUX -Wall -Werror
+CXXFLAGS          += -DLINUX -Wall -Werror -Wno-uninitialized
 CXX_RELEASE_FLAGS += -O3 -DNDEBUG -fno-strict-aliasing
 CXX_DEBUG_FLAGS   += -g
 
-CFLAGS            += -DLINUX -Wall -Werror -Wmissing-prototypes -Wsign-compare
+CFLAGS            += -fPIC -DLINUX -Wall -Werror -Wno-uninitialized -Wmissing-prototypes -Wsign-compare
 C_RELEASE_FLAGS   += -O3 -DNDEBUG -fno-strict-aliasing
 C_DEBUG_FLAGS     += -g
 
diff -u --recursive cr-1.8/config/OSF1.mk cr-1.8.uninitfix/config/OSF1.mk
--- cr-1.8/config/OSF1.mk	Thu Mar 24 11:29:13 2005
+++ cr-1.8.uninitfix/config/OSF1.mk	Wed May 24 17:04:53 2006
@@ -4,11 +4,11 @@
 CXX = cxx
 CC = cc
 
-CXXFLAGS          += -DOSF1 -I/usr/local/include -Wall -Werror -pthread
+CXXFLAGS          += -DOSF1 -I/usr/local/include -Wall -Werror -Wno-uninitialized -pthread
 CXX_RELEASE_FLAGS += -O3 -DNDEBUG
 CXX_DEBUG_FLAGS   += -g
 
-CFLAGS            += -DOSF1 -I/usr/local/include -Wall -Werror -pthread
+CFLAGS            += -DOSF1 -I/usr/local/include -Wall -Werror -Wno-uninitialized -pthread
 C_RELEASE_FLAGS   += -O3 -DNDEBUG
 C_DEBUG_FLAGS     += -g
 
diff -u --recursive cr-1.8/config/SunOS.mk cr-1.8.uninitfix/config/SunOS.mk
--- cr-1.8/config/SunOS.mk	Thu Mar 24 11:29:13 2005
+++ cr-1.8.uninitfix/config/SunOS.mk	Wed May 24 17:05:08 2006
@@ -23,11 +23,11 @@
 #
 OTHER_FLAGS = -DSOLARIS_9_X_BUG
 
-CXXFLAGS          += -DSunOS -DSUN_OGL_NO_VERTEX_MACROS -Wall -Werror -fPIC $(OTHER_INCLUDES) $(OTHER_FLAGS)  
+CXXFLAGS          += -DSunOS -DSUN_OGL_NO_VERTEX_MACROS -Wall -Werror -Wno-uninitialized -fPIC $(OTHER_INCLUDES) $(OTHER_FLAGS)  
 CXX_RELEASE_FLAGS += -O3 -DNDEBUG
 CXX_DEBUG_FLAGS   += -g
 
-CFLAGS            += -DSunOS -DSUN_OGL_NO_VERTEX_MACROS -Wall -Werror -fPIC $(OTHER_INCLUDES) $(OTHER_FLAGS) 
+CFLAGS            += -DSunOS -DSUN_OGL_NO_VERTEX_MACROS -Wall -Werror -Wno-uninitialized -fPIC $(OTHER_INCLUDES) $(OTHER_FLAGS) 
 C_RELEASE_FLAGS   += -O3 -DNDEBUG
 C_DEBUG_FLAGS     += -g
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.