[lld] [lld][RISCV] Add break to nested switch in `mergeAtomic` (PR #99762)

Brandon Wu via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 20 07:19:05 PDT 2024


https://github.com/4vtomat created https://github.com/llvm/llvm-project/pull/99762

This prevent the warnings from compiler.


>From 337bd79011c60f6cecb04789e2c7a6c760175c4e Mon Sep 17 00:00:00 2001
From: Brandon Wu <brandon.wu at sifive.com>
Date: Sat, 20 Jul 2024 07:16:13 -0700
Subject: [PATCH] [lld][RISCV] Add break to nested switch in `mergeAtomic`

This prevent the warnings from compiler.
---
 lld/ELF/Arch/RISCV.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 6af89ce3517b7..56759c28dcf41 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1131,6 +1131,7 @@ static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
     case RISCVAttrs::RISCVAtomicAbiTag::A6C:
       return;
     };
+    break;
 
   case RISCVAtomicAbiTag::A6S:
     switch (newTag) {
@@ -1144,6 +1145,7 @@ static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
     case RISCVAttrs::RISCVAtomicAbiTag::A6S:
       return;
     };
+    break;
 
   case RISCVAtomicAbiTag::A7:
     switch (newTag) {
@@ -1157,6 +1159,7 @@ static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
     case RISCVAttrs::RISCVAtomicAbiTag::A7:
       return;
     };
+    break;
   };
 
   // If we get here, then we have an invalid tag, so report it.



More information about the llvm-commits mailing list