devtools: forbid use of compiler pragmas
Checks
Commit Message
Using pragma must be prevented to avoid breaking builds with other
compilers.
Let EAL use them (like for abstraction macros).
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
devtools/checkpatches.sh | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Thursday, 30 January 2025 09.38
>
> Using pragma must be prevented to avoid breaking builds with other
> compilers.
> Let EAL use them (like for abstraction macros).
You are only allowing them in rte_common.h.
Do we need them elsewhere in EAL?
Not that I think so, but the patch description could be interpreted that way.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Good idea!
Acked-by: Morten Brørup <mb@smartsharesystems.com>
On Thu, Jan 30, 2025 at 9:45 AM Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > From: David Marchand [mailto:david.marchand@redhat.com]
> > Sent: Thursday, 30 January 2025 09.38
> >
> > Using pragma must be prevented to avoid breaking builds with other
> > compilers.
> > Let EAL use them (like for abstraction macros).
>
> You are only allowing them in rte_common.h.
> Do we need them elsewhere in EAL?
> Not that I think so, but the patch description could be interpreted that way.
Ah yes, I forgot to update description afterwards.
I can update when applying.
>
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
>
> Good idea!
>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
30/01/2025 09:37, David Marchand:
> Using pragma must be prevented to avoid breaking builds with other
> compilers.
> Let EAL use them (like for abstraction macros).
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> + # forbid use of #pragma
> + awk -v FOLDERS='lib drivers app examples' \
> + -v SKIP_FILES='lib/eal/include/rte_common.h' \
> + -v EXPRESSIONS='(#pragma|_Pragma)' \
> + -v RET_ON_FAIL=1 \
> + -v MESSAGE='Using compilers pragma is not allowed' \
> + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> + "$1" || res=1
Acked-by: Thomas Monjalon <thomas@monjalon.net>
@@ -210,6 +210,15 @@ check_forbidden_additions() { # <patch>
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
"$1" || res=1
+ # forbid use of #pragma
+ awk -v FOLDERS='lib drivers app examples' \
+ -v SKIP_FILES='lib/eal/include/rte_common.h' \
+ -v EXPRESSIONS='(#pragma|_Pragma)' \
+ -v RET_ON_FAIL=1 \
+ -v MESSAGE='Using compilers pragma is not allowed' \
+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+ "$1" || res=1
+
# forbid use of experimental build flag except in examples
awk -v FOLDERS='lib drivers app' \
-v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \