From 917bdc42346dee344be3cb02db39548c450063cd Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Tue, 6 Jun 2023 10:45:43 +0200 Subject: [PATCH] util: Move falltrhough feature check to meson.build Instead cluttering the header file, let's add it to meson.build. Signed-off-by: Tokunori Ikegami Signed-off-by: Daniel Wagner --- meson.build | 6 ++++++ util/argconfig.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 261128c9..944fabc2 100644 --- a/meson.build +++ b/meson.build @@ -156,6 +156,12 @@ conf.set10( description: 'Is sys/random.h(getrandom) include-able?' ) +if cc.has_function_attribute('fallthrough') + conf.set('fallthrough', '__attribute__((__fallthrough__))') +else + conf.set('fallthrough', 'do {} while (0) /* fallthrough */') +endif + configure_file( output: 'config.h', configuration: conf diff --git a/util/argconfig.c b/util/argconfig.c index f101527e..effeea2f 100644 --- a/util/argconfig.c +++ b/util/argconfig.c @@ -42,12 +42,6 @@ #include #include -#if __has_attribute(__fallthrough__) -#define fallthrough __attribute__((__fallthrough__)) -#else -#define fallthrough do {} while (0) -#endif - static const char *append_usage_str = ""; static int argconfig_parse_val(struct argconfig_commandline_options *s, struct option *option, -- 2.50.1