[clang] [NFC][analyzer] Silence gcc -Wempty-body when compiling unittest (PR #241759)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 01:52:32 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: DonĂ¡t Nagy (NagyDonat)
<details>
<summary>Changes</summary>
When I was building and running the static analyzer tests; gcc always emitted a `-Wempty-body` warning for this test file. Let's silence it to reduce noise during the build.
---
Full diff: https://github.com/llvm/llvm-project/pull/241759.diff
1 Files Affected:
- (modified) clang/unittests/StaticAnalyzer/UnsignedStatDemo.cpp (+5-4)
``````````diff
diff --git a/clang/unittests/StaticAnalyzer/UnsignedStatDemo.cpp b/clang/unittests/StaticAnalyzer/UnsignedStatDemo.cpp
index 64f75c09ba942b..580b5f7ebfde97 100644
--- a/clang/unittests/StaticAnalyzer/UnsignedStatDemo.cpp
+++ b/clang/unittests/StaticAnalyzer/UnsignedStatDemo.cpp
@@ -39,12 +39,13 @@ class UnsignedStatTesterChecker : public Checker<check::BeginFunction> {
// Conditionally set the statistic based on the function name (leaving it
// undefined for all other functions)
- if (Name == "func_one")
+ if (Name == "func_one") {
DemoStat.set(1);
- else if (Name == "func_two")
+ } else if (Name == "func_two") {
DemoStat.set(2);
- else
- ; // For any other function (e.g., "func_none") don't set the statistic
+ } else {
+ // For any other function (e.g., "func_none") don't set the statistic
+ }
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/241759
More information about the cfe-commits
mailing list