numam-dpdk/devtools
David Marchand 18218713bf enforce experimental tag at beginning of declarations
Putting a '__attribute__((deprecated))' in the middle of a function
prototype does not result in the expected result with gcc (while clang
is fine with this syntax).

$ cat deprecated.c
void * __attribute__((deprecated)) incorrect() { return 0; }
__attribute__((deprecated)) void *correct(void) { return 0; }
int main(int argc, char *argv[]) { incorrect(); correct(); return 0; }
$ gcc -o deprecated.o -c deprecated.c
deprecated.c: In function ‘main’:
deprecated.c:3:1: warning: ‘correct’ is deprecated (declared at
deprecated.c:2) [-Wdeprecated-declarations]
 int main(int argc, char *argv[]) { incorrect(); correct(); return 0; }
 ^

Move the tag on a separate line and make it the first thing of function
prototypes.
This is not perfect but we will trust reviewers to catch the other not
so easy to detect patterns.

sed -i \
     -e '/^\([^#].*\)\?__rte_experimental */{' \
     -e 's//\1/; s/ *$//; i\' \
     -e __rte_experimental \
     -e '/^$/d}' \
     $(git grep -l __rte_experimental -- '*.h')

Special mention for rte_mbuf_data_addr_default():

There is either a bug or a (not yet understood) issue with gcc.
gcc won't drop this inline when unused and rte_mbuf_data_addr_default()
calls rte_mbuf_buf_addr() which itself is experimental.
This results in a build warning when not accepting experimental apis
from sources just including rte_mbuf.h.

For this specific case, we hide the call to rte_mbuf_buf_addr() under
the ALLOW_EXPERIMENTAL_API flag.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2019-06-29 19:04:48 +02:00
..
cocci devtools/cocci: create safer version of strlcpy script 2019-04-04 22:45:33 +02:00
build-tags.sh devtools: fix config check when building tags 2019-03-27 00:56:34 +01:00
check-dup-includes.sh use SPDX license tag in Mellanox copyrighted files 2018-05-25 10:33:33 +02:00
check-forbidden-tokens.awk devtools: add explicit warnings for forbidden tokens 2018-11-04 21:54:04 +01:00
check-git-log.sh devtools: add git log checks for TPID, LACP and RETA 2019-04-16 00:21:16 +02:00
check-includes.sh eal: remove exec-env directory 2019-04-02 21:49:35 +02:00
check-maintainers.sh use SPDX tag for 6WIND copyrighted files 2018-05-25 10:47:06 +02:00
check-symbol-change.sh devtools: fix check of symbol added as stable API 2019-05-10 00:19:31 +02:00
check-symbol-maps.sh devtools: check orphan symbols in map files 2018-05-29 17:43:33 +02:00
checkpatches.sh enforce experimental tag at beginning of declarations 2019-06-29 19:04:48 +02:00
cocci.sh devtools: use a common prefix for temporary files 2018-10-01 23:51:45 +02:00
get-maintainer.sh devtools: check Linux script path if directory 2018-05-23 00:33:35 +02:00
git-log-fixes.sh use SPDX tag for 6WIND copyrighted files 2018-05-25 10:47:06 +02:00
load-devel-config scripts: move to devtools 2017-01-04 21:17:32 +01:00
test-build.sh net/nfb: add new netcope driver 2019-04-12 17:01:13 +02:00
test-meson-builds.sh devtools: fix meson build test for plain bourne shell 2019-04-19 23:21:13 +02:00
test-null.sh use SPDX tag for 6WIND copyrighted files 2018-05-25 10:47:06 +02:00
validate-abi.sh devtools: fix ABI compatibility check 2019-05-02 01:44:20 +02:00