public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67819] -Wduplicated-cond should take macros into account
2015-10-02 15:50 [Bug c/67819] New: -Wduplicated-cond should take macros into account mpolacek at gcc dot gnu.org
@ 2015-10-02 15:50 ` mpolacek at gcc dot gnu.org
2015-10-02 20:49 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-02 15:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67819
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-10-02
Target Milestone|--- |6.0
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/67819] New: -Wduplicated-cond should take macros into account
@ 2015-10-02 15:50 mpolacek at gcc dot gnu.org
2015-10-02 15:50 ` [Bug c/67819] " mpolacek at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-02 15:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67819
Bug ID: 67819
Summary: -Wduplicated-cond should take macros into account
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
I.e. don't warn for:
#define FOO 4
#define BAR 4
int
fn (int n)
{
if (n <= FOO)
return 1;
else if (n <= BAR)
return 2;
return 0;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/67819] -Wduplicated-cond should take macros into account
2015-10-02 15:50 [Bug c/67819] New: -Wduplicated-cond should take macros into account mpolacek at gcc dot gnu.org
2015-10-02 15:50 ` [Bug c/67819] " mpolacek at gcc dot gnu.org
@ 2015-10-02 20:49 ` ppalka at gcc dot gnu.org
2015-10-02 21:15 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-10-02 20:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67819
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Sorry if this has been discussed before, but can't you use
linemap_location_from_macro_expansion_p to check whether the conditional
contains a macro expansion, and to inhibit the warning if so?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/67819] -Wduplicated-cond should take macros into account
2015-10-02 15:50 [Bug c/67819] New: -Wduplicated-cond should take macros into account mpolacek at gcc dot gnu.org
2015-10-02 15:50 ` [Bug c/67819] " mpolacek at gcc dot gnu.org
2015-10-02 20:49 ` ppalka at gcc dot gnu.org
@ 2015-10-02 21:15 ` ppalka at gcc dot gnu.org
2015-10-05 9:03 ` mpolacek at gcc dot gnu.org
2024-01-15 4:17 ` egallager at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-10-02 21:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67819
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #1)
> Sorry if this has been discussed before, but can't you use
> linemap_location_from_macro_expansion_p to check whether the conditional
> contains a macro expansion, and to inhibit the warning if so?
Answered my own question: no, because e.g. integer constants expanded from
macros don't have locations, from this thread:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01599.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/67819] -Wduplicated-cond should take macros into account
2015-10-02 15:50 [Bug c/67819] New: -Wduplicated-cond should take macros into account mpolacek at gcc dot gnu.org
` (2 preceding siblings ...)
2015-10-02 21:15 ` ppalka at gcc dot gnu.org
@ 2015-10-05 9:03 ` mpolacek at gcc dot gnu.org
2024-01-15 4:17 ` egallager at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-05 9:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67819
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yeah, exactly; this problem will require some significant effort, I'm afraid
>:(.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/67819] -Wduplicated-cond should take macros into account
2015-10-02 15:50 [Bug c/67819] New: -Wduplicated-cond should take macros into account mpolacek at gcc dot gnu.org
` (3 preceding siblings ...)
2015-10-05 9:03 ` mpolacek at gcc dot gnu.org
@ 2024-01-15 4:17 ` egallager at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2024-01-15 4:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67819
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
This blocks the enablement of -Wduplicated-cond with -Wall/-Wextra; see bug
87656
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-15 4:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 15:50 [Bug c/67819] New: -Wduplicated-cond should take macros into account mpolacek at gcc dot gnu.org
2015-10-02 15:50 ` [Bug c/67819] " mpolacek at gcc dot gnu.org
2015-10-02 20:49 ` ppalka at gcc dot gnu.org
2015-10-02 21:15 ` ppalka at gcc dot gnu.org
2015-10-05 9:03 ` mpolacek at gcc dot gnu.org
2024-01-15 4:17 ` egallager at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).