Avoid warnings due to the use of -Wuninitialized without -O.
authorJim Blandy <jimb@codesourcery.com>
Fri, 11 Mar 2005 21:02:02 +0000 (21:02 +0000)
committerJim Blandy <jimb@codesourcery.com>
Fri, 11 Mar 2005 21:02:02 +0000 (21:02 +0000)
* configure.ac (build_warnings): Include -Wuninitialized only if
CFLAGS is unset at configure time, or CFLAGS is set and includes
some -O option other than -O0.
* configure: Regenerated.

gdb/ChangeLog
gdb/configure
gdb/configure.ac

index 3d2dc2ff6bbc340d31a6f591ce3ea28ace63f7a7..a414ab091d13d0558fb63fc710efda8ee85906e1 100644 (file)
@@ -1,5 +1,11 @@
 2005-03-11  Jim Blandy  <jimb@redhat.com>
 
+       Avoid warnings due to the use of -Wuninitialized without -O.
+       * configure.ac (build_warnings): Include -Wuninitialized only if
+       CFLAGS is unset at configure time, or CFLAGS is set and includes
+       some -O option other than -O0.
+       * configure: Regenerated.
+
        * mips-tdep.c (show_mips_abi): Change calling conventions to match
        those expected by add_setshow_enum_cmd.  Use 'file' argument as
        appropriate.
index d77ab938cbb5b763f21e9d7bdc290bcd7971e6a8..d6a9e03450e1e58aef441f0611cf3e020d8716b4 100755 (executable)
@@ -19655,8 +19655,21 @@ fi;
 # NOTE: If you add to this list, remember to update
 # gdb/doc/gdbint.texinfo.
 build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
--Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Wformat-nonliteral \
+-Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral \
 -Wunused-label -Wunused-function"
+
+# GCC supports -Wuninitialized only with -O or -On, n != 0.
+if test x${CFLAGS+set} == xset; then
+  case "${CFLAGS}" in
+    *"-O0"* ) ;;
+    *"-O"* )
+      build_warnings="${build_warnings} -Wuninitialized"
+    ;;
+  esac
+else
+  build_warnings="${build_warnings} -Wuninitialized"
+fi
+
 # Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
 # -Wunused-function -Wunused-variable -Wunused-value
 # -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
index 113159e412b2478524270cd59e57ea1a27e49ee4..de30e6a88d9d4786c21f088d1101811bc0c0a400 100644 (file)
@@ -1088,8 +1088,21 @@ AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
 # NOTE: If you add to this list, remember to update
 # gdb/doc/gdbint.texinfo.
 build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
--Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Wformat-nonliteral \
+-Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral \
 -Wunused-label -Wunused-function"
+
+# GCC supports -Wuninitialized only with -O or -On, n != 0.
+if test x${CFLAGS+set} == xset; then
+  case "${CFLAGS}" in
+    *"-O0"* ) ;;
+    *"-O"* )
+      build_warnings="${build_warnings} -Wuninitialized"
+    ;;
+  esac
+else
+  build_warnings="${build_warnings} -Wuninitialized"
+fi
+
 # Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
 # -Wunused-function -Wunused-variable -Wunused-value
 # -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual