All of lore.kernel.org
 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/8] src: use "%zx" format instead of "%Zx"
Date: Mon, 28 Aug 2023 16:43:53 +0200	[thread overview]
Message-ID: <20230828144441.3303222-4-thaller@redhat.com> (raw)
In-Reply-To: <20230828144441.3303222-1-thaller@redhat.com>

"%zu" is C99. On the other hand, `man printf` comments about "Z":

  A nonstandard synonym for z that predates the appearance of z.  Do not use in code.

This fixes a compiler warning with clang:

    datatype.c:299:26: error: invalid conversion specifier 'Z' [-Werror,-Wformat-invalid-specifier]
            nft_gmp_print(octx, "0x%Zx [invalid type]", expr->value);
                                   ~^

Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 src/datatype.c  |  6 +++---
 src/intervals.c | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/datatype.c b/src/datatype.c
index dd6a5fbf5df8..a91b9cb793d5 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -296,7 +296,7 @@ void symbol_table_print(const struct symbol_table *tbl,
 
 static void invalid_type_print(const struct expr *expr, struct output_ctx *octx)
 {
-	nft_gmp_print(octx, "0x%Zx [invalid type]", expr->value);
+	nft_gmp_print(octx, "0x%zx [invalid type]", expr->value);
 }
 
 const struct datatype invalid_type = {
@@ -436,7 +436,7 @@ const struct datatype bitmask_type = {
 	.type		= TYPE_BITMASK,
 	.name		= "bitmask",
 	.desc		= "bitmask",
-	.basefmt	= "0x%Zx",
+	.basefmt	= "0x%zx",
 	.basetype	= &integer_type,
 };
 
@@ -486,7 +486,7 @@ const struct datatype integer_type = {
 
 static void xinteger_type_print(const struct expr *expr, struct output_ctx *octx)
 {
-	nft_gmp_print(octx, "0x%Zx", expr->value);
+	nft_gmp_print(octx, "0x%zx", expr->value);
 }
 
 /* Alias of integer_type to print raw payload expressions in hexadecimal. */
diff --git a/src/intervals.c b/src/intervals.c
index 85de0199c373..a24f2ca69cb4 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -70,7 +70,7 @@ struct set_automerge_ctx {
 static void purge_elem(struct set_automerge_ctx *ctx, struct expr *i)
 {
 	if (ctx->debug_mask & NFT_DEBUG_SEGTREE) {
-		pr_gmp_debug("remove: [%Zx-%Zx]\n",
+		pr_gmp_debug("remove: [%zx-%zx]\n",
 			     i->key->left->value,
 			     i->key->right->value);
 	}
@@ -255,7 +255,7 @@ int set_automerge(struct list_head *msgs, struct cmd *cmd, struct set *set,
 			list_move_tail(&i->list, &existing_set->init->expressions);
 		} else if (existing_set) {
 			if (debug_mask & NFT_DEBUG_SEGTREE) {
-				pr_gmp_debug("add: [%Zx-%Zx]\n",
+				pr_gmp_debug("add: [%zx-%zx]\n",
 					     i->key->left->value, i->key->right->value);
 			}
 			clone = expr_clone(i);
@@ -509,13 +509,13 @@ int set_delete(struct list_head *msgs, struct cmd *cmd, struct set *set,
 
 	if (debug_mask & NFT_DEBUG_SEGTREE) {
 		list_for_each_entry(i, &init->expressions, list)
-			pr_gmp_debug("remove: [%Zx-%Zx]\n",
+			pr_gmp_debug("remove: [%zx-%zx]\n",
 				     i->key->left->value, i->key->right->value);
 		list_for_each_entry(i, &add->expressions, list)
-			pr_gmp_debug("add: [%Zx-%Zx]\n",
+			pr_gmp_debug("add: [%zx-%zx]\n",
 				     i->key->left->value, i->key->right->value);
 		list_for_each_entry(i, &existing_set->init->expressions, list)
-			pr_gmp_debug("existing: [%Zx-%Zx]\n",
+			pr_gmp_debug("existing: [%zx-%zx]\n",
 				     i->key->left->value, i->key->right->value);
 	}
 
-- 
2.41.0


  parent reply	other threads:[~2023-08-28 14:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 14:43 [PATCH nft 0/8] fix compiler warnings with clang Thomas Haller
2023-08-28 14:43 ` [PATCH nft 1/8] netlink: avoid "-Wenum-conversion" warning in dtype_map_from_kernel() Thomas Haller
2023-08-28 14:43 ` [PATCH nft 2/8] netlink: avoid "-Wenum-conversion" warning in parser_bison.y Thomas Haller
2023-08-28 14:43 ` Thomas Haller [this message]
2023-08-28 14:43 ` [PATCH nft 4/8] datatype: avoid cast-align warning with struct sockaddr result from getaddrinfo() Thomas Haller
2023-08-28 14:43 ` [PATCH nft 5/8] src: rework SNPRINTF_BUFFER_SIZE() and avoid "-Wunused-but-set-variable" Thomas Haller
2023-08-28 15:13   ` Pablo Neira Ayuso
2023-08-28 15:49     ` Thomas Haller
2023-08-28 16:04       ` Pablo Neira Ayuso
2023-08-28 16:45         ` Thomas Haller
2023-08-28 19:53           ` Pablo Neira Ayuso
2023-08-29 13:01             ` Thomas Haller
2023-08-28 14:43 ` [PATCH nft 6/8] src: suppress "-Wunused-but-set-variable" warning with "parser_bison.c" Thomas Haller
2023-08-28 14:43 ` [PATCH nft 7/8] utils: add _NFT_PRAGMA_WARNING_DISABLE()/_NFT_PRAGMA_WARNING_REENABLE helpers Thomas Haller
2023-08-28 14:43 ` [PATCH nft 8/8] datatype: suppress "-Wformat-nonliteral" warning in integer_type_print() Thomas Haller
2023-08-28 15:08   ` Pablo Neira Ayuso
2023-08-28 15:33     ` Thomas Haller
2023-08-28 15:54       ` Pablo Neira Ayuso
2023-08-28 16:24         ` Thomas Haller

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=20230828144441.3303222-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.