From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82782 invoked by alias); 3 May 2015 14:05:55 -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 82773 invoked by uid 89); 3 May 2015 14:05:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 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; Sun, 03 May 2015 14:05:52 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t43E5pfx007669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sun, 3 May 2015 10:05:51 -0400 Received: from host1.jankratochvil.net (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t43E5lce016005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 3 May 2015 10:05:49 -0400 Date: Sun, 03 May 2015 14:05:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Phil Muldoon Subject: Re: [PATCH v3 5/9] compile: Use -Wall, not -w Message-ID: <20150503140546.GA18394@host1.jankratochvil.net> References: <20150411194322.29128.52477.stgit@host1.jankratochvil.net> <20150411194403.29128.80053.stgit@host1.jankratochvil.net> <5540FCFC.1060908@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5540FCFC.1060908@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00022.txt.bz2 On Wed, 29 Apr 2015 17:47:08 +0200, Pedro Alves wrote: > On 04/11/2015 08:44 PM, Jan Kratochvil wrote: > 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. Another problem is that (currently) it would not be possible to turn it off in the same file. Therefore the user expression without not get any warnings which would nullify the goal of this patch. > 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. Only some GCC's internal macros are affected and I guess it is better to leave them alone, therefore #ifndef is better (contrary to forced re-#define). > But then again, I'm not exactly sure on what you mean by build-in > macros here. Can you give an example? Without that #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 /tmp/gdbobj-xpU1yB/out4.c:6:0: warning: "__STDC_IEC_559_COMPLEX__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:46:0: note: this is the location of the previous definition^M /tmp/gdbobj-xpU1yB/out4.c:7:0: warning: "__STDC_IEC_559__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:38:0: note: this is the location of the previous definition^M /tmp/gdbobj-xpU1yB/out4.c:8:0: warning: "__STDC_ISO_10646__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:54:0: note: this is the location of the previous definition^M /tmp/gdbobj-xpU1yB/out4.c:9:0: warning: "__STDC_NO_THREADS__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:57:0: note: this is the location of the previous definition^M (gdb) FAIL: gdb.compile/compile.exp: Test delimiter with -r Without that #ifndef/#endif and with -Wno-builtin-macro-redefined one expectedly gets mostly the same: compile -r -- void _gdb_expr(){int i = 5;}^M /tmp/gdbobj-sJlZmG/out4.c:5:0: warning: "__LINE__" redefined^M /tmp/gdbobj-sJlZmG/out4.c:6:0: warning: "__STDC_IEC_559_COMPLEX__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:46:0: note: this is the location of the previous definition^M /tmp/gdbobj-sJlZmG/out4.c:7:0: warning: "__STDC_IEC_559__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:38:0: note: this is the location of the previous definition^M /tmp/gdbobj-sJlZmG/out4.c:8:0: warning: "__STDC_ISO_10646__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:54:0: note: this is the location of the previous definition^M /tmp/gdbobj-sJlZmG/out4.c:9:0: warning: "__STDC_NO_THREADS__" redefined^M In file included from :0:0:^M /usr/include/stdc-predef.h:57:0: note: this is the location of the previous definition^M (gdb) FAIL: gdb.compile/compile.exp: Test delimiter with -r Using #undef before the #define one gets: compile -r -- void _gdb_expr(){int i = 5;}^M /tmp/gdbobj-vCA0XG/out4.c:7:0: warning: undefining "__FILE__" [-Wbuiltin-macro-redefined]^M /tmp/gdbobj-vCA0XG/out4.c:9:8: warning: undefining "__LINE__"^M /tmp/gdbobj-vCA0XG/out4.c:11:8: warning: undefining "__STDC_IEC_559_COMPLEX__"^M /tmp/gdbobj-vCA0XG/out4.c:13:8: warning: undefining "__STDC_IEC_559__"^M /tmp/gdbobj-vCA0XG/out4.c:15:8: warning: undefining "__STDC_ISO_10646__"^M /tmp/gdbobj-vCA0XG/out4.c:17:8: warning: undefining "__STDC_NO_THREADS__"^M (gdb) FAIL: gdb.compile/compile.exp: Test delimiter with -r In the end the #ifndef+#define is not such a problem I think. > Please leave a PASS path in place. I think this would work: Yes, almost: > > gdb_test_multiple $test $test { > -re "^$test\r\n$gdb_prompt $ $" { -re "^$test\r\n$gdb_prompt $" { > pass "$test" > } Thanks, Jan