From 24082ad09e0a5d81bccef33a0ad4f3cd2c75c1f9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 11 Jul 2018 09:56:21 +0200 Subject: [PATCH] checkpatch: check against using "unsigned int" and "$INT_TYPE unsigned|signed" Don't use the integer type before signed/unsigned, but the other way around. That is, unsigned long var; instead of long unsigned var; Also, just use "unsigned" instead of "unsigned int". --- contrib/scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index 6b1e766fc6..aa791dc214 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -121,6 +121,8 @@ next if $filename =~ /\/nm-[^\/]+-enum-types\.[ch]$/; complain ('Tabs are only allowed at the beginning of a line') if $line =~ /[^\t]\t/; complain ('Trailing whitespace') if $line =~ /[ \t]$/; complain ('Don\'t use glib typedefs for char/short/int/long/float/double') if $line =~ /\bg(char|short|int|long|float|double)\b/; +complain ("Don't use \"$1 $2\" instead of \"$2 $1\"") if $line =~ /\b(char|short|int|long) +(unsigned|signed)\b/; +complain ("Don't use \"unsigned int\" but just use \"unsigned\"") if $line =~ /\b(unsigned) +(int)\b/; # Further on we process stuff without comments. $_ = $line;