From: Tokunori Ikegami Date: Tue, 6 Jun 2023 08:45:43 +0000 (+0200) Subject: util: Move falltrhough feature check to meson.build X-Git-Tag: v2.5~58 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=917bdc42346dee344be3cb02db39548c450063cd;p=users%2Fsagi%2Fnvme-cli.git 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 --- 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,