aboutsummaryrefslogtreecommitdiff
path: root/lib/checksrc.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-17 13:41:49 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-17 13:57:37 +0100
commit9395999543eaad251d61a83b50f461cc29884cd2 (patch)
tree4213f0e89d018bb7ab517a03a8f1e337e4e032cf /lib/checksrc.pl
parenta6b8fe2a5f6f18bd1a6fd0767a961fa1e87aba3e (diff)
checksrc: use space after comma
Diffstat (limited to 'lib/checksrc.pl')
-rwxr-xr-xlib/checksrc.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index c4174709b..cd4314b51 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -154,6 +154,38 @@ sub scanfile {
"return without space before paren");
}
}
+
+ # check for comma without space
+ if($l =~ /^(.*),[^ \n]/) {
+ my $pref=$1;
+ my $ign=0;
+ if($pref =~ / *\#/) {
+ # this is a #if, treat it differently
+ $ign=1;
+ }
+ elsif($pref =~ /\/\*/) {
+ # this is a comment
+ $ign=1;
+ }
+ elsif($pref =~ /[\"\']/) {
+ $ign = 1;
+ # There is a quote here, figure out whether the comma is
+ # within a string or '' or not.
+ if($pref =~ /\"/) {
+ # withing a string
+ }
+ elsif($pref =~ /\'$/) {
+ # a single letter
+ }
+ else {
+ $ign = 0;
+ }
+ }
+ if(!$ign) {
+ checkwarn($line, length($pref)+1, $file, $l,
+ "comma without following space");
+ }
+ }
# check for "} else"
if($l =~ /^(.*)\} *else/) {