https://bugs.llvm.org/show_bug.cgi?id=38571

            Bug ID: 38571
           Summary: -Wconstant-logical-operand and yoda conditions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: ndesaulni...@google.com
                CC: lloz...@chromium.org, llvm-bugs@lists.llvm.org,
                    srhi...@google.com

void foo(int x) {
    if (x && 5) {}
    if (5 && x) {}
}

The above produces -Wconstant-logical-operand for the first statement, but not
the second.

This was observed while compiling the Linux kernel, as a single translation
unit has a mix of which side the constant logical operand is on, but only some
of the conditionals producing warnings.  In these cases, the constant logical
operand is nested a few macros deep.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to