]> granicus.if.org Git - curl/commitdiff
curl-compilers: enable -Wimplicit-fallthrough=4 for GCC
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Mon, 9 Jul 2018 16:52:05 +0000 (18:52 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Tue, 21 Aug 2018 16:53:45 +0000 (18:53 +0200)
This enables level 4 instead of the default level 3, which of the
currently used comments only allows /* FALLTHROUGH */ to silence the
warning.

Closes https://github.com/curl/curl/pull/2747

lib/formdata.c
lib/http_ntlm.c
lib/ssh.c
lib/telnet.c
lib/transfer.c
m4/curl-compilers.m4
src/tool_getparam.c
src/tool_urlglob.c

index 450a0e5d8e02b40db7e0d9e2264707d8da526d40..202d930c70c936b829e6c05d0c3fd82bbdc4277f 100644 (file)
@@ -302,7 +302,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
        * Set the contents property.
        */
     case CURLFORM_PTRCONTENTS:
-      current_form->flags |= HTTPPOST_PTRCONTENTS; /* fall through */
+      current_form->flags |= HTTPPOST_PTRCONTENTS;
+      /* FALLTHROUGH */
     case CURLFORM_COPYCONTENTS:
       if(current_form->value)
         return_value = CURL_FORMADD_OPTION_TWICE;
index fd5540b5d06025c35fd4761060f87b0ea2b30d3b..a9b33f98e45cb3047ae01031a6ced33af4a9ba91 100644 (file)
@@ -228,7 +228,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy)
     /* connection is already authenticated,
      * don't send a header in future requests */
     ntlm->state = NTLMSTATE_LAST;
-    /* fall-through */
+    /* FALLTHROUGH */
   case NTLMSTATE_LAST:
     Curl_safefree(*allocuserpwd);
     authp->done = TRUE;
index 98153040b7ba46d9b1017f65e5ed7283f6da1427..5d81f649c11520e9cb622c7745f4260a5de7c624 100644 (file)
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -659,7 +659,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
       libssh2_session_set_blocking(sshc->ssh_session, 0);
 
       state(conn, SSH_S_STARTUP);
-      /* fall-through */
+      /* FALLTHROUGH */
 
     case SSH_S_STARTUP:
       rc = libssh2_session_startup(sshc->ssh_session, (int)sock);
@@ -675,7 +675,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
 
       state(conn, SSH_HOSTKEY);
 
-      /* fall-through */
+      /* FALLTHROUGH */
     case SSH_HOSTKEY:
       /*
        * Before we authenticate we should check the hostkey's fingerprint
index 031d61f4e653205b3b72ae37677dc73b2365f26e..05fe744dbd429a5171bab692c5801c70e2c868a5 100644 (file)
@@ -1606,7 +1606,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
     case 0:                     /* timeout */
       pfd[0].revents = 0;
       pfd[1].revents = 0;
-      /* fall through */
+      /* FALLTHROUGH */
     default:                    /* read! */
       if(pfd[0].revents & POLLIN) {
         /* read data from network */
index ab9094adc0698b65bbf1baaf264d8d01615398dc..2982087034eacfa4556a85dbaef5dee7abe9f477 100644 (file)
@@ -1519,7 +1519,7 @@ static size_t strlen_url(const char *url, bool relative)
     switch(*ptr) {
     case '?':
       left = FALSE;
-      /* fall through */
+      /* FALLTHROUGH */
     default:
       if(urlchar_needs_escaping(*ptr))
         newlen += 2;
@@ -1564,7 +1564,7 @@ static void strcpy_url(char *output, const char *url, bool relative)
     switch(*iptr) {
     case '?':
       left = FALSE;
-      /* fall through */
+      /* FALLTHROUGH */
     default:
       if(urlchar_needs_escaping(*iptr)) {
         snprintf(optr, 4, "%%%02x", *iptr);
index 63e45f3e0e4636777210db9db803ee798e839a67..95afae42609681702363ae0084a441fe449fcfeb 100644 (file)
@@ -1060,6 +1060,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
             tmp_CFLAGS="$tmp_CFLAGS -Walloc-zero"
             tmp_CFLAGS="$tmp_CFLAGS -Wformat-overflow=2"
             tmp_CFLAGS="$tmp_CFLAGS -Wformat-truncation=2"
+            tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough=4"
           fi
           #
         fi
index 0093af0a3449c1799665b9cbd49f3cca53df546a..aad147148c66fb5f0a222d1501c068c95c71b382 100644 (file)
@@ -1834,7 +1834,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         config->default_node_flags = toggle?GETOUT_USEREMOTE:0;
         break;
       }
-      /* fall-through! */
+      /* FALLTHROUGH */
     case 'o': /* --output */
       /* output file */
     {
index 2848d44e1c579155774a4aeb26d670fd4c90dbe4..e1b994108675934d73ef636a538ff67866bdde1b 100644 (file)
@@ -114,7 +114,7 @@ static CURLcode glob_set(URLGlob *glob, char **patternp,
       if(multiply(amount, pat->content.Set.size + 1))
         return GLOBERROR("range overflow", 0, CURLE_URL_MALFORMAT);
 
-      /* fall-through */
+      /* FALLTHROUGH */
     case ',':
 
       *buf = '\0';
@@ -157,7 +157,7 @@ static CURLcode glob_set(URLGlob *glob, char **patternp,
         ++pattern;
         ++(*posp);
       }
-      /* intentional fallthrough */
+      /* FALLTHROUGH */
     default:
       *buf++ = *pattern++;              /* copy character to set element */
       ++(*posp);