summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-10-02 10:58:52 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-10-02 16:35:53 +0200
commit26a7d51c21bce00e332bbd10443594edb879a871 (patch)
treed10c7901ebd1a7133f66bbd4e5a49e1120b1b6af
parentddecd28268b78ae3361bc010c719446d55a8f894 (diff)
downloadcurl-26a7d51c21bce00e332bbd10443594edb879a871.tar.gz
checksrc: warn on space after exclamation mark
Closes #6034
-rwxr-xr-xlib/checksrc.pl7
-rw-r--r--lib/inet_pton.c4
-rw-r--r--lib/mprintf.c2
-rw-r--r--src/tool_easysrc.c4
-rw-r--r--src/tool_setopt.c4
-rw-r--r--tests/libtest/lib505.c4
-rw-r--r--tests/libtest/lib541.c4
7 files changed, 18 insertions, 11 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index c47aaf0f5..f9d076a2f 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -84,6 +84,7 @@ my %warnings = (
'TYPEDEFSTRUCT' => 'typedefed struct',
'DOBRACE' => 'A single space between do and open brace',
'BRACEWHILE' => 'A single space between open brace and while',
+ 'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
);
sub readskiplist {
@@ -725,6 +726,12 @@ sub scanfile {
"typedef'ed struct");
}
+ if($nostr =~ /(.*)! +(\w|\()/) {
+ checkwarn("EXCLAMATIONSPACE",
+ $line, length($1)+1, $file, $ol,
+ "space after exclamation mark");
+ }
+
# check for more than one consecutive space before open brace or
# question mark. Skip lines containing strings since they make it hard
# due to artificially getting multiple spaces
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index 9c87a0562..4923cae24 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -1,6 +1,6 @@
/* This is from the BIND 4.9.4 release, modified to compile by itself */
-/* Copyright (c) 1996 - 2019 by Internet Software Consortium.
+/* Copyright (c) 1996 - 2020 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -112,7 +112,7 @@ inet_pton4(const char *src, unsigned char *dst)
if(val > 255)
return (0);
*tp = (unsigned char)val;
- if(! saw_digit) {
+ if(!saw_digit) {
if(++octets > 4)
return (0);
saw_digit = 1;
diff --git a/lib/mprintf.c b/lib/mprintf.c
index 8f0011e91..6aceadc96 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -878,7 +878,7 @@ static int dprintf_formatf(
OUTCHAR(' ');
for(point = strnil; *point != '\0'; ++point)
OUTCHAR(*point);
- if(! (p->flags & FLAGS_LEFT))
+ if(!(p->flags & FLAGS_LEFT))
while(width-- > 0)
OUTCHAR(' ');
}
diff --git a/src/tool_easysrc.c b/src/tool_easysrc.c
index bb1a135d8..7343f7d15 100644
--- a/src/tool_easysrc.c
+++ b/src/tool_easysrc.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -113,7 +113,7 @@ CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...)
va_start(ap, fmt);
bufp = curlx_mvaprintf(fmt, ap);
va_end(ap);
- if(! bufp) {
+ if(!bufp) {
ret = CURLE_OUT_OF_MEMORY;
}
else {
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
index 02f305729..0dd7a57a2 100644
--- a/src/tool_setopt.c
+++ b/src/tool_setopt.c
@@ -267,7 +267,7 @@ static char *c_escape(const char *str, curl_off_t len)
strcpy(e, "\\\"");
e += 2;
}
- else if(! isprint(c)) {
+ else if(!isprint(c)) {
msnprintf(e, 5, "\\x%02x", (unsigned)c);
e += 4;
}
@@ -299,7 +299,7 @@ CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
if(nv->value == lval)
break; /* found it */
}
- if(! nv->name) {
+ if(!nv->name) {
/* If no definition was found, output an explicit value.
* This could happen if new values are defined and used
* but the NameValue list is not updated. */
diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c
index cc7463bde..42e0eec41 100644
--- a/tests/libtest/lib505.c
+++ b/tests/libtest/lib505.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -71,7 +71,7 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- if(! file_info.st_size) {
+ if(!file_info.st_size) {
fprintf(stderr, "ERROR: file %s has zero size!\n", libtest_arg2);
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c
index bcbaa481c..57d720412 100644
--- a/tests/libtest/lib541.c
+++ b/tests/libtest/lib541.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -63,7 +63,7 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- if(! file_info.st_size) {
+ if(!file_info.st_size) {
fprintf(stderr, "ERROR: file %s has zero size!\n", libtest_arg2);
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;