From 96c61cbab06b9e3d85241e45a2c8aebeb09d3092 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 3 Aug 2022 12:00:21 -0700 Subject: [PATCH 1/2] libpkgconf: remove trailing ; from macro definition GCC has a lovely bug (which I will report as soon as I have an account), which causes -Wmisleading-indentation to miss cases of misleading indentation after a `;;`, since the macro adds `;`, and in call cases the caller also adds `;`, we end up with a double macro and gcc fails to warn. --- libpkgconf/libpkgconf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index 59fa45f..d204ddf 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -298,11 +298,11 @@ PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_cl #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define PKGCONF_TRACE(client, ...) do { \ pkgconf_trace(client, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__); \ - } while (0); + } while (0) #else #define PKGCONF_TRACE(client, ...) do { \ pkgconf_trace(client, __FILE__, __LINE__, __func__, __VA_ARGS__); \ - } while (0); + } while (0) #endif #else #define PKGCONF_TRACE(client, ...) From 125a13d3b91e134b6474e2c5dbee4f92301d0c2d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 3 Aug 2022 12:01:47 -0700 Subject: [PATCH 2/2] meson: add -Wmisleading-indentation A useful warning when loop and conditional statements are allowed without braces. --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index b77ee85..88ef05b 100644 --- a/meson.build +++ b/meson.build @@ -12,6 +12,7 @@ add_project_arguments( '-D_DEFAULT_SOURCE', cc.get_supported_arguments( '-Wimplicit-function-declaration', + '-Wmisleading-indentation', ), language : 'c', )