Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: warn on a < b < c #20456

Closed
morinmorin opened this issue Jun 19, 2014 · 0 comments · Fixed by #92200
Closed

Feature request: warn on a < b < c #20456

morinmorin opened this issue Jun 19, 2014 · 0 comments · Fixed by #92200
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@morinmorin
Copy link

Bugzilla Link 20082
Version trunk
OS All

Extended Description

For C primers, it would be useful to warn on a < b < c:

int main(int argc, char* argv[])
{
    int a = 2;
    int b = 3;
    int c = 4;
    if (a < b < c) {
        /* ... */
    }
}

I think it makes sense to warn on these codes
as the compiler emits warnings on codes like if (a = b).

P.S. gcc emits warnings on such codes.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
@JOE1994 JOE1994 self-assigned this May 13, 2024
JOE1994 added a commit to JOE1994/llvm-project that referenced this issue May 15, 2024
Made the following decisions for consistency with `gcc 14.1`:
* Add warning under -Wparentheses
* Set the warning to DefaultIgnore, although -Wparentheses is enabled by default
  * This warning is only issued when -Wparentheses is explicitly enabled
    (via -Wparentheses or -Wall)

Closes llvm#20456
JOE1994 added a commit that referenced this issue May 17, 2024
…92200)

Add warning under `-Wparentheses` for consistency with `gcc 14.1`.

Closes #20456

---------

Co-authored-by: Aaron Ballman <[email protected]>
@EugeneZelenko EugeneZelenko added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer and removed clang:frontend Language frontend issues, e.g. anything involving "Sema" labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants