This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/61534] New: Wlogical-op should not warn when either operand comes from macro expansion


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61534

            Bug ID: 61534
           Summary: Wlogical-op should not warn when either operand comes
                    from macro expansion
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org

#define DEFINED (x != 0)

int foo(int x)
{
  if (!DEFINED && x != 0) return 0;
  return 1;
}

manuel@gcc10:~$ ~/test1/210581/build/gcc/cc1 -Wlogical-op test.c
 foo
test.c: In function âfooâ:
test.c:5:16: warning: logical âandâ of mutually exclusive tests is always false
[-Wlogical-op]
   if (!DEFINED && x != 0) return 0;
                ^

Clang does not warn. This was the reason -Wlogical-op was moved out of -Wextra
(PR40172).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]