@@ -36,7 +36,7 @@ namespace InExpr {
// These are valid expressions.
foo(0);
+foo(0); // expected-warning {{comparisons like 'X<=Y<=Z' don't have
their mathematical meaning}}
foo(false);
shafik wrote:
It is a shame we don't catch this one
@@ -85,7 +85,7 @@ void f(int x, int y, int z) {
if ((ayyhttps://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -85,7 +85,7 @@ void f(int x, int y, int z) {
if ((ayy`
or something). So something like: `comparison 'a>yhttps://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/JOE1994 closed
https://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/JOE1994 updated
https://github.com/llvm/llvm-project/pull/92200
>From 2c7f9a083c129df70a79d019286b6a29643a8973 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim
Date: Tue, 14 May 2024 17:42:59 -0500
Subject: [PATCH 1/5] [clang][Sema] Warn consecutive builtin comparisons in an
@@ -487,6 +487,9 @@ Improvements to Clang's diagnostics
}
};
+- Clang emits a ``-Wparentheses`` warning for expressions with consecutive
comparisons like ``x < y < z``.
+ It was made a ``-Wparentheses`` warning to be consistent with gcc.
https://github.com/AaronBallman approved this pull request.
LGTM aside from a small nit with the release notes.
https://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -215,3 +215,10 @@ namespace PR20735 {
// fix-it:"{{.*}}":{[[@LINE-9]]:20-[[@LINE-9]]:20}:")"
}
}
+
+void consecutive_builtin_compare(int x, int y, int z) {
+ (void)(x < y < z); // expected-warning {{comparisons like 'X<=Y<=Z' don't
have their mathematical meaning}}
https://github.com/JOE1994 edited
https://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -215,3 +215,10 @@ namespace PR20735 {
// fix-it:"{{.*}}":{[[@LINE-9]]:20-[[@LINE-9]]:20}:")"
}
}
+
+void consecutive_builtin_compare(int x, int y, int z) {
+ (void)(x < y < z); // expected-warning {{comparisons like 'X<=Y<=Z' don't
have their mathematical meaning}}
https://github.com/JOE1994 updated
https://github.com/llvm/llvm-project/pull/92200
>From 2c7f9a083c129df70a79d019286b6a29643a8973 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim
Date: Tue, 14 May 2024 17:42:59 -0500
Subject: [PATCH 1/4] [clang][Sema] Warn consecutive builtin comparisons in an
https://github.com/JOE1994 edited
https://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/JOE1994 edited
https://github.com/llvm/llvm-project/pull/92200
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/JOE1994 updated
https://github.com/llvm/llvm-project/pull/92200
>From 2c7f9a083c129df70a79d019286b6a29643a8973 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim
Date: Tue, 14 May 2024 17:42:59 -0500
Subject: [PATCH 1/3] [clang][Sema] Warn consecutive builtin comparisons in an
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff c5cd049566a795ba5de88dfbb2eb563cad4a9d8a
b3cc457efc40a345d4b67c776edd470e35f73de2 --
https://github.com/JOE1994 updated
https://github.com/llvm/llvm-project/pull/92200
>From 2c7f9a083c129df70a79d019286b6a29643a8973 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim
Date: Tue, 14 May 2024 17:42:59 -0500
Subject: [PATCH 1/2] [clang][Sema] Warn consecutive builtin comparisons in an
@@ -215,3 +215,10 @@ namespace PR20735 {
// fix-it:"{{.*}}":{[[@LINE-9]]:20-[[@LINE-9]]:20}:")"
}
}
+
+void consecutive_builtin_compare(int x, int y, int z) {
+ (void)(x < y < z); // expected-warning {{comparisons like 'X<=Y<=Z' don't
have their mathematical meaning}}
@@ -14878,6 +14878,11 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation
OpLoc,
case BO_GT:
ConvertHalfVec = true;
ResultTy = CheckCompareOperands(LHS, RHS, OpLoc, Opc);
+
+if (const auto *BI = dyn_cast(LHSExpr))
+ if (BI->isComparisonOp())
+
JOE1994 wrote:
> Do we know why GCC elected to go that route? This seems like something that
> should be enabled by default because the false positive rate should be quite
> low.
It seems like `gcc` doesn't enable `-Wparentheses` by default, while `clang`
enables it by default.
I will add a
AaronBallman wrote:
> Set the warning to DefaultIgnore, although -Wparentheses is enabled by
> default
Do we know why GCC elected to go that route? This seems like something that
should be enabled by default because the false positive rate should be quite
low.
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Youngsuk Kim (JOE1994)
Changes
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
https://github.com/JOE1994 created
https://github.com/llvm/llvm-project/pull/92200
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
23 matches
Mail list logo