From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79312 invoked by alias); 29 Apr 2015 15:47:14 -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 79265 invoked by uid 89); 29 Apr 2015 15:47:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 29 Apr 2015 15:47:13 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3TFlAAo003424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 29 Apr 2015 11:47:11 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3TFl983003823; Wed, 29 Apr 2015 11:47:09 -0400 Message-ID: <5540FCFC.1060908@redhat.com> Date: Wed, 29 Apr 2015 15:49:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Jan Kratochvil , gdb-patches@sourceware.org CC: Phil Muldoon Subject: Re: [PATCH v3 5/9] compile: Use -Wall, not -w References: <20150411194322.29128.52477.stgit@host1.jankratochvil.net> <20150411194403.29128.80053.stgit@host1.jankratochvil.net> In-Reply-To: <20150411194403.29128.80053.stgit@host1.jankratochvil.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg01075.txt.bz2 On 04/11/2015 08:44 PM, Jan Kratochvil wrote: > Hi, > > for a reason unknown to me GDB was using -w instead of -Wall for 'compile code'. > The problem is later patch for 'compile printf' really needs some warnings to > be able to catch for example missing format string parameters: > (gdb) compile printf "%d\n" > GCC does not seem to be able to cancel -w (there is nothing like -no-w). > > Besides that I think even 'compile code' can benefit from -Wall. > > That #ifndef hack in print_one_macro() is not nice but while GCC does not warn > for redefinitions like > #define MACRO val > #define MACRO val > together with the GCC build-in macros I haven't found any other way how to > prevent the macro-redefinition warnings (when -w is no longer in effect). I think GCC also knows how to suppress such warnings if the redefinitions are in system includes. So I guess GCC already has the smarts to suppress those. '#pragma GCC system_header' might be close, though it may be ignored if not done on a header. Note we have #pragma GCC user_expression, which is a pragma handled by the GCC plugin: static void plugin_init_extra_pragmas (void *, void *) { c_register_pragma ("GCC", "user_expression", plugin_pragma_user_expression); } So if we need to, we can easily add another gdb-specific pragma that enables whatever mode in gcc we need, and wrap the macros with that. OTOH, if it's the inferior's version of the macro that is always wanted, then #ifndef should be fine. If it's gdb's version that is wanted though, then that could be handled by an #undef before the #define. But then again, I'm not exactly sure on what you mean by build-in macros here. Can you give an example? > > -gdb_test_no_output "compile code struct_object.selffield = &struct_object" > +set test "compile code struct_object.selffield = &struct_object" > +gdb_test_multiple $test $test { > + -re "gdb command line:1:25: warning: assignment discards 'volatile' qualifier from pointer target type \\\[-Wdiscarded-qualifiers\\\]\r\n$gdb_prompt $" { > + xfail "$test (PR compile/18202)" > + } > +} Please leave a PASS path in place. I think this would work: gdb_test_multiple $test $test { -re "^$test\r\n$gdb_prompt $ $" { pass "$test" } -re "gdb command line:1:25: warning: assignment discards 'volatile' qualifier from pointer target type \\\[-Wdiscarded-qualifiers\\\]\r\n$gdb_prompt $" { xfail "$test (PR compile/18202)" } } Other than resolving/clarifying the #ifdef issue, this looks good to me. Thanks, Pedro Alves