From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/3] arch: teach sparse about the '-march' option
Date: Wed, 8 Jul 2020 23:48:07 +0200 [thread overview]
Message-ID: <20200708214810.56214-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200708214810.56214-1-luc.vanoostenryck@gmail.com>
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>
---
options.c | 8 ++++++++
target.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/options.c b/options.c
index 9f05bdf9cf4f..1a3fee3c6751 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 8f79426c096a..54e97e83b10d 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);
};
--
2.27.0
next prev parent reply other threads:[~2020-07-08 21:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 21:48 [PATCH 0/3] teach sparse about the '-march' for RISC-V Luc Van Oostenryck
2020-07-08 21:48 ` Luc Van Oostenryck [this message]
2020-07-08 21:48 ` [PATCH 2/3] riscv: parse '-march=....' Luc Van Oostenryck
2020-07-08 21:48 ` [PATCH 3/3] riscv: add the predefines for the extensions Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200708214810.56214-2-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).