Path: csiph.com!aioe.org!bofh.it!news.nic.it!robomod From: Ulf Magnusson Newsgroups: linux.kernel Subject: Re: [PATCH 1/2] kconfig: also warn of unhandled characters in statements Date: Sun, 05 Jul 2015 10:50:01 +0200 Message-ID: References: X-Original-To: Andreas Ruprecht Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1MfC5NGTA6YSS/vVgpwZhT4R5Va5WHCe3+dRzEAbX6k=; b=AzoDevY5GBbfM1+aCkYTvileoub0weWc000BzQMlzCCDrzKECbchbHk5ZvL5Dd/+zk tGf+VpZqyPyMg4NR7CFjNNQCjHcEHwYGst3L0PC1MPHZP40Rp6uwBZNvvfdAll9e0mtp Cz4R4xH8f5+MZ+pqmhWET3v35Ery661nON0Fytw4qqPV1j5mgxPu6Fgp39NeGCA7WRC9 KXC1lKHVcrGISX3PdmSLByVXwzhKJcDWI1t5heZgtntFUntj2IZEQMpRZ/VG0xOh5HeE sNdnqqfNQUI8uI03fvVast3G58GBEBjDuAeN4t51s0CEjHbLDXlOGMs3LGql5oS8SydZ Fs/w== MIME-Version: 1.0 X-Received: by 10.182.55.74 with SMTP id q10mr41331291obp.78.1436076393835; Sat, 04 Jul 2015 23:06:33 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 84 Organization: linux.* mail to news gateway X-Original-Cc: Paul Bolle , Valentin Rothberg , rafael.j.wysocki@intel.com, "open list:KCONFIG" , Kernel Mailing List , hengelein Stefan , linux@dominikbrodowski.net, Michal Marek X-Original-Date: Sun, 5 Jul 2015 08:06:33 +0200 X-Original-Message-ID: X-Original-References: X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: aioe.org linux.kernel:1176882 A more exact commit title would be something like "warn for unhandled characters before the initial token on a line". On Fri, Jul 3, 2015 at 2:46 PM, Andreas Ruprecht wrote: > While commit 2e0d737fc76f ("kconfig: don't silently ignore unhandled > characters") introduced a warning for unsupported characters inside > parameters, it does not cover situations where a statement > has additional characters around it. This could say something like "...introduces a warning for unhandled characters after the initial token on a line, but does not cover unhandled characters before the initial token, which are ignored using a different mechanism." > > This change introduces a warning if superfluous characters are found > around statements. As the 'help' statement sometimes is written as > '---help---', the '-' character would now also be regarded as > unhandled, this change also adds a special rule for this case. Similarly above. > > Reported-by: Valentin Rothberg > Signed-off-by: Andreas Ruprecht > --- > scripts/kconfig/zconf.l | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l > index 200a3fe..84a5d05 100644 > --- a/scripts/kconfig/zconf.l > +++ b/scripts/kconfig/zconf.l > @@ -106,7 +106,15 @@ n [A-Za-z0-9_] > zconflval.string = text; > return T_WORD; > } > - . > + "---help---" { > + /* Support old syntax for help statement */ > + return T_HELP; > + } I haven't tried it out to see if there would be problems, but adding '-' to the n [A-Za-z0-9_] definition in zconf.l and adding '---help---' to zconf.gperf seems cleaner than special-casing it in zconf.l. If '---help---' is treated as a token, then it makes sense to include '-' among the token characters. (I also rambled a bit in http://www.spinics.net/lists/linux-kbuild/msg11393.html.) With that change, '-' could be removed from the parameter regex ({n}|[-/.])+ in zconf.l too. > + . { > + fprintf(stderr, > + "%s:%d:warning: ignoring unsupported character '%c'\n", > + zconf_curname(), zconf_lineno(), *yytext); > + } > \n { > BEGIN(INITIAL); > current_file->lineno++; > @@ -132,7 +140,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) { > -- > 1.9.1 > Cheers, Ulf -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/