Use G_GNUC_FALLTHROUGH where appropriate

This commit is contained in:
Benjamin Otte 2018-09-02 20:47:32 +02:00
parent 95477a4e35
commit 3aff811d13
8 changed files with 21 additions and 7 deletions

View File

@ -166,9 +166,11 @@ test_data_array (guchar *buffer, gsize len,
case TEST_DATA_INT16:
case TEST_DATA_UINT16:
g_assert_cmpint (len % 2, ==, 0);
G_GNUC_FALLTHROUGH;
case TEST_DATA_INT32:
case TEST_DATA_UINT32:
g_assert_cmpint (len % 4, ==, 0);
G_GNUC_FALLTHROUGH;
case TEST_DATA_INT64:
case TEST_DATA_UINT64:
g_assert_cmpint (len % 8, ==, 0);

View File

@ -33,12 +33,14 @@ cook_piece (void)
{
case 26:
buffer[i++] = '\n';
G_GNUC_FALLTHROUGH;
case 27:
buffer[i++] = '\r';
break;
case 28:
buffer[i++] = '\r';
G_GNUC_FALLTHROUGH;
case 29:
buffer[i++] = '\n';
break;

View File

@ -170,8 +170,11 @@ g_base64_encode_step (const guchar *in,
/* len can only be 0 1 or 2 */
switch(len)
{
case 2: *saveout++ = *inptr++;
case 1: *saveout++ = *inptr++;
case 2:
*saveout++ = *inptr++;
G_GNUC_FALLTHROUGH;
case 1:
*saveout++ = *inptr++;
}
((char *)save)[0] += len;
}

View File

@ -788,7 +788,8 @@ g_convert_with_fallback (const gchar *str,
inbytes_remaining = strlen (p);
break;
}
/* fall thru if p is NULL */
/* if p is null */
G_GNUC_FALLTHROUGH;
default:
{
int errsv = errno;

View File

@ -2872,6 +2872,8 @@ failure:
case G_MARKUP_COLLECT_STRDUP:
if (written)
g_free (*(char **) ptr);
*(char **) ptr = NULL;
break;
case G_MARKUP_COLLECT_STRING:
*(char **) ptr = NULL;

View File

@ -2537,6 +2537,7 @@ expand_escape (const gchar *replacement,
base = 8;
p = g_utf8_next_char (p);
}
G_GNUC_FALLTHROUGH;
case '1':
case '2':
case '3':

View File

@ -372,6 +372,8 @@ parse_constant_offset (const gchar *name,
*offset = -*offset;
return TRUE;
}
else
return FALSE;
default:
return FALSE;

View File

@ -210,10 +210,7 @@ token_stream_prepare (TokenStream *stream)
break;
}
else
{
/* ↓↓↓ */
}
G_GNUC_FALLTHROUGH;
case 'a': /* 'b' */ case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@ -1646,6 +1643,8 @@ string_parse (TokenStream *stream,
case '\n': i++; continue;
}
G_GNUC_FALLTHROUGH;
default:
str[j++] = token[i++];
}
@ -1773,6 +1772,8 @@ bytestring_parse (TokenStream *stream,
case '\n': i++; continue;
}
G_GNUC_FALLTHROUGH;
default:
str[j++] = token[i++];
}