diff mbox series

[09/10] netfilter: Add message pragma for deprecated xt_*.h, ipt_*.h.

Message ID 20250107024120.98288-10-egyszeregy@freemail.hu (mailing list archive)
State Awaiting Upstream
Headers show
Series netfilter: x_tables: Merge xt_*.h and ipt_*.h files which has same name. | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success Errors and warnings before: 0 (+23) this patch: 0 (+23)
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang fail Errors and warnings before: 6 this patch: 28
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Szőke Benjamin Jan. 7, 2025, 2:41 a.m. UTC
From: Benjamin Szőke <egyszeregy@freemail.hu>

Display information about deprecated xt_*.h, ipt_*.h files
at compile time. Recommended to use header files with
lowercase name format in the future.

Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
---
 include/uapi/linux/netfilter/xt_CONNMARK.h  | 2 ++
 include/uapi/linux/netfilter/xt_DSCP.h      | 2 ++
 include/uapi/linux/netfilter/xt_MARK.h      | 2 ++
 include/uapi/linux/netfilter/xt_RATEEST.h   | 2 ++
 include/uapi/linux/netfilter/xt_TCPMSS.h    | 2 ++
 include/uapi/linux/netfilter_ipv4/ipt_ECN.h | 2 ++
 include/uapi/linux/netfilter_ipv4/ipt_TTL.h | 2 ++
 include/uapi/linux/netfilter_ipv6/ip6t_HL.h | 2 ++
 8 files changed, 16 insertions(+)

Comments

Jozsef Kadlecsik Jan. 7, 2025, 7:39 p.m. UTC | #1
On Tue, 7 Jan 2025, egyszeregy@freemail.hu wrote:

> From: Benjamin Szőke <egyszeregy@freemail.hu>
> 
> Display information about deprecated xt_*.h, ipt_*.h files
> at compile time. Recommended to use header files with
> lowercase name format in the future.

I still don't know whether adding the pragmas to notify about header file
deprecation is a good idea.

On my part that's all. Thank you the work!

Best regards,
Jozsef
 
> Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
> ---
>  include/uapi/linux/netfilter/xt_CONNMARK.h  | 2 ++
>  include/uapi/linux/netfilter/xt_DSCP.h      | 2 ++
>  include/uapi/linux/netfilter/xt_MARK.h      | 2 ++
>  include/uapi/linux/netfilter/xt_RATEEST.h   | 2 ++
>  include/uapi/linux/netfilter/xt_TCPMSS.h    | 2 ++
>  include/uapi/linux/netfilter_ipv4/ipt_ECN.h | 2 ++
>  include/uapi/linux/netfilter_ipv4/ipt_TTL.h | 2 ++
>  include/uapi/linux/netfilter_ipv6/ip6t_HL.h | 2 ++
>  8 files changed, 16 insertions(+)
> 
> diff --git a/include/uapi/linux/netfilter/xt_CONNMARK.h b/include/uapi/linux/netfilter/xt_CONNMARK.h
> index 171af24ef679..1bc991fd546a 100644
> --- a/include/uapi/linux/netfilter/xt_CONNMARK.h
> +++ b/include/uapi/linux/netfilter/xt_CONNMARK.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter/xt_connmark.h>
>  
> +#pragma message("xt_CONNMARK.h header is deprecated. Use xt_connmark.h instead.")
> +
>  #endif /* _XT_CONNMARK_TARGET_H */
> diff --git a/include/uapi/linux/netfilter/xt_DSCP.h b/include/uapi/linux/netfilter/xt_DSCP.h
> index fcff72347256..bd550292803d 100644
> --- a/include/uapi/linux/netfilter/xt_DSCP.h
> +++ b/include/uapi/linux/netfilter/xt_DSCP.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter/xt_dscp.h>
>  
> +#pragma message("xt_DSCP.h header is deprecated. Use xt_dscp.h instead.")
> +
>  #endif /* _XT_DSCP_TARGET_H */
> diff --git a/include/uapi/linux/netfilter/xt_MARK.h b/include/uapi/linux/netfilter/xt_MARK.h
> index cdc12c0954b3..9f6c03e26c96 100644
> --- a/include/uapi/linux/netfilter/xt_MARK.h
> +++ b/include/uapi/linux/netfilter/xt_MARK.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter/xt_mark.h>
>  
> +#pragma message("xt_MARK.h header is deprecated. Use xt_mark.h instead.")
> +
>  #endif /* _XT_MARK_H_TARGET_H */
> diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h
> index f817b5387164..ec3d68f67b2f 100644
> --- a/include/uapi/linux/netfilter/xt_RATEEST.h
> +++ b/include/uapi/linux/netfilter/xt_RATEEST.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter/xt_rateest.h>
>  
> +#pragma message("xt_RATEEST.h header is deprecated. Use xt_rateest.h instead.")
> +
>  #endif /* _XT_RATEEST_TARGET_H */
> diff --git a/include/uapi/linux/netfilter/xt_TCPMSS.h b/include/uapi/linux/netfilter/xt_TCPMSS.h
> index 154e88c1de02..826060264766 100644
> --- a/include/uapi/linux/netfilter/xt_TCPMSS.h
> +++ b/include/uapi/linux/netfilter/xt_TCPMSS.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter/xt_tcpmss.h>
>  
> +#pragma message("xt_TCPMSS.h header is deprecated. Use xt_tcpmss.h instead.")
> +
>  #endif /* _XT_TCPMSS_TARGET_H */
> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
> index 6727f5a44512..42317fb3a4e9 100644
> --- a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
> +++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter_ipv4/ipt_ecn.h>
>  
> +#pragma message("ipt_ECN.h header is deprecated. Use ipt_ecn.h instead.")
> +
>  #endif /* _IPT_ECN_TARGET_H */
> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
> index 5d989199ed28..1663493e4951 100644
> --- a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
> +++ b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter_ipv4/ipt_ttl.h>
>  
> +#pragma message("ipt_TTL.h header is deprecated. Use ipt_ttl.h instead.")
> +
>  #endif /* _IPT_TTL_TARGET_H */
> diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
> index bcf22824b393..55f08e20acd2 100644
> --- a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
> +++ b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
> @@ -4,4 +4,6 @@
>  
>  #include <linux/netfilter_ipv6/ip6t_hl.h>
>  
> +#pragma message("ip6t_HL.h header is deprecated. Use ip6t_hl.h instead.")
> +
>  #endif /* _IP6T_HL_TARGET_H */
> -- 
> 2.43.5
> 
>
Szőke Benjamin Jan. 7, 2025, 10:06 p.m. UTC | #2
2025. 01. 07. 20:39 keltezéssel, Jozsef Kadlecsik írta:
> On Tue, 7 Jan 2025, egyszeregy@freemail.hu wrote:
> 
>> From: Benjamin Szőke <egyszeregy@freemail.hu>
>>
>> Display information about deprecated xt_*.h, ipt_*.h files
>> at compile time. Recommended to use header files with
>> lowercase name format in the future.
> 
> I still don't know whether adding the pragmas to notify about header file
> deprecation is a good idea.
> 

Do you have any other ideas how can you display this information to the 
users/customers, that it is time to stop using the uppercase header files then 
they shall to use its merged lowercase named files instead in their userspace SW?

> On my part that's all. Thank you the work!
> 
> Best regards,
> Jozsef
>   
>> Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
>> ---
>>   include/uapi/linux/netfilter/xt_CONNMARK.h  | 2 ++
>>   include/uapi/linux/netfilter/xt_DSCP.h      | 2 ++
>>   include/uapi/linux/netfilter/xt_MARK.h      | 2 ++
>>   include/uapi/linux/netfilter/xt_RATEEST.h   | 2 ++
>>   include/uapi/linux/netfilter/xt_TCPMSS.h    | 2 ++
>>   include/uapi/linux/netfilter_ipv4/ipt_ECN.h | 2 ++
>>   include/uapi/linux/netfilter_ipv4/ipt_TTL.h | 2 ++
>>   include/uapi/linux/netfilter_ipv6/ip6t_HL.h | 2 ++
>>   8 files changed, 16 insertions(+)
>>
>> diff --git a/include/uapi/linux/netfilter/xt_CONNMARK.h b/include/uapi/linux/netfilter/xt_CONNMARK.h
>> index 171af24ef679..1bc991fd546a 100644
>> --- a/include/uapi/linux/netfilter/xt_CONNMARK.h
>> +++ b/include/uapi/linux/netfilter/xt_CONNMARK.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter/xt_connmark.h>
>>   
>> +#pragma message("xt_CONNMARK.h header is deprecated. Use xt_connmark.h instead.")
>> +
>>   #endif /* _XT_CONNMARK_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter/xt_DSCP.h b/include/uapi/linux/netfilter/xt_DSCP.h
>> index fcff72347256..bd550292803d 100644
>> --- a/include/uapi/linux/netfilter/xt_DSCP.h
>> +++ b/include/uapi/linux/netfilter/xt_DSCP.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter/xt_dscp.h>
>>   
>> +#pragma message("xt_DSCP.h header is deprecated. Use xt_dscp.h instead.")
>> +
>>   #endif /* _XT_DSCP_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter/xt_MARK.h b/include/uapi/linux/netfilter/xt_MARK.h
>> index cdc12c0954b3..9f6c03e26c96 100644
>> --- a/include/uapi/linux/netfilter/xt_MARK.h
>> +++ b/include/uapi/linux/netfilter/xt_MARK.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter/xt_mark.h>
>>   
>> +#pragma message("xt_MARK.h header is deprecated. Use xt_mark.h instead.")
>> +
>>   #endif /* _XT_MARK_H_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h
>> index f817b5387164..ec3d68f67b2f 100644
>> --- a/include/uapi/linux/netfilter/xt_RATEEST.h
>> +++ b/include/uapi/linux/netfilter/xt_RATEEST.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter/xt_rateest.h>
>>   
>> +#pragma message("xt_RATEEST.h header is deprecated. Use xt_rateest.h instead.")
>> +
>>   #endif /* _XT_RATEEST_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter/xt_TCPMSS.h b/include/uapi/linux/netfilter/xt_TCPMSS.h
>> index 154e88c1de02..826060264766 100644
>> --- a/include/uapi/linux/netfilter/xt_TCPMSS.h
>> +++ b/include/uapi/linux/netfilter/xt_TCPMSS.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter/xt_tcpmss.h>
>>   
>> +#pragma message("xt_TCPMSS.h header is deprecated. Use xt_tcpmss.h instead.")
>> +
>>   #endif /* _XT_TCPMSS_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
>> index 6727f5a44512..42317fb3a4e9 100644
>> --- a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
>> +++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter_ipv4/ipt_ecn.h>
>>   
>> +#pragma message("ipt_ECN.h header is deprecated. Use ipt_ecn.h instead.")
>> +
>>   #endif /* _IPT_ECN_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
>> index 5d989199ed28..1663493e4951 100644
>> --- a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
>> +++ b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter_ipv4/ipt_ttl.h>
>>   
>> +#pragma message("ipt_TTL.h header is deprecated. Use ipt_ttl.h instead.")
>> +
>>   #endif /* _IPT_TTL_TARGET_H */
>> diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
>> index bcf22824b393..55f08e20acd2 100644
>> --- a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
>> +++ b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
>> @@ -4,4 +4,6 @@
>>   
>>   #include <linux/netfilter_ipv6/ip6t_hl.h>
>>   
>> +#pragma message("ip6t_HL.h header is deprecated. Use ip6t_hl.h instead.")
>> +
>>   #endif /* _IP6T_HL_TARGET_H */
>> -- 
>> 2.43.5
>>
>>
>
Jan Engelhardt Jan. 7, 2025, 10:38 p.m. UTC | #3
On Tuesday 2025-01-07 23:06, Szőke Benjamin wrote:
>> 
>> I still don't know whether adding the pragmas to notify about header file
>> deprecation is a good idea.
>
> Do you have any other ideas how can you display this information to the
> users/customers, that it is time to stop using the uppercase header files then
> they shall to use its merged lowercase named files instead in their userspace
> SW?

``__attribute__`` is just as implementation-specific as ``#pragma``, so it's
not really an improvement, but here goes:

----
struct __attribute__((deprecated("This header file is deprecated"))) dontusethisstruct {
};
extern struct dontusethisstruct undefinedstruct;
----
Szőke Benjamin Jan. 7, 2025, 11:24 p.m. UTC | #4
2025. 01. 07. 23:38 keltezéssel, Jan Engelhardt írta:
> 
> On Tuesday 2025-01-07 23:06, Szőke Benjamin wrote:
>>>
>>> I still don't know whether adding the pragmas to notify about header file
>>> deprecation is a good idea.
>>
>> Do you have any other ideas how can you display this information to the
>> users/customers, that it is time to stop using the uppercase header files then
>> they shall to use its merged lowercase named files instead in their userspace
>> SW?
> 
> ``__attribute__`` is just as implementation-specific as ``#pragma``, so it's
> not really an improvement, but here goes:
> 
> ----
> struct __attribute__((deprecated("This header file is deprecated"))) dontusethisstruct {
> };
> extern struct dontusethisstruct undefinedstruct;
> ----

As i know it is a feature only in GCC, can it work with Clang compiler?
https://renenyffenegger.ch/notes/development/languages/C-C-plus-plus/GCC/__attribute__/deprecated/index

By the way it is perfect for through a warning for a deprecated struct, function 
etc ... only in GCC, but it is not ideal to use a simple header file include and 
the syntax of it is horryble. Usage of a generic #pragma message is more 
feasible in all compilers.
diff mbox series

Patch

diff --git a/include/uapi/linux/netfilter/xt_CONNMARK.h b/include/uapi/linux/netfilter/xt_CONNMARK.h
index 171af24ef679..1bc991fd546a 100644
--- a/include/uapi/linux/netfilter/xt_CONNMARK.h
+++ b/include/uapi/linux/netfilter/xt_CONNMARK.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter/xt_connmark.h>
 
+#pragma message("xt_CONNMARK.h header is deprecated. Use xt_connmark.h instead.")
+
 #endif /* _XT_CONNMARK_TARGET_H */
diff --git a/include/uapi/linux/netfilter/xt_DSCP.h b/include/uapi/linux/netfilter/xt_DSCP.h
index fcff72347256..bd550292803d 100644
--- a/include/uapi/linux/netfilter/xt_DSCP.h
+++ b/include/uapi/linux/netfilter/xt_DSCP.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter/xt_dscp.h>
 
+#pragma message("xt_DSCP.h header is deprecated. Use xt_dscp.h instead.")
+
 #endif /* _XT_DSCP_TARGET_H */
diff --git a/include/uapi/linux/netfilter/xt_MARK.h b/include/uapi/linux/netfilter/xt_MARK.h
index cdc12c0954b3..9f6c03e26c96 100644
--- a/include/uapi/linux/netfilter/xt_MARK.h
+++ b/include/uapi/linux/netfilter/xt_MARK.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter/xt_mark.h>
 
+#pragma message("xt_MARK.h header is deprecated. Use xt_mark.h instead.")
+
 #endif /* _XT_MARK_H_TARGET_H */
diff --git a/include/uapi/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h
index f817b5387164..ec3d68f67b2f 100644
--- a/include/uapi/linux/netfilter/xt_RATEEST.h
+++ b/include/uapi/linux/netfilter/xt_RATEEST.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter/xt_rateest.h>
 
+#pragma message("xt_RATEEST.h header is deprecated. Use xt_rateest.h instead.")
+
 #endif /* _XT_RATEEST_TARGET_H */
diff --git a/include/uapi/linux/netfilter/xt_TCPMSS.h b/include/uapi/linux/netfilter/xt_TCPMSS.h
index 154e88c1de02..826060264766 100644
--- a/include/uapi/linux/netfilter/xt_TCPMSS.h
+++ b/include/uapi/linux/netfilter/xt_TCPMSS.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter/xt_tcpmss.h>
 
+#pragma message("xt_TCPMSS.h header is deprecated. Use xt_tcpmss.h instead.")
+
 #endif /* _XT_TCPMSS_TARGET_H */
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
index 6727f5a44512..42317fb3a4e9 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter_ipv4/ipt_ecn.h>
 
+#pragma message("ipt_ECN.h header is deprecated. Use ipt_ecn.h instead.")
+
 #endif /* _IPT_ECN_TARGET_H */
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
index 5d989199ed28..1663493e4951 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter_ipv4/ipt_ttl.h>
 
+#pragma message("ipt_TTL.h header is deprecated. Use ipt_ttl.h instead.")
+
 #endif /* _IPT_TTL_TARGET_H */
diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
index bcf22824b393..55f08e20acd2 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
@@ -4,4 +4,6 @@ 
 
 #include <linux/netfilter_ipv6/ip6t_hl.h>
 
+#pragma message("ip6t_HL.h header is deprecated. Use ip6t_hl.h instead.")
+
 #endif /* _IP6T_HL_TARGET_H */