]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: silence "implicit-fallthrough" warnings
authorThomas Haller <thaller@redhat.com>
Tue, 29 Aug 2023 18:54:09 +0000 (20:54 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 30 Aug 2023 07:47:12 +0000 (09:47 +0200)
Gcc with "-Wextra" warns:

    CC       segtree.lo
  segtree.c: In function 'get_set_interval_find':
  segtree.c:129:28: error: this statement may fall through [-Werror=implicit-fallthrough=]
    129 |                         if (expr_basetype(i->key)->type != TYPE_STRING)
        |                            ^
  segtree.c:134:17: note: here
    134 |                 case EXPR_PREFIX:
        |                 ^~~~

    CC       optimize.lo
  optimize.c: In function 'rule_collect_stmts':
  optimize.c:396:28: error: this statement may fall through [-Werror=implicit-fallthrough=]
    396 |                         if (stmt->expr->left->etype == EXPR_CONCAT) {
        |                            ^
  optimize.c:400:17: note: here
    400 |                 case STMT_VERDICT:
        |                 ^~~~

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/optimize.c
src/segtree.c

index 0b99b6726115b5baea76221b8801c01e1158aa5e..9c17048316936fc4ed0963a7d51bbf12e94e8483 100644 (file)
@@ -397,6 +397,7 @@ static int rule_collect_stmts(struct optimize_ctx *ctx, struct rule *rule)
                                clone->ops = &unsupported_stmt_ops;
                                break;
                        }
+                       /* fall-through */
                case STMT_VERDICT:
                        clone->expr = expr_get(stmt->expr);
                        break;
index a265a0b30d64ce420823640396d473e5e52cc365..bf207402c945bb9ac8199b9d4d982a3b44bae62f 100644 (file)
@@ -128,9 +128,8 @@ static struct expr *get_set_interval_find(const struct set *cache_set,
                case EXPR_VALUE:
                        if (expr_basetype(i->key)->type != TYPE_STRING)
                                break;
-                       /* string type, check if its a range (wildcard), so
-                        * fall through.
-                        */
+                       /* string type, check if its a range (wildcard). */
+                       /* fall-through */
                case EXPR_PREFIX:
                case EXPR_RANGE:
                        range_expr_value_low(val, i);