[PATCH] uapi/netfilter: Prefer ISO-friendly __typeof__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



typeof() is a GNU extension, UAPI requires ISO C, therefore __typeof__()
should be used.  Similarly to b4bd35a19df5 ("uapi/linux/const.h: Prefer
ISO-friendly __typeof__") use __typeof__() also in x_tables.h.

Signed-off-by: Petr Vorel <pvorel@xxxxxxx>
---
Based on [1] merged into linux-next as b4bd35a19df5.
There should be the same Fixes: which we agree in discussion in [1]
(likely a79ff731a1b2, or d6fc9fcbaa65).

Kind regards,
Petr

[1] https://lore.kernel.org/lkml/20230411092747.3759032-1-kevin.brodsky@xxxxxxx/


 include/uapi/linux/netfilter/x_tables.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/netfilter/x_tables.h b/include/uapi/linux/netfilter/x_tables.h
index 796af83a963a..d4eced07f2a2 100644
--- a/include/uapi/linux/netfilter/x_tables.h
+++ b/include/uapi/linux/netfilter/x_tables.h
@@ -172,11 +172,11 @@ struct xt_counters_info {
 
 /* pos is normally a struct ipt_entry/ip6t_entry/etc. */
 #define xt_entry_foreach(pos, ehead, esize) \
-	for ((pos) = (typeof(pos))(ehead); \
-	     (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
-	     (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
+	for ((pos) = (__typeof__(pos))(ehead); \
+	     (pos) < (__typeof__(pos))((char *)(ehead) + (esize)); \
+	     (pos) = (__typeof__(pos))((char *)(pos) + (pos)->next_offset))
 
-/* can only be xt_entry_match, so no use of typeof here */
+/* can only be xt_entry_match, so no use of __typeof__ here */
 #define xt_ematch_foreach(pos, entry) \
 	for ((pos) = (struct xt_entry_match *)entry->elems; \
 	     (pos) < (struct xt_entry_match *)((char *)(entry) + \
-- 
2.40.0




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux