From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23932 invoked by alias); 15 May 2015 16:49:00 -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 23914 invoked by uid 89); 15 May 2015 16:49:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no 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; Fri, 15 May 2015 16:48:59 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4FGmvtA026946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 15 May 2015 12:48:57 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4FGmuUp014934; Fri, 15 May 2015 12:48:56 -0400 Message-ID: <55562377.7090501@redhat.com> Date: Fri, 15 May 2015 16: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 v5 4/7] compile: Use -Wall, not -w References: <20150513201615.4051.5261.stgit@host1.jankratochvil.net> <20150513201648.4051.13681.stgit@host1.jankratochvil.net> In-Reply-To: <20150513201648.4051.13681.stgit@host1.jankratochvil.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-05/txt/msg00395.txt.bz2 On 05/13/2015 09:16 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). It'd be good if the commit logs were updated reflecting previous discussions. For instance, I'd update this like: ~~~ (...) Besides that I think even 'compile code' can benefit from -Wall. That #ifndef change in print_one_macro() is needed otherwise we get macro-redefinition warnings for the GCC built-in macros (as -w is no longer in effect). For example, without the #ifndef/#endif one gets: compile -r -- void _gdb_expr(){int i = 5;}^M /tmp/gdbobj-xpU1yB/out4.c:4:0: warning: "__FILE__" redefined [-Wbuiltin-macro-redefined]^M /tmp/gdbobj-xpU1yB/out4.c:5:0: warning: "__LINE__" redefined^M ... It makes more sense to pick the inferior's version of the macros, hence #ifndef instead of #undef. (...) ~~~ OK. Thanks, Pedro Alves