From 90f86bd0560043189ade4ae11e385474c7e14b5d Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sun, 6 Jun 2010 17:15:01 +0200 Subject: [PATCH] --- yaml --- r: 204868 b: refs/heads/master c: 74425eee71eb44c9f370bd922f72282b69bb0eab h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/MAINTAINERS | 10 ++++++ trunk/Makefile | 12 ++++--- trunk/scripts/Makefile.help | 3 ++ trunk/scripts/checkkconfigsymbols.sh | 2 +- trunk/scripts/coccicheck | 54 ++++++++++++++++++++++++++++ trunk/scripts/decodecode | 10 +++--- trunk/scripts/kconfig/.gitignore | 1 - 8 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 trunk/scripts/Makefile.help create mode 100755 trunk/scripts/coccicheck diff --git a/[refs] b/[refs] index 2b5f8d2e003d..9c23ad363ed4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b396aa03084b51f6822052a8070703287f198360 +refs/heads/master: 74425eee71eb44c9f370bd922f72282b69bb0eab diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index ce3601e5e3c8..0572b7ea5f9f 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1476,6 +1476,16 @@ M: Daniel Oliveira Nascimento S: Supported F: drivers/platform/x86/classmate-laptop.c +COCCINELLE/Semantic Patches (SmPL) +M: Julia Lawall +M: Gilles Muller +M: Nicolas Palix +L: cocci@diku.dk (moderated for non-subscribers) +W: http://coccinelle.lip6.fr/ +S: Supported +F: scripts/coccinelle/ +F: scripts/coccicheck + CODA FILE SYSTEM M: Jan Harkes M: coda@cs.cmu.edu diff --git a/trunk/Makefile b/trunk/Makefile index 46040e887d83..5a4bf98e83a5 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -412,7 +412,7 @@ endif # of make so .config is not included in this case either (for *config). no-dot-config-targets := clean mrproper distclean \ - cscope TAGS tags help %docs check% \ + cscope TAGS tags help %docs check% coccicheck \ include/linux/version.h headers_% \ kernelrelease kernelversion @@ -526,7 +526,7 @@ endif # $(dot-config) # The all: target is the default when no target is given on the # command line. # This allow a user to issue only 'make' to build a kernel including modules -# Defaults to vmlinux, but the arch makefile usually adds further targets +# Defaults vmlinux but it is usually overridden in the arch makefile all: vmlinux ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE @@ -1279,8 +1279,9 @@ help: @echo ' includecheck - Check for duplicate included header files' @echo ' export_report - List the usages of all exported symbols' @echo ' headers_check - Sanity check on exported headers' - @echo ' headerdep - Detect inclusion cycles in headers'; \ - echo '' + @echo ' headerdep - Detect inclusion cycles in headers' + @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help + @echo '' @echo 'Kernel packaging:' @$(MAKE) $(build)=$(package-dir) help @echo '' @@ -1439,6 +1440,9 @@ versioncheck: -name '*.[hcS]' -type f -print | sort \ | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl +coccicheck: + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@ + namespacecheck: $(PERL) $(srctree)/scripts/namespace.pl diff --git a/trunk/scripts/Makefile.help b/trunk/scripts/Makefile.help new file mode 100644 index 000000000000..d03608f5db04 --- /dev/null +++ b/trunk/scripts/Makefile.help @@ -0,0 +1,3 @@ + +checker-help: + @echo ' coccicheck - Check with Coccinelle.' diff --git a/trunk/scripts/checkkconfigsymbols.sh b/trunk/scripts/checkkconfigsymbols.sh index 2ca49bb31efc..46be3c5a62b7 100755 --- a/trunk/scripts/checkkconfigsymbols.sh +++ b/trunk/scripts/checkkconfigsymbols.sh @@ -14,7 +14,7 @@ find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while do # Output the bare Kconfig variable and the filename; the _MODULE part at # the end is not removed here (would need perl an not-hungry regexp for that). - sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i + sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Z_]\+\).*!\2 '$i'!p' < $i done | \ # Smart "sort|uniq" implemented in awk and tuned to collect the names of all # files which use a given symbol diff --git a/trunk/scripts/coccicheck b/trunk/scripts/coccicheck new file mode 100755 index 000000000000..037424b9ede5 --- /dev/null +++ b/trunk/scripts/coccicheck @@ -0,0 +1,54 @@ +#!/bin/sh + +SPATCH="`which ${SPATCH:=spatch}`" + +if [ ! -x "$SPATCH" ]; then + echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' + exit 1 +fi + +if [ "$MODE" = "" ] ; then + echo 'You have not explicitly specify the mode to use. Fallback to "report".' + echo 'You can specify the mode with "make coccicheck MODE="' + echo 'Available modes are: report, patch, context, org' + MODE="report" +fi + +echo '' +echo 'Please check for false positives in the output before submitting a patch.' +echo 'When using "patch" mode, carefully review the patch before submitting it.' +echo '' + +function coccinelle { + COCCI="$1" + DIR="$2" + + OPT=`grep "Option" $COCCI | cut -d':' -f2` + FILE=`echo $COCCI | sed "s|$DIR/||"` + + echo "Processing `basename $COCCI` with option(s) \"$OPT\"" + echo 'Message example to submit a patch:' + + sed -e '/\/\/\//!d' -e 's|^///||' $COCCI + + echo ' The semantic patch that makes this change is available' + echo " in $FILE." + echo '' + echo ' More information about semantic patching is available at' + echo ' http://coccinelle.lip6.fr/' + echo '' + +# The option '-parse_cocci' can be used to syntaxically check the SmPL files. +# +# $SPATCH -D $MODE -very_quiet -parse_cocci $COCCI $OPT > /dev/null + + $SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR +} + +if [ "$COCCI" = "" ] ; then + for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do + coccinelle $f $srctree; + done +else + coccinelle $COCCI $srctree +fi diff --git a/trunk/scripts/decodecode b/trunk/scripts/decodecode index 18ba881c3415..8b30cc36744f 100755 --- a/trunk/scripts/decodecode +++ b/trunk/scripts/decodecode @@ -40,7 +40,7 @@ echo $code code=`echo $code | sed -e 's/.*Code: //'` width=`expr index "$code" ' '` -width=$((($width-1)/2)) +width=$[($width-1)/2] case $width in 1) type=byte ;; 2) type=2byte ;; @@ -48,10 +48,10 @@ case $width in esac disas() { - ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1 + ${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s &> /dev/null - if [ "$ARCH" = "arm" ]; then - if [ $width -eq 2 ]; then + if [ "$ARCH" == "arm" ]; then + if [ $width == 2 ]; then OBJDUMPFLAGS="-M force-thumb" fi @@ -59,7 +59,7 @@ disas() { fi ${CROSS_COMPILE}objdump $OBJDUMPFLAGS -S $1.o | \ - grep -v "/tmp\|Disassembly\|\.text\|^$" > $1.dis 2>&1 + grep -v "/tmp\|Disassembly\|\.text\|^$" &> $1.dis } marker=`expr index "$code" "\<"` diff --git a/trunk/scripts/kconfig/.gitignore b/trunk/scripts/kconfig/.gitignore index 624f6502e03e..6a36a76e6606 100644 --- a/trunk/scripts/kconfig/.gitignore +++ b/trunk/scripts/kconfig/.gitignore @@ -17,7 +17,6 @@ gconf.glade.h # conf mconf -nconf qconf gconf kxgettext