From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org, Phil Muldoon <pmuldoon@redhat.com>
Subject: Re: [PATCH v3 5/9] compile: Use -Wall, not -w
Date: Sun, 03 May 2015 14:05:00 -0000 [thread overview]
Message-ID: <20150503140546.GA18394@host1.jankratochvil.net> (raw)
In-Reply-To: <5540FCFC.1060908@redhat.com>
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 <command-line>: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 <command-line>: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 <command-line>: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 <command-line>: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 <command-line>: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 <command-line>: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 <command-line>: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 <command-line>: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
next prev parent reply other threads:[~2015-05-03 14:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-11 19:43 [PATCH v3 0/9] compile: compile print&printf Jan Kratochvil
2015-04-11 19:43 ` [PATCH v3 1/9] Code cleanup: Make parts of print_command_1 public Jan Kratochvil
2015-04-29 15:44 ` Pedro Alves
2015-04-30 0:24 ` Jan Kratochvil
2015-04-11 19:43 ` [PATCH v3 3/9] Code cleanup: compile: Constify some parameters Jan Kratochvil
2015-04-29 15:47 ` Pedro Alves
2015-05-06 18:58 ` [commit] " Jan Kratochvil
2015-04-11 19:43 ` [PATCH v3 2/9] compile: Distribute scope, add scope_data Jan Kratochvil
2015-04-29 15:44 ` Pedro Alves
2015-04-11 19:44 ` [PATCH v3 6/9] Code cleanup: compile: func_addr -> func_sym Jan Kratochvil
2015-04-29 15:52 ` Pedro Alves
2015-04-11 19:44 ` [PATCH v3 4/9] compile: Support relocation to GNU-IFUNCs Jan Kratochvil
2015-04-29 15:48 ` Pedro Alves
2015-05-06 19:00 ` [commit] " Jan Kratochvil
2015-04-11 19:44 ` [PATCH v3 7/9] compile: New 'compile print' Jan Kratochvil
2015-04-29 15:53 ` Pedro Alves
2015-05-03 14:06 ` Jan Kratochvil
2015-05-06 10:22 ` Pedro Alves
2015-05-06 12:23 ` Jan Kratochvil
2015-05-06 14:11 ` Pedro Alves
2015-05-06 19:18 ` Jan Kratochvil
2015-05-15 16:35 ` Pedro Alves
2015-04-11 19:44 ` [PATCH v3 5/9] compile: Use -Wall, not -w Jan Kratochvil
2015-04-29 15:49 ` Pedro Alves
2015-05-03 14:05 ` Jan Kratochvil [this message]
2015-05-06 10:21 ` Pedro Alves
2015-04-11 19:44 ` [PATCH v3 8/9] compile: New compile printf Jan Kratochvil
2015-04-29 15:54 ` Pedro Alves
2015-05-03 14:06 ` Jan Kratochvil
2015-05-06 10:22 ` Pedro Alves
2015-05-06 11:30 ` Jan Kratochvil
2015-05-06 11:47 ` Pedro Alves
2015-04-11 19:44 ` [PATCH v3 9/9] compile: compile printf: gdbserver support Jan Kratochvil
2015-04-26 9:33 ` Jan Kratochvil
2015-04-29 18:19 ` Pedro Alves
2015-05-03 14:06 ` Jan Kratochvil
2015-05-06 10:22 ` Pedro Alves
2015-04-29 16:12 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150503140546.GA18394@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=pmuldoon@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox