Commit Graph

22 Commits

Author SHA1 Message Date
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
David Marchand
cfe3aeb170 remove experimental tags from all symbol definitions
We had some inconsistencies between functions prototypes and actual
definitions.
Let's avoid this by only adding the experimental tag to the prototypes.
Tests with gcc and clang show it is enough.

git grep -l __rte_experimental |grep \.c$ |while read file; do
	sed -i -e '/^__rte_experimental$/d' $file;
	sed -i -e 's/  *__rte_experimental//' $file;
	sed -i -e 's/__rte_experimental  *//' $file;
done

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2019-06-29 19:04:43 +02:00
David Marchand
ee2b25c85a devtools: select patches to check with git range
Rather than default to origin/master.., it can be handy to choose the
range you want to check.

Example on a branch rebased on next-net:

Before:
$ ./devtools/checkpatches.sh
...
...
67/69 valid patches

After:
$ ./devtools/checkpatches.sh -r next-net/master..

3/3 valid patches

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2019-05-10 15:16:23 +02:00
Michael Santana
1f6168503e devtools: fix result of svg include check
Fix trivial bug. In sh shell, 'foo = 1' is not the same as
'foo=1'. Using 'foo = 1' makes the shell attempt to interpret foo
as a command, rather than a simple variable assignment.

Fixes: dafc04c151 ("devtools: fix return of forbidden addition checks")
Cc: stable@dpdk.org

Signed-off-by: Michael Santana <msantana@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2019-03-04 22:46:10 +01:00
Michael Santana
abdd314151 devtools: enable codespell in checkpatch
Enable codespell by default.
codespell is a feature by checkpatch.pl that
checks for common spelling mistakes in patches.

This feature is disabled by default. To enable it one must add
the '--codespell' flag to the $options variable in
checkpatches.sh. With this change codespell is enabled by default.
The user can decide to turn off codespell from a one of the config
files read by checkpatches.sh.

Signed-off-by: Michael Santana <msantana@redhat.com>
Reviewed-by: Rami Rosen <ramirose@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2019-03-04 22:46:03 +01:00
Arnon Warshavsky
dafc04c151 devtools: fix return of forbidden addition checks
Explicitly collect the error code of the multiple awk script calls.

Bugzilla ID: 165
Fixes: 4d4c612e6a ("devtools: check wrong svg include in guides")
Cc: stable@dpdk.org

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
2018-12-21 01:58:23 +01:00
Arnon Warshavsky
b467d38284 devtools: add explicit warnings for forbidden tokens
Replace the content of warning in the forbidden tokens script
from using the searched regex into using explicit messages

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
2018-11-04 21:54:04 +01:00
Thomas Monjalon
4d4c612e6a devtools: check wrong svg include in guides
Including svg files with the svg extension is a common mistake:
	.. figure:: example.svg
must be
	.. figure:: example.*
So it will work also when building pdf doc with figures converted
to png files.

A check is added in checkpatches.sh.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
2018-11-01 22:13:33 +01:00
Thomas Monjalon
ff37ca5d37 devtools: use a common prefix for temporary files
Some temporary files were generated in /tmp, others in the current
directory, and none was "dpdk prefixed".

All these files have a common path prefix now: $TMPDIR/dpdk.
TMPDIR is /tmp by default.

Note: the previous use of mktemp, with a template but without -t,
was generating a file in the current directory.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-10-01 23:51:45 +02:00
Thomas Monjalon
8f3ea0a03d devtools: fix printing subject of checked patch
If checkpatches.sh is not run with verbose option (-v),
the patch subject is printed as headline of errors only
if there is an error reported by checkpatch.pl, not with other checks.
The headline is moved to a function which is called after each check
if there is an error and if it has not already be printed.

One more addition, in verbose mode, checkpatch.pl is now announced
as done for other checks.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2018-10-01 23:46:50 +02:00
Arnon Warshavsky
42f4d724ec devtools: move awk script ckecking forbidden tokens
The awk code previously read inline in checkpatches.sh
was using -d which is a bash option,
while bash is not the default shell in all distributions.
Now moved to be read from a separate file.

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
Acked-by: Andrzej Ostruszka <amo@semihalf.com>
2018-10-01 23:40:45 +02:00
Gavin Hu
d633ed1077 devtools: fix checkpatch with dash
When running checkpatch.sh, it generates the following error
on some linux distributions(like Debian) with Dash as the
default shell interpreter.
trap: SIGINT: bad trap

The fix is to replace SIGINT with INT signal, it works for
both bash and dash.

Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
Cc: stable@dpdk.org

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Tested-by: Vipin Varghese <vipin.varghese@intel.com>
2018-08-01 16:42:53 +02:00
Arnon Warshavsky
7413e7f2ae devtools: alert on new calls to exit from libs
This patch adds a new function that is called
per every checked patch,
and alerts for new instances of rte_panic/rte_exit.
The check excludes comments, and alerts in the case
of a positive balance between additions and removals.

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Tested-by: Kevin Traynor <ktraynor@redhat.com>
2018-07-31 14:12:57 +02:00
Thomas Monjalon
6793a1f771 devtools: fix checkpatch for filename with space
If the patch filename or the temporary file path have a space
in their name, the script checkpatches.sh does not work.
The variables for the filenames must be enclosed in quotes
in order to preserve spaces.

Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2018-07-20 22:53:17 +02:00
Neil Horman
4bec48184e devtools: add checks for ABI symbol addition
Recently, some additional patches were added to allow for programmatic
marking of C symbols as experimental.  The addition of these markers is
dependent on the manual addition of exported symbols to the EXPERIMENTAL
section of the corresponding libraries version map file.  The consensus
on review is that, in addition to mandating the addition of symbols to
the EXPERIMENTAL version in the map, we need a mechanism to enforce our
documented process of mandating that addition when they are introduced.
To that end, I am proposing this change.  It is an addition to the
checkpatches script, which scan incoming patches for additions and
removals of symbols to the map file, and warns the user appropriately.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
2018-07-16 01:09:58 +02:00
Stephen Hemminger
22781f640e devtools: ignore SPDX warning of checkpatch
Since DPDK developers have decided to use a different tag format
than the kernel developers, ignore warnings about SPDX tags.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-06-08 21:39:15 +02:00
Olivier Matz
f83a3d3fa8 use SPDX tag for 6WIND copyrighted files
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-25 10:47:06 +02:00
Juhamatti Kuusisaari
515e92ebb6 devtools: check Linux script path if directory
Handle properly a case where the path (DPDK_PATCH_PATH
or DPDK_MAINTAINER_PATH) is set to point to a directory.

Signed-off-by: Juhamatti Kuusisaari <juhamatti.kuusisaari@coriant.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-05-23 00:33:35 +02:00
Thomas Monjalon
b4d5af2418 devtools: ignore checkpatch warning for maintainers file
The script checkpatch.pl from Linux is enforcing a tab
in the MAINTAINERS file (Linux commit 628f91a28649).
It can be ignored in our wrapper checkpatches.sh.

Suggested-by: Remy Horton <remy.horton@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Remy Horton <remy.horton@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2018-01-09 01:43:25 +01:00
Allain Legacy
cf75514c8e devtools: ignore warning on long log string
The checkpatch.pl tool is flagging warnings on long debug log strings.
Since splitting these strings makes it difficult to search for logs it is
preferred to allow these as exceptions to the long line rule.  The addition
of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
end with a string to exceed the maximum line length, but lines that end
with variables or other constructs will still be flagged as errors.  Also,
lines that make use of PRIx64 with string concatenation will still be
flagged if the beginning of the last string fragment begins after the 80
character threshold.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
2017-03-06 16:00:35 +01:00
David Hunt
3ef24b3d35 devtools: make checkpatch cleaner for renamed files
When a file is renamed, a normal diff will include all the code of
the renamed file, and checkpatch will find warnings and errors,
even though it's just a rename.

This change will result in a 'rename' line in the diff, resulting
in a much cleaner checkpatches result.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-02-21 12:24:11 +01:00
Thomas Monjalon
9a98f50e89 scripts: move to devtools
The remaining scripts in the scripts/ directory are only useful
to developers. That's why devtools/ is a better name.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-04 21:17:32 +01:00