From cc397449fca8fb1559db3a790dffcd1e8046e86b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 6 May 2020 10:45:48 -0400 Subject: Use __attribute__((fallthrough)) rather than magic GCC comments. GCC added an implicit-fallthrough warning a while back, where it would complain if you had a nontrivial "case:" block that didn't end with break, return, or something like that. Clang recently added the same thing. GCC, however, would let you annotate a fall-through as intended by any of various magic "/* fall through */" comments. Clang, however, only seems to like "__attribute__((fallthrough))". Fortunately, GCC accepts that too. A previous commit in this branch defined a FALLTHROUGH macro to do the right thing if GNUC is defined; here we replace all of our "fall through" comments with uses of that macro. This is an automated commit, made with the following perl one-liner: #!/usr/bin/perl -i -p s#/\* *falls? ?thr.*?\*/#FALLTHROUGH;#i; --- src/app/config/confparse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/app') diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c index 729e7a4478..efa0c19fa6 100644 --- a/src/app/config/confparse.c +++ b/src/app/config/confparse.c @@ -179,7 +179,7 @@ config_assign_value(const config_format_t *fmt, void *options, *(int *)lvalue = CFG_AUTO_PORT; break; } - /* fall through */ + FALLTHROUGH; case CONFIG_TYPE_INT: case CONFIG_TYPE_UINT: i = (int)tor_parse_long(c->value, 10, @@ -577,7 +577,7 @@ config_get_assigned_option(const config_format_t *fmt, const void *options, escape_val = 0; break; } - /* fall through */ + FALLTHROUGH; case CONFIG_TYPE_CSV_INTERVAL: case CONFIG_TYPE_INTERVAL: case CONFIG_TYPE_MSEC_INTERVAL: @@ -588,7 +588,7 @@ config_get_assigned_option(const config_format_t *fmt, const void *options, tor_asprintf(&result->value, "%d", *(int*)value); escape_val = 0; /* Can't need escape. */ break; - case CONFIG_TYPE_UINT64: /* Fall through */ + case CONFIG_TYPE_UINT64: FALLTHROUGH; case CONFIG_TYPE_MEMUNIT: tor_asprintf(&result->value, "%"PRIu64, (*(uint64_t*)value)); @@ -605,7 +605,7 @@ config_get_assigned_option(const config_format_t *fmt, const void *options, escape_val = 0; break; } - /* fall through */ + FALLTHROUGH; case CONFIG_TYPE_BOOL: result->value = tor_strdup(*(int*)value ? "1" : "0"); escape_val = 0; /* Can't need escape. */ -- cgit v1.2.3-54-g00ecf