From f3682588b2db14a01c8631a293a06ad572874bfe Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 3 Nov 2022 10:18:04 +0100 Subject: [PATCH 1/3] build/meson: sort compiler flags in "meson.build" Also remove duplicates. --- meson.build | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index ece045e5c..57fd3959f 100644 --- a/meson.build +++ b/meson.build @@ -184,11 +184,14 @@ common_flags += cc.get_supported_arguments([ '-Wmissing-declarations', '-Wmissing-include-dirs', '-Wmissing-prototypes', + '-Wparentheses-equality', '-Wpointer-arith', '-Wshadow', '-Wshift-negative-value', '-Wstrict-prototypes', + '-Wtypedef-redefinition', '-Wundef', + '-Wunknown-attributes', '-Wvla', '-Wno-duplicate-decl-specifier', '-Wno-format-truncation', @@ -200,13 +203,6 @@ common_flags += cc.get_supported_arguments([ '-Wno-tautological-constant-out-of-range-compare', '-Wno-unknown-pragmas', '-Wno-unused-parameter', - '-Wparentheses-equality', - '-Wpointer-arith', - '-Wshadow', - '-Wstrict-prototypes', - '-Wtypedef-redefinition', - '-Wundef', - '-Wunknown-attributes', '-fno-strict-aliasing', ]) From 4d2cb2d32b943ef40ad8d764e524219afdad8f99 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 3 Nov 2022 10:21:50 +0100 Subject: [PATCH 2/3] build/autotools: add compiler warnings that we have in meson Synchronize the compiler warnings for meson and autotools. --- m4/compiler_options.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index b2e9d80e0..cd2385e22 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -88,6 +88,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then for option in \ $_CFLAGS_MORE_WARNINGS_DISABLE_LTO \ + -Wall \ -Wextra \ -Wdeclaration-after-statement \ -Wfloat-equal \ @@ -99,15 +100,19 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then -Wmissing-declarations \ -Wmissing-include-dirs \ -Wmissing-prototypes \ + -Wparentheses-equality \ -Wpointer-arith \ -Wshadow \ -Wshift-negative-value \ -Wstrict-prototypes \ + -Wtypedef-redefinition \ -Wundef \ + -Wunknown-attributes \ -Wvla \ -Wno-duplicate-decl-specifier \ -Wno-format-truncation \ -Wno-format-y2k \ + -Wno-gnu-variable-sized-type-not-at-end \ -Wno-missing-field-initializers \ -Wno-pragmas \ -Wno-sign-compare \ From abbacb108558275dc06f0372549d18653b3f728e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 3 Nov 2022 10:16:10 +0100 Subject: [PATCH 3/3] build: enable warnings "-Wint-conversion" and "-Wold-style-definition" See https://lwn.net/Articles/913505/ . --- m4/compiler_options.m4 | 3 +++ meson.build | 3 +++ 2 files changed, 6 insertions(+) diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index cd2385e22..060899464 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -95,11 +95,14 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then -Wformat-nonliteral \ -Wformat-security \ -Wimplicit-function-declaration \ + -Wimplicit-int \ -Winit-self \ + -Wint-conversion \ -Wlogical-op \ -Wmissing-declarations \ -Wmissing-include-dirs \ -Wmissing-prototypes \ + -Wold-style-definition \ -Wparentheses-equality \ -Wpointer-arith \ -Wshadow \ diff --git a/meson.build b/meson.build index 57fd3959f..480e6497d 100644 --- a/meson.build +++ b/meson.build @@ -179,11 +179,14 @@ common_flags += cc.get_supported_arguments([ '-Wformat-nonliteral', '-Wformat-security', '-Wimplicit-function-declaration', + '-Wimplicit-int', '-Winit-self', + '-Wint-conversion', '-Wlogical-op', '-Wmissing-declarations', '-Wmissing-include-dirs', '-Wmissing-prototypes', + '-Wold-style-definition', '-Wparentheses-equality', '-Wpointer-arith', '-Wshadow',