This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/79164] New: -Wduplicated-branches and macros
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Jan 2017 12:39:19 +0000
- Subject: [Bug c/79164] New: -Wduplicated-branches and macros
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79164
Bug ID: 79164
Summary: -Wduplicated-branches and macros
Product: gcc
Version: 7.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: ---
-Wduplicated-branches doesn't warn on
#include <stddef.h>
int *
f (int i)
{
if (i > 9)
return NULL;
else
return NULL;
}
because at least one expression from both arms comes from a macro. But in this
case we should apparently warn. We'll have to compare the expressions
side-by-side and decide if they're the same even from the macro expansion point
of view.