From ea8cf0fef9300678da7cc80bd60e3f959465bd34 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sun, 5 Jul 2020 22:51:24 +0200 Subject: arch: teach sparse about the '-march' option The option '-march' is not one of the common option but is architecture specific. So, teach sparse to delegate the parsing of this option to the targets. Signed-off-by: Luc Van Oostenryck --- options.c | 8 ++++++++ target.h | 1 + 2 files changed, 9 insertions(+) diff --git a/options.c b/options.c index 9f05bdf9..1a3fee3c 100644 --- a/options.c +++ b/options.c @@ -609,6 +609,13 @@ static char **handle_switch_M(char *arg, char **next) return next; } +static int handle_march(const char *opt, const char *arg, const struct flag *flag, int options) +{ + if (arch_target->parse_march) + arch_target->parse_march(arg); + return 1; +} + static int handle_mcmodel(const char *opt, const char *arg, const struct flag *flag, int options) { static const struct val_map cmodels[] = { @@ -650,6 +657,7 @@ static const struct flag mflags[] = { { "x32",&arch_m64, NULL, OPT_VAL, ARCH_X32 }, { "size-llp64", &arch_m64, NULL, OPT_VAL, ARCH_LLP64 }, { "size-long", &arch_msize_long }, + { "arch=", NULL, handle_march }, { "big-endian", &arch_big_endian, NULL }, { "little-endian", &arch_big_endian, NULL, OPT_INVERSE }, { "cmodel", &arch_cmodel, handle_mcmodel }, diff --git a/target.h b/target.h index 8f79426c..54e97e83 100644 --- a/target.h +++ b/target.h @@ -76,6 +76,7 @@ struct target { const struct builtin_fn *builtins; void (*init)(const struct target *self); + void (*parse_march)(const char *arg); void (*predefine)(const struct target *self); const char *(*asm_constraint)(struct asm_operand *op, int c, const char *str); }; -- cgit 1.2.3-korg