]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: warn on space after exclamation mark
authorDaniel Stenberg <daniel@haxx.se>
Fri, 2 Oct 2020 08:58:52 +0000 (10:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 2 Oct 2020 14:35:53 +0000 (16:35 +0200)
Closes #6034

lib/checksrc.pl
lib/inet_pton.c
lib/mprintf.c
src/tool_easysrc.c
src/tool_setopt.c
tests/libtest/lib505.c
tests/libtest/lib541.c

index c47aaf0f55c590d232b8198667b460c1fc338a11..f9d076a2f8e2c877e22907f16fd248f70e5e2ed3 100755 (executable)
@@ -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
index 9c87a05620f83f32e547c2e9661df8c2fe9e48db..4923cae245faee1d666384ac6baeefb6655fd05d 100644 (file)
@@ -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;
index 8f0011e91199433bcf3bfd36834378accafb1907..6aceadc96fcc3fe80bd823e5cbd79d9d67573f33 100644 (file)
@@ -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(' ');
         }
index bb1a135d818a3a6c593f5031e9a57f261ab3ac57..7343f7d1593745d482f58db4ac5042b87f21441b 100644 (file)
@@ -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 {
index 02f30572954bf99a40ec40585c27a9b651731df7..0dd7a57a2d041df5ef5fbba5aabe10e78a08322f 100644 (file)
@@ -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. */
index cc7463bdefe28d7f62c57acab04a1444869b932e..42e0eec412578777bdf66cff11ea97938b485fed 100644 (file)
@@ -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;
index bcbaa481c3d59bb31f11cc2f723c7c200e8093fb..57d7204127edbcb4d1f7e7db34c8c3ad628c77ae 100644 (file)
@@ -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;