Clang with -Wunreachable-code-aggressive reports break statements
after a return or rte_exit(), and returns after a switch where
every case returns.

Remove them. Extra defensive code does not help: with the trailing
return gone, adding a case that forgets to return becomes a
compiler error instead of silently returning zero.

Signed-off-by: Stephen Hemminger <[email protected]>
---
 app/dumpcap/main.c                               | 1 -
 app/pdump/main.c                                 | 1 -
 app/test-compress-perf/comp_perf_options_parse.c | 1 -
 app/test-crypto-perf/cperf_ops.c                 | 1 -
 app/test-crypto-perf/cperf_options_parsing.c     | 1 -
 app/test-flow-perf/main.c                        | 1 -
 app/test-gpudev/main.c                           | 1 -
 app/test-pmd/parameters.c                        | 2 --
 app/test-regex/main.c                            | 2 --
 app/test-security-perf/test_security_perf.c      | 1 -
 app/test/test_cryptodev.c                        | 9 ---------
 app/test/test_cryptodev_crosscheck.c             | 6 ------
 app/test/test_eal_flags.c                        | 1 -
 13 files changed, 28 deletions(-)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 47483535fc..32bb65a97a 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -401,7 +401,6 @@ static void parse_opts(int argc, char **argv)
                case 'b':
                        rte_exit(EXIT_FAILURE,
                                 "multiple files not implemented\n");
-                       break;
                case 'c':
                        stop.packets = get_uint(optarg, "packet_count", 0);
                        break;
diff --git a/app/pdump/main.c b/app/pdump/main.c
index 1f6135b20e..6f33b777d9 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -617,7 +617,6 @@ configure_vdev(uint16_t port_id)
                rte_exit(EXIT_FAILURE,
                         "promiscuous mode enable failed: %s\n",
                         rte_strerror(-ret));
-               return ret;
        }
 
        return 0;
diff --git a/app/test-compress-perf/comp_perf_options_parse.c 
b/app/test-compress-perf/comp_perf_options_parse.c
index 16d31c7e90..3cb8dbdd7f 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -709,7 +709,6 @@ comp_perf_options_parse(struct comp_test_data *test_data, 
int argc, char **argv)
                case 'h':
                        usage(argv[0]);
                        exit(EXIT_SUCCESS);
-                       break;
                /* long options */
                case 0:
                        retval = comp_perf_opts_parse_long(opt_idx, test_data);
diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 1c8d1e263a..68432755f5 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -122,7 +122,6 @@ cperf_set_ops_asym_ecdsa(struct rte_crypto_op **ops,
                default:
                        rte_panic("Unsupported ECDSA operation type %d\n",
                                  options->op_type);
-                       break;
                }
 
                asym_op->ecdsa.message.data = ecdsa_curve_data->message.data;
diff --git a/app/test-crypto-perf/cperf_options_parsing.c 
b/app/test-crypto-perf/cperf_options_parsing.c
index b1b0abbcbc..61ce3af7e4 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -1258,7 +1258,6 @@ cperf_options_parse(struct cperf_options *options, int 
argc, char **argv)
                case 'h':
                        usage(argv[0]);
                        exit(EXIT_SUCCESS);
-                       break;
                /* long options */
                case 0:
                        retval = cperf_opts_parse_long(opt_idx, options);
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 6636d1517f..c529f55c73 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -986,7 +986,6 @@ args_parse(int argc, char **argv)
                        usage(argv[0]);
                        rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
                                        argv[optind - 1]);
-                       break;
                }
        }
        if (rules_count % rules_batch != 0) {
diff --git a/app/test-gpudev/main.c b/app/test-gpudev/main.c
index f065e6cd81..4bf0c1a09d 100644
--- a/app/test-gpudev/main.c
+++ b/app/test-gpudev/main.c
@@ -57,7 +57,6 @@ args_parse(int argc, char **argv)
                default:
                        usage(argv[0]);
                        rte_exit(EXIT_FAILURE, "Invalid option: %s\n", 
argv[optind]);
-                       break;
                }
        }
 }
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 9967e49881..0668c7d240 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -975,7 +975,6 @@ launch_args_parse(int argc, char** argv)
                case 'h':
                        usage(argv[0]);
                        exit(EXIT_SUCCESS);
-                       break;
                case TESTPMD_OPT_CMDLINE_FILE_NUM:
                case TESTPMD_OPT_CMDLINE_FILE_NOECHO_NUM:
                        if (cmdline_file_count >= RTE_DIM(cmdline_files)) {
@@ -1797,7 +1796,6 @@ launch_args_parse(int argc, char** argv)
                        fprintf(stderr, "Invalid option: %s\n", argv[optind - 
1]);
                        rte_exit(EXIT_FAILURE,
                                 "Command line is incomplete or incorrect\n");
-                       break;
                }
        }
 
diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index 81719f2e04..a27a9b73b7 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -173,7 +173,6 @@ args_parse(int argc, char **argv, char *rules_file, char 
*data_file,
                default:
                        usage(argv[0]);
                        rte_exit(EXIT_FAILURE, "Invalid option: %s\n", 
argv[optind]);
-                       break;
                }
        }
 
@@ -530,7 +529,6 @@ run_regex(void *args)
                        default:
                                rte_exit(EXIT_FAILURE,
                                         "Invalid match mode value\n");
-                               break;
                        }
                        pos += act_job_len;
                        actual_jobs++;
diff --git a/app/test-security-perf/test_security_perf.c 
b/app/test-security-perf/test_security_perf.c
index dd377a6027..4dc3c117eb 100644
--- a/app/test-security-perf/test_security_perf.c
+++ b/app/test-security-perf/test_security_perf.c
@@ -464,7 +464,6 @@ args_parse(int argc, char **argv)
                        usage(argv[0]);
                        rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
                                        argv[opt_idx - 1]);
-                       break;
                }
        }
 
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index eb955766bc..8086377f19 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3759,8 +3759,6 @@ test_snow3g_authentication_verify(const struct 
snow3g_hash_test_data *tdata)
                return 0;
        else
                return -1;
-
-       return 0;
 }
 
 static int
@@ -3939,8 +3937,6 @@ test_kasumi_authentication_verify(const struct 
kasumi_hash_test_data *tdata)
                return 0;
        else
                return -1;
-
-       return 0;
 }
 
 static int
@@ -3983,7 +3979,6 @@ static int
 test_snow3g_hash_verify_test_case_1(void)
 {
        return test_snow3g_authentication_verify(&snow3g_hash_test_case_1);
-
 }
 
 static int
@@ -6879,8 +6874,6 @@ test_zuc_authentication(const struct wireless_test_data 
*tdata,
                return 0;
        else
                return -1;
-
-       return 0;
 }
 
 static int
@@ -20097,8 +20090,6 @@ test_NIA_helper(const void *td)
                return 0;
        else
                return -1;
-
-       return 0;
 }
 
 static int
diff --git a/app/test/test_cryptodev_crosscheck.c 
b/app/test/test_cryptodev_crosscheck.c
index bb21c3bc50..e3cb15737a 100644
--- a/app/test/test_cryptodev_crosscheck.c
+++ b/app/test/test_cryptodev_crosscheck.c
@@ -152,7 +152,6 @@ profile_create(const struct 
rte_cryptodev_symmetric_capability *capa,
                        break;
                default:
                        rte_panic("Wrong capability profile type: %i\n", 
capability_type);
-                       break;
                }
                break;
        case RTE_CRYPTO_SYM_XFORM_CIPHER:
@@ -171,7 +170,6 @@ profile_create(const struct 
rte_cryptodev_symmetric_capability *capa,
                        break;
                default:
                        rte_panic("Wrong capability profile type: %i\n", 
capability_type);
-                       break;
                }
                break;
        case RTE_CRYPTO_SYM_XFORM_AEAD:
@@ -193,12 +191,10 @@ profile_create(const struct 
rte_cryptodev_symmetric_capability *capa,
                        break;
                default:
                        rte_panic("Wrong capability profile type: %i\n", 
capability_type);
-                       break;
                }
                break;
        default:
                rte_panic("Wrong xform profile type: %i\n", capa->xform_type);
-               break;
        }
 
        profile.input_buf_len = RTE_ALIGN_CEIL(input_len, profile.block_size);
@@ -254,7 +250,6 @@ sym_capability_to_idx(const struct 
rte_cryptodev_symmetric_capability *cap)
                break;
        default:
                rte_panic("Wrong capability profile type: %i\n", cap_idx.type);
-               break;
        }
 
        return cap_idx;
@@ -457,7 +452,6 @@ crosscheck_init(void)
                        break;
                default:
                        rte_panic("Wrong capability profile type: %i\n", 
cap->xform_type);
-                       break;
                }
        }
 
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index dcfdc42eca..b059f5d929 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -214,7 +214,6 @@ process_hugefiles(const char *prefix, enum hugepage_action 
action)
                                        result = 1;
                                        goto end;
                                }
-                               break;
                        case HUGEPAGE_DELETE:
                                {
                                        char file_path[PATH_MAX];
-- 
2.53.0

Reply via email to