checkpatch: warn on declaration with storage class not at the beginning

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, May 25, 2010 - 9:00 am

Gitweb:     http://git.kernel.org/linus/d4977c78e9c7dd042f96f4a21d957bc25a561333
Commit:     d4977c78e9c7dd042f96f4a21d957bc25a561333
Parent:     3354957a4f8b9bb4b43625232acdf0626851c82f
Author:     Tobias Klauser <tklauser@distanz.ch>
AuthorDate: Mon May 24 14:33:30 2010 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Tue May 25 08:07:06 2010 -0700

    checkpatch: warn on declaration with storage class not at the beginning
    
    The C99 specification states in section 6.11.5:
    
    The placement of a storage-class specifier other than at the beginning
    of the declaration specifiers in a declaration is an obsolescent
    feature.
    
    Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
    Acked-by: Jean Delvare <khali@linux-fr.org>
    Cc: Andy Whitcroft <apw@shadowen.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 scripts/checkpatch.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index de0f467..bd88f11 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2601,6 +2601,11 @@ sub process {
 			CHK("architecture specific defines should be avoided\n" .  $herecurr);
 		}
 
+# Check that the storage class is at the beginning of a declaration
+		if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) {
+			WARN("storage class should be at the beginning of the declaration\n" . $herecurr)
+		}
+
 # check the location of the inline attribute, that it is between
 # storage class and type.
 		if ($line =~ /\b$Type\s+$Inline\b/ ||
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
checkpatch: warn on declaration with storage class not at ..., Linux Kernel Mailing ..., (Tue May 25, 9:00 am)