Re: [PATCH] scripts:checkpatch - correct the error message during check

From: Joe Perches
Date: Fri Jun 05 2015 - 11:16:09 EST


On Fri, 2015-06-05 at 19:25 +0530, Shailendra Verma wrote:
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3169,21 +3169,21 @@ sub process {
> }
>
> # check for global initialisers.
> - if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) {
> + if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0x0|0|NULL|false)\s*;/) {
> if (ERROR("GLOBAL_INITIALISERS",
> - "do not initialise globals to 0 or NULL\n" .
> + "do not initialise globals to $2\n" .

The first capture group in the old and broken regex
was unnecessary and was removed so s/$2/$1/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/