The regexp part of the cleanup routine was not updated accordingly when
a common prefix for temp files was introduced.
Set the trap handler only when required.
Fixes: ff37ca5d37 ("devtools: use a common prefix for temporary files")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
- As "readlink -e" and "readlink -m" do not exist on freebsd,
use "readlink -f", it should not have any impact in these cases.
- "sed -ri" is invalid on freebsd and should be replaced by
"sed -ri=''"
- Use gmake instead of make.
This fixes the following command:
SYSDIR=/usr/src/sys ./devtools/test-build.sh \
-j4 x86_64-native-freebsd-gcc
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Add the ability to pass custom options to checkpatch script. An example
of use is to change the output format so it can run in emacs compilation
mode:
DPDK_CHECKPATCH_PATH=/path/to/linux/scripts/checkpatch.pl \
DPDK_CHECKPATCH_OPTIONS='--emacs --showfile --no-color' \
/path/to/dpdk.org/devtools/checkpatches.sh
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>