diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-05 22:51:24 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-08 01:57:25 +0200 |
commit | ea8cf0fef9300678da7cc80bd60e3f959465bd34 (patch) | |
tree | e39edc91ee59a65e82a8ccd1892a1a8a541a21c1 | |
parent | c9676a3b0349a1053c673243af52a2ef1b272bd7 (diff) | |
download | sparse-ea8cf0fef9300678da7cc80bd60e3f959465bd34.tar.gz |
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 <luc.vanoostenryck@gmail.com>
-rw-r--r-- | options.c | 8 | ||||
-rw-r--r-- | target.h | 1 |
2 files changed, 9 insertions, 0 deletions
@@ -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 }, @@ -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); }; |