<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107739>107739</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h:213: Missing default in switch ?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:ARM,
code-quality
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
Static analyser cppcheck says:
llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h:213:23: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
Source code is
inline static const char *AddrModeToString(AddrMode addrmode) {
switch (addrmode) {
case AddrModeNone: return "AddrModeNone";
case AddrMode1: return "AddrMode1";
case AddrMode2: return "AddrMode2";
case AddrMode3: return "AddrMode3";
case AddrMode4: return "AddrMode4";
case AddrMode5: return "AddrMode5";
case AddrMode5FP16: return "AddrMode5FP16";
case AddrMode6: return "AddrMode6";
case AddrModeT1_1: return "AddrModeT1_1";
case AddrModeT1_2: return "AddrModeT1_2";
case AddrModeT1_4: return "AddrModeT1_4";
case AddrModeT1_s: return "AddrModeT1_s";
case AddrModeT2_i12: return "AddrModeT2_i12";
case AddrModeT2_i8: return "AddrModeT2_i8";
case AddrModeT2_i8pos: return "AddrModeT2_i8pos";
case AddrModeT2_i8neg: return "AddrModeT2_i8neg";
case AddrModeT2_so: return "AddrModeT2_so";
case AddrModeT2_pc: return "AddrModeT2_pc";
case AddrModeT2_i8s4: return "AddrModeT2_i8s4";
case AddrMode_i12: return "AddrMode_i12";
case AddrModeT2_ldrex:return "AddrModeT2_ldrex";
case AddrModeT2_i7s4: return "AddrModeT2_i7s4";
case AddrModeT2_i7s2: return "AddrModeT2_i7s2";
case AddrModeT2_i7: return "AddrModeT2_i7";
}
}
Suggest add default to switch. Perhaps
default: assert( 0);
would be enough.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykls9vqzgQx_8acxk1AvPDcOCQvAhpD109vfZeGXsC3kds1jbty3-_goRuu9uYlfaCiL_-zPjLOJrhzqlOI9YkP5D8GPHJ98bWUrRpkkWtkZf6yXOvBHDNh4tDC2IcRY_iJzh-cSTdk_hI4ttzGF7PhDaDagltnrnt0BPa7H88Eto8frsuHNGJ6-KBO_xNn8yuJ-meJun8nB-A1ho7vzRm0hK4BvylPIzc93Cy5gynSQuvjIY35XvQRj-8GiXBop-sBn8ZEXzPPfTcwVk5p3S3is5zj2fUHkh-uGk_Fonkx49ensxkBYIwEkG5jwqA0oPSuMRSAoTRzoPouQVC93sp7aOR-GyevFW6I7Rcl4BLac9GIqEVEHZYwwG4N-VFD4SWd7cI7hDWSL8bjfMHAlh9EUo_iZSS9B6d3NAv6SSI0hBKg2gaQtMgmoXQLIjmITQPo833pLjiX6CL-BH_xBahtEUw7XPyshTo39yibKD07rVYxA06C9HZfbvPyYsLoS6cmL6ohN7xfNW28PJena7iJj4adz__om6G0NgFQszqRghnAiac2cJHEcBHESjefD6XBQ7vwv-xtXpfJv8v5RukxV8k3X-Z_ipufX4WMsA2DFz3BG7gLG4GCF1B9k-csOP64_311nimrkPn52YBEk98Gjx4c2sRO_iOtuejg88dCdat8yG4c2g9oSXEhFYkPXza_GamQUKLgNpMXb-LZJ3KKq14hHXCaM5YxZIi6uuiLROsKiaLqswqKYq4rQpMT4KyjCPLI1XTmGZxFZcxS_Kk2MWsZFmBJZ4wxbbgJIvxzNWwmweDnbFdpJybsE5ixtIqGniLg1tmD0pbLn6iliTdL_MCJfQboXRuvw9_TnxQ_jIv5sfI1nO0h3bqHMniQTnv_o7vlR-w_t9zCDzepoa1AEq_9-i0iSY71L334zL_0IbQplO-n9qdMEveW_r5mKM1f6CY0y_WHaHNzf1rTf8KAAD__48h1Zw">