]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Disable -Werror for -Wmaybe-uninitialized
authorPedro Alves <palves@redhat.com>
Fri, 5 May 2017 00:03:28 +0000 (01:03 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 5 May 2017 00:03:28 +0000 (01:03 +0100)
Newer GCCs are triggering false-positive -Wmaybe-uninitialized
warnings around code that uses gdb::optional:
  https://sourceware.org/ml/gdb-patches/2017-05/msg00118.html

Using std::optional wouldn't help, it triggers the same warnings:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635

Initializing the variables to quiet the warning would defeat the
purpose of gdb::optional.  Making the optional ctor memset its storage
would be a pessimization.  Wrapping gdb::optional's internals with
"#pragma GCC diagnostic push/ignored/pop" doesn't work, we'd have to
wrap uses of gdb::optional instead, which I think would get unwieldy
and ugly as we start using gdb::optional more and more.

The -Wmaybe-uninitialized warning is documented as producing false
positives (unlike -Wuninialized), so until we find a better
workaround, disable -Werror for this warning.  You'll still see the
warning when building gdb, but it won't cause a build failure.

Tested by building with gcc 4.8.5, 5.3.1, and gcc trunk (20170428).

gdb/ChangeLog:
2017-05-05  Pedro Alves  <palves@redhat.com>

* warning.m4 (build_warnings): Add -Wno-error=maybe-uninitialized.
* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2017-05-05  Pedro Alves  <palves@redhat.com>

* configure: Regenerate.

gdb/ChangeLog
gdb/configure
gdb/gdbserver/ChangeLog
gdb/gdbserver/configure
gdb/warning.m4

index 6e3a51ec8405caa3835f3fb43a766460104bf6a4..475091d7805e1c4b147c0b6b73dd7f627ddc93d7 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-05  Pedro Alves  <palves@redhat.com>
+
+       * warning.m4 (build_warnings): Add -Wno-error=maybe-uninitialized.
+       * configure: Regenerate.
+
 2017-05-04  Pedro Alves  <palves@redhat.com>
 
        * Makefile.in (SFILES): Add progspace-and-thread.c.
index 25895b154db2d8fc659d111865ac0889b39ce380..1554667dcb69f8e8298546c4ce93d85f00b716db 100755 (executable)
@@ -15108,7 +15108,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts \
 -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
--Wno-sign-compare -Wno-narrowing"
+-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized"
 
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.
index 8f7848cadc0450793faba152d10cdbf93efbafa4..e09035ca2973502516238b5c45dcda00d4d690d2 100644 (file)
@@ -1,3 +1,7 @@
+2017-05-05  Pedro Alves  <palves@redhat.com>
+
+       * configure: Regenerate.
+
 2017-05-03  Sergio Durigan Junior  <sergiodj@redhat.com>
 
        * configure: Regenerate.
index d524ae41459220b2815725b4493b452ce54b8d4e..b314c417953b4be436f34db24702a3e9d9ef0511 100755 (executable)
@@ -7148,7 +7148,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts \
 -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
--Wno-sign-compare -Wno-narrowing"
+-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized"
 
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.
index 83f69ec229305c2efa52cabf7977a18fdb851239..98e745375eb234d2ceb1c5d280fdc67290ed6ff3 100644 (file)
@@ -40,7 +40,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wno-unused -Wunused-value -Wunused-function \
 -Wno-switch -Wno-char-subscripts \
 -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
--Wno-sign-compare -Wno-narrowing"
+-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized"
 
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.