linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Josh Triplett <josh@joshtriplett.org>,
	linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 2/2] lib.c: skip --param parameters
Date: Tue, 17 Jun 2014 12:11:46 +0300	[thread overview]
Message-ID: <1402996306-6811-3-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1402996306-6811-1-git-send-email-andriy.shevchenko@linux.intel.com>

Very dumb patch to just skip --param allow-store-data-races=0 introduced in
newer GCC versions.

Without this patch sparse recognizes parameter of the --param option as a file
name which obviously couldn't be found.

The patch for easy implementation's sake slightly changed behaviour of
--version. Instead of exact keyword it will recognize anything starting with
--version as a correct option.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib.c b/lib.c
index 4e5a846..d5b94c3 100644
--- a/lib.c
+++ b/lib.c
@@ -678,6 +678,18 @@ static char **handle_version(char *arg, char **next)
 	exit(0);
 }
 
+static char **handle_param(char *arg, char **next)
+{
+	const char *value = NULL;
+
+	/* For now just skip any '--param=*' or '--param *' */
+	value = split_value_from_arg(arg, value);
+	if (!value)
+		++next;
+
+	return ++next;
+}
+
 struct switches {
 	const char *name;
 	char **(*fn)(char *, char **);
@@ -686,13 +698,14 @@ struct switches {
 static char **handle_long_options(char *arg, char **next)
 {
 	static struct switches cmd[] = {
+		{ "param", handle_param },
 		{ "version", handle_version },
 		{ NULL, NULL }
 	};
 	struct switches *s = cmd;
 
 	while (s->name) {
-		if (!strcmp(s->name, arg))
+		if (!strncmp(arg, s->name, strlen(s->name)))
 			return s->fn(arg, next);
 		s++;
 	}
-- 
2.0.0


  parent reply	other threads:[~2014-06-17  9:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17  9:11 [PATCH v2 0/2] fix for --param GCC's command line option Andy Shevchenko
2014-06-17  9:11 ` [PATCH v2 1/2] lib.c: introduce split_value_from_arg helper Andy Shevchenko
2014-06-17  9:11 ` Andy Shevchenko [this message]
2014-06-28 16:23   ` [PATCH v2 2/2] lib.c: skip --param parameters Christopher Li
2014-06-28 16:59   ` Christopher Li
2014-06-29  7:19     ` Christopher Li
2014-06-29 19:01       ` Christopher Li
2014-06-30  8:32     ` Andy Shevchenko
2014-06-30  8:51       ` Christopher Li
2014-06-30  8:56         ` Andy Shevchenko

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=1402996306-6811-3-git-send-email-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).