Re: [PATCH 05/18] sparse: correctly handle "-D foo" and "-U foo". The former is from sparse upstream, but they didn't fix the latter for some reason.

Luc Van Oostenryck <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
On Thu, Nov 22, 2018 at 12:08:06PM +0000, John Levon wrote:
> Signed-off-by: John Levon <[email protected]>
> ---
>  lib.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/lib.c b/lib.c
> index f20e0885..d7cd8cbc 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -325,15 +325,19 @@ static char **handle_switch_D(char *arg, char **next)
>  	const char *name = arg + 1;
>  	const char *value = "1";
>  
> -	if (!*name || isspace((unsigned char)*name))
> -		die("argument to `-D' is missing");
> +	if (!*name) {
> +		arg = *++next;
> +		if (!arg)
> +			die("argument to `-D' is missing");
> +		name = arg;
> +	}
>  
> -	for (;;) {
> +	for (;;arg++) {
>  		char c;
> -		c = *++arg;
> +		c = *arg;
>  		if (!c)
>  			break;
> -		if (isspace((unsigned char)c) || c == '=') {
> +		if (c == '=') {
>  			*arg = '\0';
>  			value = arg + 1;
>  			break;

Hi,

This is copied from existing patches from sparse:
  https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=2f922ba822da324ccd2c201c076ca94d5e910a8a
  https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=d32b2f7c202fd27206169ca99da898ca9c20dfab
without giving credit and without respecting the Signed-off-by /
Developer Certificate of Origin (cfr. https://developercertificate.org/).
Please fix this.

-- Luc Van Oostenryck
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.