git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v1] travis-ci: override CFLAGS properly, add -Wdeclaration-after-statement

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 9, 2016, 17:47 UTC
Message-ID
<xmqqlh6t4vya.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160209173622.GA28699@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> Perhaps. I'm not sure that people actually use checkpatch.pl for git.
>
> Out of curiosity, I tried:
>
>   mkdir out
>   git format-patch -o out v2.6.0..v2.7.0
>   checkpatch.pl out/*
>
> It's rather noisy, and after skimming, I'd say (subjectively) that only
> a small fraction are actual style issues we try to enforce. So it would
> certainly need a fair bit of tweaking for regular use, I think.
>
> -Peff

FWIW, I use the attached (it assumes a recent kernel checkout at certain location and checkpatch-original.pl being a symlink to it) occasionally. I found patches from some people are consistently clean and suspect they may be running checkpatch themselves.

-- >8 -- Meta/CP (not on 'todo' branch) -- >8 -- #!/bin/sh

# Run checkpatch on the series Meta=$(git rev-parse --show-cdup)Meta cp0="$Meta/checkpatch-original.pl" cp1="$Meta/checkpatch.pl" tmp="/var/tmp/CP.$$"

mkdir "$tmp" || exit trap 'rm -fr "$tmp"' 0

if	! test -f "$cp1" ||
	test "$cp0" -nt "$cp1"
then
	cat "$cp0" >"$cp1" &&
	(cd "$Meta" &&
patch -p1 <<\EOF
--- a/checkpatch.pl
+++ b/checkpatch.pl
@@ -282,6 +282,8 @@
 	Reviewed-by:|
 	Reported-by:|
 	Suggested-by:|
+	Helped-by:|
+	Mentored-by:|
 	To:|
 	Cc:
 )};
@@ -2338,7 +2340,7 @@
 
 # check for new typedefs, only function parameters and sparse annotations
 # make sense.
-		if ($line =~ /\btypedef\s/ &&
+		if (0 && $line =~ /\btypedef\s/ &&
 		    $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
 		    $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
 		    $line !~ /\b$typeTypedefs\b/ &&
@@ -2607,8 +2609,7 @@
 
 				# No spaces for:
 				#   ->
-				#   :   when part of a bitfield
-				} elsif ($op eq '->' || $opv eq ':B') {
+				} elsif ($op eq '->') {
 					if ($ctx =~ /Wx.|.xW/) {
 						ERROR("SPACING",
 						      "spaces prohibited around that '$op' $at\n" . $hereptr);

EOF
)
fi || exit

cat "$@" | git mailsplit -b -o"$tmp" >/dev/null

for mail in "$tmp"/*
do
	(
		git mailinfo -k "$mail.msg" "$mail.patch" >"$mail.info" <"$mail"
		echo
		cat "$mail.msg"
		printf "%s\n" -- "---"
		cat "$mail.patch"
	) >"$mail.mbox"
	perl "$Meta/checkpatch.pl" $ignore --no-tree --max-line-length=120 "$mail.mbox" || {
		grep "Subject: " "$mail.info"
		printf "%s\n" -- "------------------------------------------------"
	}
done
Previous: Jeff KingNext: Ramsay Jones
Message 5 of 10 in “travis-ci: override CFLAGS properly, add -Wdeclaration-after-statement”
  1. travis-ci: override CFLAGS properly, add -Wdeclaration-after-statementlarsxschneider@gmail.com, Feb 8, 2016
  2. Jeff KingFeb 8, 2016
  3. Lars SchneiderFeb 9, 2016
  4. Jeff KingFeb 9, 2016
  5. Junio C HamanoFeb 9, 2016
  6. Ramsay JonesFeb 9, 2016
  7. Junio C HamanoFeb 9, 2016
  8. Stefan BellerFeb 9, 2016
  9. Roberto TyleyFeb 9, 2016
  10. Junio C HamanoFeb 9, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.