netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Cc: Thomas Haller <thaller@redhat.com>
Subject: [PATCH nft 3/5] src: silence "implicit-fallthrough" warnings
Date: Tue, 29 Aug 2023 20:54:09 +0200	[thread overview]
Message-ID: <20230829185509.374614-4-thaller@redhat.com> (raw)
In-Reply-To: <20230829185509.374614-1-thaller@redhat.com>

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>
---
 src/optimize.c | 1 +
 src/segtree.c  | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/optimize.c b/src/optimize.c
index 0b99b6726115..9c1704831693 100644
--- a/src/optimize.c
+++ b/src/optimize.c
@@ -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;
diff --git a/src/segtree.c b/src/segtree.c
index a265a0b30d64..bf207402c945 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -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);
-- 
2.41.0


  parent reply	other threads:[~2023-08-29 18:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 18:54 [PATCH nft 0/5] fix compiler warnings with clang and "-Wextra" Thomas Haller
2023-08-29 18:54 ` [PATCH nft 1/5] rule: fix "const static" declaration Thomas Haller
2023-08-29 18:54 ` [PATCH nft 2/5] utils: call abort() after BUG() macro Thomas Haller
2023-08-29 18:54 ` Thomas Haller [this message]
2023-08-29 18:54 ` [PATCH nft 4/5] xt: avoid "-Wmissing-field-initializers" for "original_opts" Thomas Haller
2023-08-29 18:54 ` [PATCH nft 5/5] datatype: check against negative "type" argument in datatype_lookup() Thomas Haller
2023-08-29 19:10   ` Pablo Neira Ayuso
2023-08-29 19:14     ` Pablo Neira Ayuso
2023-08-29 19:58       ` Thomas Haller
2023-08-30  7:46         ` Pablo Neira Ayuso
2023-08-30  8:08           ` Thomas Haller
2023-08-30  8:23             ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230829185509.374614-4-thaller@redhat.com \
    --to=thaller@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).