diff options
author | dartraiden <wowemuh@gmail.com> | 2020-05-02 22:10:12 +0300 |
---|---|---|
committer | dartraiden <wowemuh@gmail.com> | 2020-05-02 22:10:12 +0300 |
commit | e963209266bbf3809cb8b44740de1b61e58f9ace (patch) | |
tree | 2ade22dff252aecfbd298b40e86b81182bba8dbc /libs/libcurl/src/checksrc.pl | |
parent | e59cb2e8ac2d6c21016f773f0f26148343a5839c (diff) |
libcurl: update to 7.70.0
Diffstat (limited to 'libs/libcurl/src/checksrc.pl')
-rw-r--r-- | libs/libcurl/src/checksrc.pl | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/libs/libcurl/src/checksrc.pl b/libs/libcurl/src/checksrc.pl index e1bb1a6339..b074f2744f 100644 --- a/libs/libcurl/src/checksrc.pl +++ b/libs/libcurl/src/checksrc.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 2011 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -80,6 +80,7 @@ my %warnings = ( 'MULTISPACE' => 'multiple spaces used when not suitable', 'SIZEOFNOPAREN' => 'use of sizeof without parentheses', 'SNPRINTF' => 'use of snprintf', + 'ONELINECONDITION' => 'conditional block on the same line as the if()', ); sub readwhitelist { @@ -457,13 +458,34 @@ sub scanfile { } } - if($nostr =~ /^((.*)(if) *\()(.*)\)/) { + if($nostr =~ /^((.*\s)(if) *\()(.*)\)(.*)/) { my $pos = length($1); - if($4 =~ / = /) { + my $postparen = $5; + my $cond = $4; + if($cond =~ / = /) { checkwarn("ASSIGNWITHINCONDITION", $line, $pos+1, $file, $l, "assignment within conditional expression"); } + my $temp = $cond; + $temp =~ s/\(//g; # remove open parens + my $openc = length($cond) - length($temp); + + $temp = $cond; + $temp =~ s/\)//g; # remove close parens + my $closec = length($cond) - length($temp); + my $even = $openc == $closec; + + if($l =~ / *\#/) { + # this is a #if, treat it differently + } + elsif($even && $postparen && + ($postparen !~ /^ *$/) && ($postparen !~ /^ *[,{&|\\]+/)) { + print STDERR "5: '$postparen'\n"; + checkwarn("ONELINECONDITION", + $line, length($l)-length($postparen), $file, $l, + "conditional block on the same line"); + } } # check spaces after open parentheses if($l =~ /^(.*[a-z])\( /i) { |