devtools: check use of compiler attributes
authorThomas Monjalon <thomas@monjalon.net>
Mon, 10 Feb 2020 16:00:32 +0000 (17:00 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 16 Apr 2020 16:30:58 +0000 (18:30 +0200)
The keyword __attribute__ will emit a warning,
because it is preferred to use or define a common __rte macro.
The centralized macros may help to control or workaround some compilers.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
devtools/checkpatches.sh

index 1794468..c30ce64 100755 (executable)
@@ -61,6 +61,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # refrain from using compiler attribute without defining a common macro
+       awk -v FOLDERS="lib drivers app examples" \
+               -v EXPRESSIONS="__attribute__" \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Using compiler attribute directly' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        # svg figures must be included with wildcard extension
        # because of png conversion for pdf docs
        awk -v FOLDERS='doc' \