public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Ruprecht <andreas.ruprecht@fau.de>
To: Paul Bolle <pebolle@tiscali.nl>,
	Valentin Rothberg <valentinrothberg@gmail.com>
Cc: rafael.j.wysocki@intel.com, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	hengelein Stefan <stefan.hengelein@fau.de>,
	linux@dominikbrodowski.net
Subject: Re: Kconfig: '+config' valid syntax?
Date: Thu, 02 Jul 2015 13:57:23 +0200	[thread overview]
Message-ID: <55952723.80801@fau.de> (raw)
In-Reply-To: <1435827662.2423.4.camel@tiscali.nl>

Hi,

On 07/02/2015 11:01, Paul Bolle wrote:
> [Dropped Yann. You already know Yann disappeared.]
> 
> On Thu, 2015-07-02 at 10:08 +0200, Valentin Rothberg wrote:
>> commit ed013214afa7 ("ACPI / init: Make it possible to override _REV")
>> is in today's linux-next tree (i.e., next-20150702) adding the
>> following hunk to drivers/acpi/Kconfig:
>>
>> --- a/drivers/acpi/Kconfig
>> +++ b/drivers/acpi/Kconfig
>> @@ -428,6 +428,26 @@ config XPOWER_PMIC_OPREGION
>>         help
>>           This config adds ACPI operation region support for XPower 
>> AXP288 PMIC.
>>
>> ++config ACPI_REV_OVERRIDE_POSSIBLE
> 
> (Odd. Botched conflict resolution?)
> 
>> +       bool "Allow supported ACPI revision to be overriden"
>> +       depends on X86
>> +       default y
>> [...]
>>
>> By having a close look at the first added line, we can see that
>> '+config ACPI_...' is added.  To my great surprise, it's valid Kconfig
>> syntax.
> 
> I played a bit with this. It seems you can basically add a '+' anywhere
> you like and kconfig will just ignore it.
> 
>> How is that possible?  IMHO it's an invalid token, such that
>> Kconfig should complain about it.  Or do I miss something?
> 
> Welcome to the wonders of lex and yacc!
> 
> I try to spend as little time as possible looking at the lex rules, so
> I'm just guessing here. Anyhow, you might start by looking at this
> snippet in zconf.l:
>     .       {
>             unput(yytext[0]);
>             BEGIN(COMMAND);
>     }
> 
> 
>     <COMMAND>{
>             {n}+    {
>                     [...]
>             }
>             .
>             \n      {
>                     BEGIN(INITIAL);
>                     current_file->lineno++;
>                     return T_EOL;
>             }
>     }
> 
> Which perhaps translates to:
> - ignore unknown stuff for now and go in COMMAND state;
> - do something if we encounter some text ({n} = [A-Za-z0-9_]);
> - go in INITIAL state if we encounter newlines or unknown stuff.

This is _almost_ true (which I think is the problem). The rule for "."
is empty, and not the same rule as for \n. So what happens here, is that
any unknown characters are simply ignored until something in {n}+ shows up.

If I add something like the following instead:
+	. {
+		fprintf(stderr, "something else: %s\n", yytext);
+		BEGIN(INITIAL);
+	}

then Kconfig prints the message for the "+", but unfortunately also lots
of "-" (which come from the occasional "---help---" instead of "help".
As it looks to me, they are only ignored one step later inside the
<PARAM> case.

So changing it like the above is not the solution, but at least we know
where the silent ignore is coming from...

Any idea how to properly fix this?

Regards,

Andreas


  parent reply	other threads:[~2015-07-02 12:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02  8:08 Kconfig: '+config' valid syntax? Valentin Rothberg
2015-07-02  9:01 ` Paul Bolle
2015-07-02  9:25   ` Paul Bolle
2015-07-02 11:57   ` Andreas Ruprecht [this message]
2015-07-02 12:10     ` Paul Bolle
2015-07-03  7:33       ` Andreas Ruprecht
2015-07-03  8:59         ` Paul Bolle
2015-07-03  9:29           ` Andreas Ruprecht
2015-07-03 10:46             ` Ulf Magnusson
2015-07-03 10:51               ` Valentin Rothberg
2015-07-03 10:56                 ` Stefan Hengelein
2015-07-03 11:11                   ` Stefan Hengelein
2015-07-03 11:34                     ` Ulf Magnusson
2015-07-03 11:00               ` Paul Bolle
2015-07-03 11:33               ` Andreas Ruprecht
2015-07-03 11:40                 ` Ulf Magnusson
2015-07-03 12:39                   ` Ulf Magnusson
2015-07-03 12:48                     ` Ulf Magnusson
2015-07-03 11:58                 ` Paul Bolle
2015-07-03 10:52             ` Paul Bolle
2015-07-02 19:59   ` Rafael J. Wysocki
2015-07-03 10:16 ` Ulf Magnusson

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=55952723.80801@fau.de \
    --to=andreas.ruprecht@fau.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox