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.march...@redhat.com>
---
 devtools/checkpatches.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 003bb49e04..c6920747f7 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -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' \
-- 
2.48.1

Reply via email to