From acc27139f66a9792a8a2e710ca5d14b88e6eb726 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 5 Sep 2024 15:07:07 -0400 Subject: build/flags: Use auto-detection for all warning flags --- build/flags.mk | 22 ++++++++++------------ build/flags/Wformat.c | 9 +++++++++ build/flags/Wimplicit-fallthrough.c | 9 +++++++++ build/flags/Wimplicit.c | 9 +++++++++ build/flags/Wmissing-decls.c | 9 +++++++++ build/flags/Wmissing-var-decls.c | 9 +++++++++ build/flags/Wshadow.c | 9 +++++++++ build/flags/Wsign-compare.c | 9 +++++++++ build/flags/Wstrict-prototypes.c | 9 +++++++++ build/flags/missing-var-decls.c | 9 --------- 10 files changed, 82 insertions(+), 21 deletions(-) create mode 100644 build/flags/Wformat.c create mode 100644 build/flags/Wimplicit-fallthrough.c create mode 100644 build/flags/Wimplicit.c create mode 100644 build/flags/Wmissing-decls.c create mode 100644 build/flags/Wmissing-var-decls.c create mode 100644 build/flags/Wshadow.c create mode 100644 build/flags/Wsign-compare.c create mode 100644 build/flags/Wstrict-prototypes.c delete mode 100644 build/flags/missing-var-decls.c diff --git a/build/flags.mk b/build/flags.mk index afe19bc..1421ce6 100644 --- a/build/flags.mk +++ b/build/flags.mk @@ -67,16 +67,7 @@ _CPPFLAGS += ${RELEASE_CPPFLAGS,${_RELEASE}} _CFLAGS += ${RELEASE_CFLAGS,${_RELEASE}} # Configurable flags -CFLAGS ?= \ - -g \ - -Wall \ - -Wformat=2 \ - -Werror=implicit \ - -Wimplicit-fallthrough \ - -Wmissing-declarations \ - -Wshadow \ - -Wsign-compare \ - -Wstrict-prototypes +CFLAGS ?= -g -Wall # Add the configurable flags last so they can override ours _CPPFLAGS += ${CPPFLAGS} ${EXTRA_CPPFLAGS} @@ -89,9 +80,16 @@ include build/exports.mk # Conditionally-supported flags AUTO_FLAGS := \ + gen/flags/Wformat.mk \ + gen/flags/Wimplicit-fallthrough.mk \ + gen/flags/Wimplicit.mk \ + gen/flags/Wmissing-decls.mk \ + gen/flags/Wmissing-var-decls.mk \ + gen/flags/Wshadow.mk \ + gen/flags/Wsign-compare.mk \ + gen/flags/Wstrict-prototypes.mk \ gen/flags/bind-now.mk \ - gen/flags/deps.mk \ - gen/flags/missing-var-decls.mk + gen/flags/deps.mk gen/flags.mk: ${AUTO_FLAGS} ${MSG} "[ GEN] $@" diff --git a/build/flags/Wformat.c b/build/flags/Wformat.c new file mode 100644 index 0000000..287b209 --- /dev/null +++ b/build/flags/Wformat.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wformat=2 +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wimplicit-fallthrough.c b/build/flags/Wimplicit-fallthrough.c new file mode 100644 index 0000000..c32058d --- /dev/null +++ b/build/flags/Wimplicit-fallthrough.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wimplicit-fallthrough +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wimplicit.c b/build/flags/Wimplicit.c new file mode 100644 index 0000000..3ea2b90 --- /dev/null +++ b/build/flags/Wimplicit.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Werror=implicit +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wmissing-decls.c b/build/flags/Wmissing-decls.c new file mode 100644 index 0000000..5ef3e96 --- /dev/null +++ b/build/flags/Wmissing-decls.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wmissing-declarations +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wmissing-var-decls.c b/build/flags/Wmissing-var-decls.c new file mode 100644 index 0000000..5c20cc6 --- /dev/null +++ b/build/flags/Wmissing-var-decls.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wmissing-variable-declarations +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wshadow.c b/build/flags/Wshadow.c new file mode 100644 index 0000000..28f6ef3 --- /dev/null +++ b/build/flags/Wshadow.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wshadow +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wsign-compare.c b/build/flags/Wsign-compare.c new file mode 100644 index 0000000..f083083 --- /dev/null +++ b/build/flags/Wsign-compare.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wsign-compare +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/Wstrict-prototypes.c b/build/flags/Wstrict-prototypes.c new file mode 100644 index 0000000..9614bee --- /dev/null +++ b/build/flags/Wstrict-prototypes.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +/// _CFLAGS += -Wstrict-prototypes +/// -Werror + +int main(void) { + return 0; +} diff --git a/build/flags/missing-var-decls.c b/build/flags/missing-var-decls.c deleted file mode 100644 index 5c20cc6..0000000 --- a/build/flags/missing-var-decls.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright © Tavian Barnes -// SPDX-License-Identifier: 0BSD - -/// _CFLAGS += -Wmissing-variable-declarations -/// -Werror - -int main(void) { - return 0; -} -- cgit v1.2.3