[clang] [llvm] [NFC] Fix implicit-fallthrough warnings (PR #112825)
Jinsong Ji via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 20:32:10 PDT 2024
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/112825
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11.
Fix warnings:
clang/lib/Sema/SemaFunctionEffects.cpp:1531:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
1531 | switch (DiffKind) {
| ^~~~~~
>From f8290c6b07de74dfb4aa2c169678e345333b2b46 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong.ji at intel.com>
Date: Fri, 18 Oct 2024 05:30:27 +0200
Subject: [PATCH] [NFC] Fix implicit-fallthrough warnings
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11.
Fix warnings:
clang/lib/Sema/SemaFunctionEffects.cpp:1531:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
1531 | switch (DiffKind) {
| ^~~~~~
---
clang/lib/Sema/SemaFunctionEffects.cpp | 4 +++-
llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaFunctionEffects.cpp b/clang/lib/Sema/SemaFunctionEffects.cpp
index 70e5d78661a835..3fa326db06ee41 100644
--- a/clang/lib/Sema/SemaFunctionEffects.cpp
+++ b/clang/lib/Sema/SemaFunctionEffects.cpp
@@ -1540,6 +1540,7 @@ bool Sema::FunctionEffectDiff::shouldDiagnoseConversion(
// matching is better.
return true;
}
+ break;
case FunctionEffect::Kind::Blocking:
case FunctionEffect::Kind::Allocating:
return false;
@@ -1563,6 +1564,7 @@ bool Sema::FunctionEffectDiff::shouldDiagnoseRedeclaration(
// All these forms of mismatches are diagnosed.
return true;
}
+ break;
case FunctionEffect::Kind::Blocking:
case FunctionEffect::Kind::Allocating:
return false;
@@ -1592,7 +1594,7 @@ Sema::FunctionEffectDiff::shouldDiagnoseMethodOverride(
case Kind::ConditionMismatch:
return OverrideResult::Warn;
}
-
+ break;
case FunctionEffect::Kind::Blocking:
case FunctionEffect::Kind::Allocating:
return OverrideResult::NoAction;
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
index 7f942de74bdcc9..93c2d92ef7c1c8 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
@@ -1028,6 +1028,7 @@ static unsigned int getFenceOp(NVPTX::Ordering O, NVPTX::Scope S,
formatv("Unsupported scope \"{}\" for acquire/release/acq_rel fence.",
ScopeToString(S)));
}
+ break;
}
case NVPTX::Ordering::SequentiallyConsistent: {
switch (S) {
@@ -1046,6 +1047,7 @@ static unsigned int getFenceOp(NVPTX::Ordering O, NVPTX::Scope S,
report_fatal_error(formatv("Unsupported scope \"{}\" for seq_cst fence.",
ScopeToString(S)));
}
+ break;
}
case NVPTX::Ordering::NotAtomic:
case NVPTX::Ordering::Relaxed:
More information about the cfe-commits
mailing list