Message ID | 20210703143122.1441578-6-nicolas.iooss@m4x.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/6] libsepol: silence -Wextra-semi-stmt warning | expand |
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c index c0fc14e40d2f..e92dfddb0d20 100644 --- a/mcstrans/src/mcstrans.c +++ b/mcstrans/src/mcstrans.c @@ -43,7 +43,7 @@ #ifdef DEBUG #define log_debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) #else -#define log_debug(fmt, ...) ; +#define log_debug(fmt, ...) do {} while (0) #endif static unsigned int maxbit=0; diff --git a/mcstrans/src/mcstransd.c b/mcstrans/src/mcstransd.c index 07c052fd4998..59c152e73be1 100644 --- a/mcstrans/src/mcstransd.c +++ b/mcstrans/src/mcstransd.c @@ -40,7 +40,7 @@ //#define log_debug(fmt, ...) syslog(LOG_DEBUG, fmt, __VA_ARGS__) #define log_debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) #else -#define log_debug(fmt, ...) ; +#define log_debug(fmt, ...) do {} while (0) #endif extern int init_translations(void);
On Ubuntu 20.04, when building with clang -Werror -Wextra-semi-stmt (which is not the default build configuration), the compiler reports: mcstransd.c:72:35: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt] log_debug("%s\n", "cleanup_exit"); ^ Replace the empty log_debug substitution with a do { ... } while (0) construction to silence this warning. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> --- mcstrans/src/mcstrans.c | 2 +- mcstrans/src/mcstransd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)