From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95912 invoked by alias); 5 May 2017 00:10:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 95899 invoked by uid 89); 5 May 2017 00:10:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 May 2017 00:10:04 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E90880C08; Fri, 5 May 2017 00:10:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9E90880C08 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9E90880C08 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id D29D0183AD; Fri, 5 May 2017 00:10:04 +0000 (UTC) Subject: [pushed] gdb: Disable -Werror for -Wmaybe-uninitialized (Re: Oh dear. I regret to inform you that commit 'RAII-fy make_cleanup_restore_current_thread & friends' might be unfortunate) To: Simon Marchi References: <34792dd0-088c-a1d1-9125-70c8585c21bd@redhat.com> <6bf88edee0fb17451d44b85bb00fb0d0@polymtl.ca> <79511435-a3a8-48f9-2e16-bca8adb1909d@redhat.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <518abb64-f227-4824-993b-50825c0b914e@redhat.com> Date: Fri, 05 May 2017 00:10:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <79511435-a3a8-48f9-2e16-bca8adb1909d@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-05/txt/msg00130.txt.bz2 On 05/04/2017 07:22 PM, Pedro Alves wrote: > Comment #2 makes me think that we should really disable > the warning, or at least make it "-Wno-error=maybe-uninitialized". > I've seen other similar comments around the interwebs when looking > for this warning + optional. OK, I think I've done all I reasonably could tonight, and I'm about to turn into a pumpkin. In the interest of unbreaking the build and buildbots, I went ahead and pushed the patch below. >From e13cb306f099a8cd450c9fba0dfa22521aaa3c95 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 5 May 2017 01:03:28 +0100 Subject: [PATCH] gdb: Disable -Werror for -Wmaybe-uninitialized 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 * warning.m4 (build_warnings): Add -Wno-error=maybe-uninitialized. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2017-05-05 Pedro Alves * configure: Regenerate. --- gdb/ChangeLog | 5 +++++ gdb/gdbserver/ChangeLog | 4 ++++ gdb/configure | 2 +- gdb/gdbserver/configure | 2 +- gdb/warning.m4 | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6e3a51e..475091d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-05-05 Pedro Alves + + * warning.m4 (build_warnings): Add -Wno-error=maybe-uninitialized. + * configure: Regenerate. + 2017-05-04 Pedro Alves * Makefile.in (SFILES): Add progspace-and-thread.c. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 8f7848c..e09035c 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2017-05-05 Pedro Alves + + * configure: Regenerate. + 2017-05-03 Sergio Durigan Junior * configure: Regenerate. diff --git a/gdb/configure b/gdb/configure index 25895b1..1554667 100755 --- a/gdb/configure +++ b/gdb/configure @@ -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. diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index d524ae4..b314c41 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -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. diff --git a/gdb/warning.m4 b/gdb/warning.m4 index 83f69ec..98e7453 100644 --- a/gdb/warning.m4 +++ b/gdb/warning.m4 @@ -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. -- 2.5.5