All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Magnusson <ulfalizer.lkml@gmail.com>
To: Andreas Ruprecht <andreas.ruprecht@fau.de>
Cc: Paul Bolle <pebolle@tiscali.nl>,
	Valentin Rothberg <valentinrothberg@gmail.com>,
	rafael.j.wysocki@intel.com, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	hengelein Stefan <stefan.hengelein@fau.de>,
	linux@dominikbrodowski.net, Michal Marek <mmarek@suse.cz>
Subject: Re: [PATCH v2 1/2] kconfig: warn of unhandled characters in Kconfig commands
Date: Thu, 9 Jul 2015 19:52:42 +0200	[thread overview]
Message-ID: <20150709175242.GA8271@huvuddator> (raw)
In-Reply-To: <5a5844d23d18500aacbed671fd0c77019f5e32bd.1436264921.git.andreas.ruprecht@fau.de>

One more nitpick:

On Tue, Jul 07, 2015 at 12:31:16PM +0200, Andreas Ruprecht wrote:
> In Kconfig, definitions of options take the following form:
> "<COMMAND> <PARAM> <PARAM> ...". COMMANDs and PARAMs are treated
> slightly different by the underlying parser.
> 
> While commit 2e0d737fc76f ("kconfig: don't silently ignore unhandled
> characters") introduced a warning for unsupported characters around
> PARAMs, it does not cover situations where a COMMAND has additional
> characters around it.
> 
> This change makes Kconfig emit a warning if superfluous characters
> are found around COMMANDs. As the 'help' statement sometimes is
> written as '---help---', the '-' character would now also be regarded
> as unhandled and generate a warning. To avoid that, '-' is added to
> the list of allowed characters, and the token '---help---' is included
> in the zconf.gperf file.
> 
> Reported-by: Valentin Rothberg <valentinrothberg@gmail.com>
> Signed-off-by: Andreas Ruprecht <andreas.ruprecht@fau.de>
> ---
>  scripts/kconfig/zconf.gperf |  1 +
>  scripts/kconfig/zconf.l     | 18 ++++++++++++------
>  2 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
> index b6ac02d..7aceb7b 100644
> --- a/scripts/kconfig/zconf.gperf
> +++ b/scripts/kconfig/zconf.gperf
> @@ -22,6 +22,7 @@ comment,	T_COMMENT,	TF_COMMAND
>  config,		T_CONFIG,	TF_COMMAND
>  menuconfig,	T_MENUCONFIG,	TF_COMMAND
>  help,		T_HELP,		TF_COMMAND
> +"---help---",   T_HELP,     TF_COMMAND
>  if,		T_IF,		TF_COMMAND|TF_PARAM
>  endif,		T_ENDIF,	TF_COMMAND
>  depends,	T_DEPENDS,	TF_COMMAND
> diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
> index 200a3fe..3078244 100644
> --- a/scripts/kconfig/zconf.l
> +++ b/scripts/kconfig/zconf.l
> @@ -66,9 +66,16 @@ static void alloc_string(const char *str, int size)
>  	memcpy(text, str, size);
>  	text[size] = 0;
>  }
> +
> +static void warn_ignored_character(const char chr)
> +{
> +	fprintf(stderr,
> +	        "%s:%d:warning: ignoring unsupported character '%c'\n",
> +	        zconf_curname(), zconf_lineno(), chr);
> +}
>  %}
>  
> -n	[A-Za-z0-9_]
> +n	[A-Za-z0-9_-]
>  
>  %%
>  	int str = 0;
> @@ -106,7 +113,9 @@ n	[A-Za-z0-9_]
>  		zconflval.string = text;
>  		return T_WORD;
>  	}
> -	.
> +	.	{
> +		warn_ignored_character(*yytext);
> +	}

I'd shorten this to just

	.	warn_ignored_character(*yytext);

Not that the rest of zonf.l is very consistent.

>  	\n	{
>  		BEGIN(INITIAL);
>  		current_file->lineno++;
> @@ -132,7 +141,6 @@ n	[A-Za-z0-9_]
>  		BEGIN(STRING);
>  	}
>  	\n	BEGIN(INITIAL); current_file->lineno++; return T_EOL;
> -	---	/* ignore */
>  	({n}|[-/.])+	{
>  		const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
>  		if (id && id->flags & TF_PARAM) {
> @@ -147,9 +155,7 @@ n	[A-Za-z0-9_]
>  	\\\n	current_file->lineno++;
>  	[[:blank:]]+
>  	.	{
> -		fprintf(stderr,
> -		        "%s:%d:warning: ignoring unsupported character '%c'\n",
> -		        zconf_curname(), zconf_lineno(), *yytext);
> +		warn_ignored_character(*yytext);
>  	}

Ditto.

>  	<<EOF>> {
>  		BEGIN(INITIAL);
> -- 
> 1.9.1
> 

Cheers,
Ulf

  parent reply	other threads:[~2015-07-09 17:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 10:31 [PATCH v2 0/2] kconfig: warn of unhandled characters in Kconfig commands Andreas Ruprecht
2015-07-07 10:31 ` Andreas Ruprecht
2015-07-07 10:31 ` [PATCH v2 1/2] " Andreas Ruprecht
2015-07-07 10:31   ` Andreas Ruprecht
2015-07-08 20:14   ` Ulf Magnusson
2015-07-09 17:52   ` Ulf Magnusson [this message]
2015-07-07 10:31 ` [PATCH v2 2/2] kconfig: Regenerate shipped zconf.{hash,lex}.c files Andreas Ruprecht
2015-07-07 10:31   ` Andreas Ruprecht

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=20150709175242.GA8271@huvuddator \
    --to=ulfalizer.lkml@gmail.com \
    --cc=andreas.ruprecht@fau.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=mmarek@suse.cz \
    --cc=pebolle@tiscali.nl \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stefan.hengelein@fau.de \
    --cc=valentinrothberg@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.