diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-06 09:34:03 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-06 10:41:41 +0100 |
commit | f6a8265b9a00a0a9232bfaf0cd5d3962fbc4700a (patch) | |
tree | 4c5dd73e95c6d189533dd0ab64125df7c6c2c492 /src/basic | |
parent | basic/cgroup-util: remove unused variable (diff) | |
download | systemd-f6a8265b9a00a0a9232bfaf0cd5d3962fbc4700a.tar.xz systemd-f6a8265b9a00a0a9232bfaf0cd5d3962fbc4700a.zip |
core: drop unnecessary __useless_struct_to_allow_trailing_semicolon__
ISO C does not allow empty statements outside of functions, and gcc
will warn the trailing semicolons when compiling with -pedantic:
warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
But our code cannot compile with -pedantic anyway, at least because
warning: ISO C does not support ‘__PRETTY_FUNCTION__’ predefined identifier [-Wpedantic]
Without -pedatnic, clang and even old gcc (3.4) generate no warnings about
those semicolons, so let's just drop __useless_struct_to_allow_trailing_semicolon__.
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/macro.h | 3 | ||||
-rw-r--r-- | src/basic/nss-util.h | 6 | ||||
-rw-r--r-- | src/basic/string-table.h | 9 | ||||
-rw-r--r-- | src/basic/terminal-util.h | 7 |
4 files changed, 8 insertions, 17 deletions
diff --git a/src/basic/macro.h b/src/basic/macro.h index 89bdd852a9..95be63a204 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -428,7 +428,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { static inline void func##p(type *p) { \ if (*p) \ func(*p); \ - } \ - struct __useless_struct_to_allow_trailing_semicolon__ + } #include "log.h" diff --git a/src/basic/nss-util.h b/src/basic/nss-util.h index 4fc676395f..92f7d51d29 100644 --- a/src/basic/nss-util.h +++ b/src/basic/nss-util.h @@ -116,8 +116,7 @@ enum nss_status _nss_##module##_gethostbyname_r( \ NULL, \ NULL); \ return ret; \ -} \ -struct __useless_struct_to_allow_trailing_semicolon__ +} #define NSS_GETHOSTBYADDR_FALLBACKS(module) \ enum nss_status _nss_##module##_gethostbyaddr_r( \ @@ -133,8 +132,7 @@ enum nss_status _nss_##module##_gethostbyaddr_r( \ buffer, buflen, \ errnop, h_errnop, \ NULL); \ -} \ -struct __useless_struct_to_allow_trailing_semicolon__ +} #define NSS_GETPW_PROTOTYPES(module) \ enum nss_status _nss_##module##_getpwnam_r( \ diff --git a/src/basic/string-table.h b/src/basic/string-table.h index 4306b90f46..e78a6dbdef 100644 --- a/src/basic/string-table.h +++ b/src/basic/string-table.h @@ -93,13 +93,11 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k #define _DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \ _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ - _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) \ - struct __useless_struct_to_allow_trailing_semicolon__ + _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name,type,scope) #define _DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(name,type,yes,scope) \ _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \ - _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) \ - struct __useless_struct_to_allow_trailing_semicolon__ + _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_WITH_BOOLEAN(name,type,yes,scope) #define DEFINE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,) #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP(name,type) _DEFINE_STRING_TABLE_LOOKUP(name,type,static) @@ -111,8 +109,7 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k /* For string conversions where numbers are also acceptable */ #define DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(name,type,max) \ _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,) \ - _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,) \ - struct __useless_struct_to_allow_trailing_semicolon__ + _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING_FALLBACK(name,type,max,) #define DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max) \ _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name,type,max,static) diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index b57157e3bb..e92b6987e8 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -133,16 +133,13 @@ bool dev_console_colors_enabled(void); #define DEFINE_ANSI_FUNC(name, NAME) \ static inline const char *ansi_##name(void) { \ return colors_enabled() ? ANSI_##NAME : ""; \ - } \ - struct __useless_struct_to_allow_trailing_semicolon__ + } #define DEFINE_ANSI_FUNC_UNDERLINE(name, NAME, REPLACEMENT) \ static inline const char *ansi_##name(void) { \ return underline_enabled() ? ANSI_##NAME : \ colors_enabled() ? ANSI_##REPLACEMENT : ""; \ - } \ - struct __useless_struct_to_allow_trailing_semicolon__ - + } DEFINE_ANSI_FUNC(highlight, HIGHLIGHT); DEFINE_ANSI_FUNC(highlight_red, HIGHLIGHT_RED); |