Unreachable code is usually a symptom of a real bug: a misplaced return, an inverted condition, or a loop that can never iterate. DPDK does not build with -Wunreachable-code anywhere, so none of these get caught.
Add a no_unreachable_cflag variable, following the no_shadow_cflag pattern, so that the few drivers with unreachable code in imported base code can be excluded when the check is enabled. Only clang implements this warning. GCC accepts -Wunreachable-code but documents it as doing nothing, so finding these bugs requires a clang build. Signed-off-by: Stephen Hemminger <[email protected]> --- config/meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/meson.build b/config/meson.build index bfac1cd93d..9f501589b7 100644 --- a/config/meson.build +++ b/config/meson.build @@ -372,6 +372,11 @@ if cc.has_argument('-Wno-shadow') no_shadow_cflag = '-Wno-shadow' endif +no_unreachable_cflag = [] +if cc.has_argument('-Wunreachable-code') + no_unreachable_cflag = '-Wno-unreachable-code' +endif + # per-driver option to disable -Wcomma if supported by the compiler no_comma_cflag = [] if cc.has_argument('-Wno-comma') -- 2.53.0

