mirror of
https://github.com/curl/curl.git
synced 2026-08-25 22:33:34 +03:00
scripts: enable strict warnings in Perl where missing, fix fallouts
- add 'use warnings' and 'use strict' where missing from Perl scripts. - fix 'Use of uninitialized value'. - fix missing declarations. - test1140.pl: fix 'Possible precedence issue with control flow operator'. - fix other misc issues. Most actual errors found during this PR were fixed and merged via separate PRs. Likely there are remaining warnings not found and fixed in this PR. Closes #17877
This commit is contained in:
parent
89771d19d5
commit
2ec54556d4
45 changed files with 323 additions and 97 deletions
|
|
@ -22,9 +22,14 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
# populate the has %pastversion hash table with the version number as key and
|
||||
# populate the %pastversion hash table with the version number as key and
|
||||
# release date as value
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our %pastversion;
|
||||
|
||||
sub allversions {
|
||||
my ($file) = @_;
|
||||
open(A, "<$file") ||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
#
|
||||
#***************************************************************************
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# This script invokes nghttpx properly to have it serve HTTP/2 for us.
|
||||
# nghttpx runs as a proxy in front of our "actual" HTTP/1 server.
|
||||
use Cwd;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
#
|
||||
#***************************************************************************
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# This script invokes nghttpx properly to have it serve HTTP/3 for us.
|
||||
# nghttpx runs as a proxy in front of our "actual" HTTP/1 server.
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Usage:
|
||||
# perl mk-lib1521.pl < ../../include/curl/curl.h lib1521.c
|
||||
|
|
@ -363,6 +365,8 @@ static CURLcode test_lib1521(char *URL)
|
|||
HEADER
|
||||
;
|
||||
|
||||
my $infomode = 0;
|
||||
|
||||
while(<STDIN>) {
|
||||
s/^\s*(.*?)\s*$/$1/; # Trim.
|
||||
# Remove multi-line comment trail.
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Determine if curl-config --protocols/--features matches the
|
||||
# curl --version protocols/features
|
||||
if($#ARGV != 2) {
|
||||
|
|
@ -41,7 +44,7 @@ close CURL;
|
|||
|
||||
$curl_protocols =~ s/\r//;
|
||||
$curl_protocols =~ /\w+: (.*)$/;
|
||||
@curl = split / /,$1;
|
||||
my @curl = split / /,$1;
|
||||
|
||||
# Read the output of curl-config
|
||||
my @curl_config;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Determine if curl-config --version matches the curl --version
|
||||
if($#ARGV != 2) {
|
||||
print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
|
||||
|
|
|
|||
|
|
@ -22,12 +22,15 @@
|
|||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Determine if the given curl executable supports the 'openssl' SSL engine
|
||||
if($#ARGV != 0) {
|
||||
print "Usage: $0 curl-executable\n";
|
||||
exit 3;
|
||||
}
|
||||
if(!open(CURL, "@ARGV[0] -s --engine list|")) {
|
||||
if(!open(CURL, "$ARGV[0] -s --engine list|")) {
|
||||
print "Can't get SSL engine list\n";
|
||||
exit 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Perform simple file and directory manipulation in a portable way
|
||||
if($#ARGV <= 0) {
|
||||
print "Usage: $0 mkdir|rmdir|rm|move|gone path1 [path2] [more commands...]\n";
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Prepare a directory with known files and clean up afterwards
|
||||
use Time::Local;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,17 +29,22 @@
|
|||
# MEM mprintf.c:1103 realloc(e5718, 64) = e6118
|
||||
# MEM sendf.c:232 free(f6520)
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $mallocs=0;
|
||||
my $callocs=0;
|
||||
my $reallocs=0;
|
||||
my $strdups=0;
|
||||
my $wcsdups=0;
|
||||
my $showlimit;
|
||||
my $showlimit=0;
|
||||
my $sends=0;
|
||||
my $recvs=0;
|
||||
my $sockets=0;
|
||||
my $verbose=0;
|
||||
my $trace=0;
|
||||
|
||||
while(1) {
|
||||
while(@ARGV) {
|
||||
if($ARGV[0] eq "-v") {
|
||||
$verbose=1;
|
||||
shift @ARGV;
|
||||
|
|
@ -70,7 +75,7 @@ sub newtotal {
|
|||
}
|
||||
}
|
||||
|
||||
my $file = $ARGV[0];
|
||||
my $file = $ARGV[0] || '';
|
||||
|
||||
if(! -f $file) {
|
||||
print "Usage: memanalyze.pl [options] <dump file>\n",
|
||||
|
|
@ -94,11 +99,36 @@ if($showlimit) {
|
|||
exit;
|
||||
}
|
||||
|
||||
my %sizeataddr;
|
||||
my %getmem;
|
||||
|
||||
my $lnum=0;
|
||||
my $totalmem = 0;
|
||||
my $frees = 0;
|
||||
|
||||
my $dup;
|
||||
my $size;
|
||||
my $addr;
|
||||
|
||||
my %filedes;
|
||||
my %getfile;
|
||||
|
||||
my %fopen;
|
||||
my %fopenfile;
|
||||
my $openfile = 0;
|
||||
my $fopens = 0;
|
||||
|
||||
my %addrinfo;
|
||||
my %addrinfofile;
|
||||
my $addrinfos = 0;
|
||||
|
||||
my $source;
|
||||
my $linenum;
|
||||
my $function;
|
||||
|
||||
my $lnum = 0;
|
||||
while(<$fileh>) {
|
||||
chomp $_;
|
||||
$line = $_;
|
||||
my $line = $_;
|
||||
$lnum++;
|
||||
if($line =~ /^LIMIT ([^ ]*):(\d*) (.*)/) {
|
||||
# new memory limit test prefix
|
||||
|
|
@ -145,13 +175,13 @@ while(<$fileh>) {
|
|||
$size = $1;
|
||||
$addr = $2;
|
||||
|
||||
if($sizeataddr{$addr}>0) {
|
||||
if($sizeataddr{$addr} && $sizeataddr{$addr}>0) {
|
||||
# this means weeeeeirdo
|
||||
print "Mixed debug compile ($source:$linenum at line $lnum), rebuild curl now\n";
|
||||
print "We think $sizeataddr{$addr} bytes are already allocated at that memory address: $addr!\n";
|
||||
}
|
||||
|
||||
$sizeataddr{$addr}=$size;
|
||||
$sizeataddr{$addr} = $size;
|
||||
$totalmem += $size;
|
||||
$memsum += $size;
|
||||
|
||||
|
|
@ -169,8 +199,8 @@ while(<$fileh>) {
|
|||
$size = $1*$2;
|
||||
$addr = $3;
|
||||
|
||||
$arg1 = $1;
|
||||
$arg2 = $2;
|
||||
my $arg1 = $1;
|
||||
my $arg2 = $2;
|
||||
|
||||
if($sizeataddr{$addr}>0) {
|
||||
# this means weeeeeirdo
|
||||
|
|
|
|||
|
|
@ -1722,7 +1722,7 @@ sub singletest_check {
|
|||
$ok .= "m";
|
||||
}
|
||||
my @more=`$memanalyze -v "$logdir/$MEMDUMP"`;
|
||||
my $allocs;
|
||||
my $allocs = 0;
|
||||
my $max = 0;
|
||||
for(@more) {
|
||||
if(/^Allocations: (\d+)/) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@
|
|||
# scan manpages to find basic syntactic problems such as unbalanced \f
|
||||
# codes or references to non-existing curl manpages.
|
||||
|
||||
my $docsroot = $ARGV[0];
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $docsroot = $ARGV[0] || '.';
|
||||
|
||||
if(!$docsroot || ($docsroot eq "-g")) {
|
||||
print "Usage: test1140.pl <docs root dir> [manpages]\n";
|
||||
|
|
@ -40,6 +43,8 @@ my @f = @ARGV;
|
|||
|
||||
my %manp;
|
||||
|
||||
my $errors = 0;
|
||||
|
||||
sub manpresent {
|
||||
my ($man) = @_;
|
||||
if($manp{$man}) {
|
||||
|
|
@ -111,4 +116,4 @@ foreach my $f (@f) {
|
|||
|
||||
print "OK\n" if(!$errors);
|
||||
|
||||
exit $errors?1:0;
|
||||
exit ($errors ? 1 : 0);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
# we may get the dir root pointed out
|
||||
my $root=$ARGV[0] || ".";
|
||||
my $root = $ARGV[0] || ".";
|
||||
|
||||
my %error; # from the include file
|
||||
my %docs; # from libcurl-errors.3
|
||||
|
|
|
|||
|
|
@ -23,11 +23,14 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $root=$ARGV[0] || "..";
|
||||
|
||||
my @m = `git ls-files -- $root`;
|
||||
|
||||
my $errors;
|
||||
my $errors = 0;
|
||||
|
||||
my %accepted=('curl' => 1,
|
||||
'libcurl' => 1,
|
||||
|
|
@ -45,7 +48,7 @@ sub checkfile {
|
|||
}
|
||||
open(my $fh, "<", "$f");
|
||||
my $l;
|
||||
my $prevl;
|
||||
my $prevl = '';
|
||||
my $ignore = 0;
|
||||
my $metadata = 0;
|
||||
while(<$fh>) {
|
||||
|
|
|
|||
|
|
@ -23,13 +23,16 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub showline {
|
||||
my ($l) = @_;
|
||||
$l =~ s/([^\x20-\x7f])/sprintf "%%%02x", ord $1/eg;
|
||||
return $l;
|
||||
}
|
||||
|
||||
my $root = $ARGV[0];
|
||||
my $root = $ARGV[0] || '..';
|
||||
|
||||
open(my $fh, "-|", "perl $root/lib/optiontable.pl < $root/include/curl/curl.h");
|
||||
binmode $fh;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
# a late evening in the #curl IRC channel.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use vars qw($Cpreprocessor);
|
||||
use allversions;
|
||||
|
|
@ -52,7 +53,7 @@ my $root=$ARGV[0] || ".";
|
|||
|
||||
# need an include directory when building out-of-tree
|
||||
my $i = ($ARGV[1]) ? "-I$ARGV[1] " : '';
|
||||
my $error;
|
||||
my $error = 0;
|
||||
|
||||
my $versions = $ARGV[2];
|
||||
|
||||
|
|
@ -60,6 +61,8 @@ my @syms;
|
|||
my %manpage;
|
||||
my %symadded;
|
||||
|
||||
our %pastversion;
|
||||
|
||||
sub checkmanpage {
|
||||
my ($m) = @_;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ while(<R>) {
|
|||
}
|
||||
close(R);
|
||||
|
||||
my $error;
|
||||
my $error = 0;
|
||||
if(scalar(@curlout) != scalar(@txtout)) {
|
||||
printf "curl -h $opt is %d lines, $txt says %d lines\n",
|
||||
scalar(@curlout), scalar(@txtout);
|
||||
|
|
|
|||
|
|
@ -29,12 +29,19 @@
|
|||
# $cmddir
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use allversions;
|
||||
|
||||
my $opts = $ARGV[0];
|
||||
my $cmddir = $ARGV[1];
|
||||
my $versions = $ARGV[2];
|
||||
|
||||
my %file;
|
||||
my %oiv;
|
||||
my $error = 0;
|
||||
|
||||
sub cmdfiles {
|
||||
my ($dir)=@_;
|
||||
|
||||
|
|
@ -93,6 +100,8 @@ sub versioncheck {
|
|||
close($fh);
|
||||
}
|
||||
|
||||
our %pastversion;
|
||||
|
||||
# get all the past versions
|
||||
allversions($versions);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Cwd;
|
||||
use File::Spec;
|
||||
|
|
@ -76,6 +77,9 @@ use vars qw($name $email $desc $confopts $runtestopts $setupfile $mktarball
|
|||
$extvercmd $nogitpull $nobuildconf $crosscompile
|
||||
$timestamp $notes);
|
||||
|
||||
$notes='';
|
||||
$runtestopts='';
|
||||
|
||||
# version of this script
|
||||
$version='2024-11-28';
|
||||
$fixed=0;
|
||||
|
|
@ -338,20 +342,20 @@ logit "DESC = $desc";
|
|||
logit "NOTES = $notes";
|
||||
logit "CONFOPTS = $confopts";
|
||||
logit "RUNTESTOPTS = ".$runtestopts;
|
||||
logit "CPPFLAGS = ".$ENV{CPPFLAGS};
|
||||
logit "CFLAGS = ".$ENV{CFLAGS};
|
||||
logit "LDFLAGS = ".$ENV{LDFLAGS};
|
||||
logit "LIBS = ".$ENV{LIBS};
|
||||
logit "CC = ".$ENV{CC};
|
||||
logit "TMPDIR = ".$ENV{TMPDIR};
|
||||
logit "MAKEFLAGS = ".$ENV{MAKEFLAGS};
|
||||
logit "ACLOCAL_FLAGS = ".$ENV{ACLOCAL_FLAGS};
|
||||
logit "PKG_CONFIG_PATH = ".$ENV{PKG_CONFIG_PATH};
|
||||
logit "DYLD_LIBRARY_PATH = ".$ENV{DYLD_LIBRARY_PATH};
|
||||
logit "LD_LIBRARY_PATH = ".$ENV{LD_LIBRARY_PATH};
|
||||
logit "LIBRARY_PATH = ".$ENV{LIBRARY_PATH};
|
||||
logit "SHLIB_PATH = ".$ENV{SHLIB_PATH};
|
||||
logit "LIBPATH = ".$ENV{LIBPATH};
|
||||
logit "CPPFLAGS = ".($ENV{CPPFLAGS} || '');
|
||||
logit "CFLAGS = ".($ENV{CFLAGS} || '');
|
||||
logit "LDFLAGS = ".($ENV{LDFLAGS} || '');
|
||||
logit "LIBS = ".($ENV{LIBS} || '');
|
||||
logit "CC = ".($ENV{CC} || '');
|
||||
logit "TMPDIR = ".($ENV{TMPDIR} || '');
|
||||
logit "MAKEFLAGS = ".($ENV{MAKEFLAGS} || '');
|
||||
logit "ACLOCAL_FLAGS = ".($ENV{ACLOCAL_FLAGS} || '');
|
||||
logit "PKG_CONFIG_PATH = ".($ENV{PKG_CONFIG_PATH} || '');
|
||||
logit "DYLD_LIBRARY_PATH = ".($ENV{DYLD_LIBRARY_PATH} || '');
|
||||
logit "LD_LIBRARY_PATH = ".($ENV{LD_LIBRARY_PATH} || '');
|
||||
logit "LIBRARY_PATH = ".($ENV{LIBRARY_PATH} || '');
|
||||
logit "SHLIB_PATH = ".($ENV{SHLIB_PATH} || '');
|
||||
logit "LIBPATH = ".($ENV{LIBPATH} || '');
|
||||
logit "target = ".$targetos;
|
||||
logit "version = $version"; # script version
|
||||
logit "date = $timestamp"; # When the test build starts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue