From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20313 invoked by alias); 21 Jul 2018 18:47:35 -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 19777 invoked by uid 89); 21 Jul 2018 18:47:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=him X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.119) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 21 Jul 2018 18:47:28 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 07B02F723 for ; Sat, 21 Jul 2018 13:47:26 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id gwucfT6HXkBj6gwucfo9ww; Sat, 21 Jul 2018 13:47:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/XbPuFBz9FZ/nAFzsR7aZ1GVSWSHkRLv33PFUv7B4Q4=; b=N/AjjzoQih66YcXPEGxvx+DRyF 2DU3avyv0c3T1YGvqlScPnp0UYXVPlYZL37pgrnojb05P5axIBUTm3gJ8Hk+tOfIeHOHJhAnXs/10 IaudwxOCYa+PKD1NUaOmEcjj9; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:44394 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fgwub-002Auc-Qj; Sat, 21 Jul 2018 13:47:25 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 13/13] Add -Wunused-variable to warnings.m4 Date: Sat, 21 Jul 2018 18:47:00 -0000 Message-Id: <20180721184720.3263-14-tom@tromey.com> In-Reply-To: <20180721184720.3263-1-tom@tromey.com> References: <20180721184720.3263-1-tom@tromey.com> X-SW-Source: 2018-07/txt/msg00642.txt.bz2 This adds -Wunused-variable to the build. This required a special check in configure in order to work around a bug in GCC 4.9. Simon ound the correct test to use, so I've added him to the ChangeLog. gdb/ChangeLog 2018-07-21 Simon Marchi Tom Tromey * warning.m4 (AM_GDB_WARNINGS): Add -Wunused-variable and special test for it. * configure: Rebuild. gdb/gdbserver/ChangeLog 2018-07-21 Tom Tromey * configure: Rebuild. --- gdb/ChangeLog | 7 +++++++ gdb/configure | 28 ++++++++++++++++++++++++++-- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/configure | 28 ++++++++++++++++++++++++++-- gdb/warning.m4 | 17 +++++++++++++++-- 5 files changed, 78 insertions(+), 6 deletions(-) diff --git a/gdb/configure b/gdb/configure index 3f0a22073d0..3ee88e4eb39 100755 --- a/gdb/configure +++ b/gdb/configure @@ -15439,7 +15439,7 @@ fi # The options we'll try to enable. build_warnings="-Wall -Wpointer-arith \ --Wno-unused -Wunused-value -Wunused-function \ +-Wno-unused -Wunused-value -Wunused-variable -Wunused-function \ -Wno-switch -Wno-char-subscripts \ -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \ @@ -15528,7 +15528,30 @@ $as_echo_n "checking compiler warning flags... " >&6; } CFLAGS="$CFLAGS -Werror $wtest" saved_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -Werror $wtest" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "x$w" = "x-Wunused-variable"; then + # Check for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38958, + # fixed in GCC 4.9. This test is derived from the gdb + # source code that triggered this bug in GCC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +struct scoped_restore_base {}; + struct scoped_restore_tmpl : public scoped_restore_base { + ~scoped_restore_tmpl() {} + }; +int +main () +{ +const scoped_restore_base &b = scoped_restore_tmpl(); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + WARN_CFLAGS="${WARN_CFLAGS} $w" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -15543,6 +15566,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then : WARN_CFLAGS="${WARN_CFLAGS} $w" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS" esac diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 6064a1eb10f..043bc216e43 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -7237,7 +7237,7 @@ fi # The options we'll try to enable. build_warnings="-Wall -Wpointer-arith \ --Wno-unused -Wunused-value -Wunused-function \ +-Wno-unused -Wunused-value -Wunused-variable -Wunused-function \ -Wno-switch -Wno-char-subscripts \ -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \ @@ -7326,7 +7326,30 @@ $as_echo_n "checking compiler warning flags... " >&6; } CFLAGS="$CFLAGS -Werror $wtest" saved_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -Werror $wtest" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "x$w" = "x-Wunused-variable"; then + # Check for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38958, + # fixed in GCC 4.9. This test is derived from the gdb + # source code that triggered this bug in GCC. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +struct scoped_restore_base {}; + struct scoped_restore_tmpl : public scoped_restore_base { + ~scoped_restore_tmpl() {} + }; +int +main () +{ +const scoped_restore_base &b = scoped_restore_tmpl(); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + WARN_CFLAGS="${WARN_CFLAGS} $w" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -7341,6 +7364,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then : WARN_CFLAGS="${WARN_CFLAGS} $w" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS" esac diff --git a/gdb/warning.m4 b/gdb/warning.m4 index 632cc214ac0..00e7cd60508 100644 --- a/gdb/warning.m4 +++ b/gdb/warning.m4 @@ -37,7 +37,7 @@ fi # The options we'll try to enable. build_warnings="-Wall -Wpointer-arith \ --Wno-unused -Wunused-value -Wunused-function \ +-Wno-unused -Wunused-value -Wunused-variable -Wunused-function \ -Wno-switch -Wno-char-subscripts \ -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \ @@ -118,7 +118,20 @@ then CFLAGS="$CFLAGS -Werror $wtest" saved_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -Werror $wtest" - AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) + if test "x$w" = "x-Wunused-variable"; then + # Check for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38958, + # fixed in GCC 4.9. This test is derived from the gdb + # source code that triggered this bug in GCC. + AC_TRY_COMPILE( + [struct scoped_restore_base {}; + struct scoped_restore_tmpl : public scoped_restore_base { + ~scoped_restore_tmpl() {} + };], + [const scoped_restore_base &b = scoped_restore_tmpl();], + WARN_CFLAGS="${WARN_CFLAGS} $w",) + else + AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) + fi CFLAGS="$saved_CFLAGS" CXXFLAGS="$saved_CXXFLAGS" esac -- 2.13.6