xbolva00 added a comment.
Thank you for the review
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70624/new/
https://reviews.llvm.org/D70624
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https
This revision was automatically updated to reflect the committed changes.
Closed by commit rGba4017670e19: [Diagnostics] Warn for comparison with string
literals expanded from macro… (authored by xbolva00).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.or
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70624/new/
https://reviews.llvm.org/D70624
xbolva00 updated this revision to Diff 230797.
xbolva00 added a comment.
Added new tests.
Improved recommendation how to fix warning.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70624/new/
https://reviews.llvm.org/D70624
Files:
clang/include/c
aaron.ballman added inline comments.
Comment at: clang/lib/Sema/SemaExpr.cpp:10368
- if (Expr::isSameComparisonOperand(LHS, RHS)) {
-unsigned Result;
-switch (Opc) {
-case BO_EQ: case BO_LE: case BO_GE:
- Result = AlwaysTrue;
- break;
-case BO_NE: cas
xbolva00 marked 2 inline comments as done.
xbolva00 added inline comments.
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8431
"result of comparison against %select{a string literal|@encode}0 is "
- "unspecified (use strncmp instead)">,
- InGroup;
+ "unspecifi
aaron.ballman added inline comments.
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8431
"result of comparison against %select{a string literal|@encode}0 is "
- "unspecified (use strncmp instead)">,
- InGroup;
+ "unspecified">, InGroup;
I th
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
Comment at: clang/test/Sema/warn-stringcompare.c:4-6
+#define DELIM "/"
+#define NULL (void *)0
+
Current behaviour: https://godbolt.org/z/7nYH6N
Repository:
rG LLVM Github Monorepo
C
xbolva00 created this revision.
xbolva00 added a reviewer: aaron.ballman.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
Comment at: clang/test/Sema/warn-stringcompare.c:4-6
+#defin