aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2018-07-09 18:52:05 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2018-08-21 18:53:45 +0200
commit15ed9f87e3a1f91bd7b4a5291edf268b843e5987 (patch)
tree7dd8ff713e570a7b216f4e675357e3dbb4a62aa8
parent60776a0515c2a8f572902ad5bcc9f63eeaeafa84 (diff)
curl-compilers: enable -Wimplicit-fallthrough=4 for GCC
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
-rw-r--r--lib/formdata.c3
-rw-r--r--lib/http_ntlm.c2
-rw-r--r--lib/ssh.c4
-rw-r--r--lib/telnet.c2
-rw-r--r--lib/transfer.c4
-rw-r--r--m4/curl-compilers.m41
-rw-r--r--src/tool_getparam.c2
-rw-r--r--src/tool_urlglob.c4
8 files changed, 12 insertions, 10 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index 450a0e5d8..202d930c7 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -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;
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index fd5540b5d..a9b33f98e 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -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;
diff --git a/lib/ssh.c b/lib/ssh.c
index 98153040b..5d81f649c 100644
--- 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
diff --git a/lib/telnet.c b/lib/telnet.c
index 031d61f4e..05fe744db 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -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 */
diff --git a/lib/transfer.c b/lib/transfer.c
index ab9094adc..298208703 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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);
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index 63e45f3e0..95afae426 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -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
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 0093af0a3..aad147148 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -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 */
{
diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c
index 2848d44e1..e1b994108 100644
--- a/src/tool_urlglob.c
+++ b/src/tool_urlglob.c
@@ -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);