linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Jonathan Corbet <corbet@lwn.net>,
	Tomasz Figa <tfiga@chromium.org>,
	linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kconfig: add warn-unknown-symbols sanity check
Date: Wed, 30 Aug 2023 09:45:33 +0900	[thread overview]
Message-ID: <20230830004533.GG3913@google.com> (raw)
In-Reply-To: <CAK7LNAROnZpZiOC4eS5kTcv4Q2YDrE9KYBD-dVcfXwBPQWvbmg@mail.gmail.com>

On (23/08/29 22:13), Masahiro Yamada wrote:
> > +KCONFIG_WARN_UNKNOWN_SYMBOLS
> > +----------------------------
> > +This environment variable makes Kconfig warn about all unrecognized
> > +symbols in the .config file.
> 
> 
> This warns not only for the .config but also defconfig files.
> 
> Could you reword it?
> 
> For example,
> 
>  "symbols in the config input".

Done.

> 
> 
> > +
> > +KCONFIG_WERROR
> > +--------------
> > +If set, Kconfig will treat `KCONFIG_WARN_UNKNOWN_SYMBOLS` warnings as
> > +errors.
> 
> My hope is to turn other warnings in the config file into errors.

Done.

> > +++ b/scripts/kconfig/confdata.c
> > @@ -349,7 +349,12 @@ int conf_read_simple(const char *name, int def)
> >         char *p, *p2;
> >         struct symbol *sym;
> >         int i, def_flags;
> > +       bool found_unknown = false;
> > +       const char *warn_unknown;
> > +       const char *werror;
> >
> > +       warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");
> > +       werror = getenv("KCONFIG_WERROR");
> >         if (name) {
> >                 in = zconf_fopen(name);
> >         } else {
> > @@ -437,6 +442,13 @@ int conf_read_simple(const char *name, int def)
> >                         if (def == S_DEF_USER) {
> >                                 sym = sym_find(line + 2 + strlen(CONFIG_));
> >                                 if (!sym) {
> > +                                       if (warn_unknown) {
> > +                                               conf_warning("unknown symbol: %s",
> > +                                                            line + 2 + strlen(CONFIG_));
> > +                                               found_unknown = true;
> > +                                               continue;
> 
> Please drop this 'continue' because it would skip
> conf_set_changed(true).

My bad. Those 'continue' are left-overs from previous version.

> > +                                       }
> > +
> >                                         conf_set_changed(true);
> >                                         continue;
> >                                 }
> > @@ -471,6 +483,13 @@ int conf_read_simple(const char *name, int def)
> >
> >                         sym = sym_find(line + strlen(CONFIG_));
> >                         if (!sym) {
> > +                               if (warn_unknown && def != S_DEF_AUTO) {
> > +                                       conf_warning("unknown symbol: %s",
> > +                                                    line + strlen(CONFIG_));
> > +                                       found_unknown = true;
> > +                                       continue;
> 
> Same here.

Same here. My bad.

> > @@ -519,6 +538,10 @@ int conf_read_simple(const char *name, int def)
> >         }
> >         free(line);
> >         fclose(in);
> > +
> > +       if (found_unknown && werror)
> > +               exit(1);
> 
> 
> I like to reuse 'conf_warnings' as you did in the previous version.

Done.

      reply	other threads:[~2023-08-30  0:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26  7:13 [PATCH] kconfig: add warn-unknown-symbols sanity check Sergey Senozhatsky
2023-08-29 13:13 ` Masahiro Yamada
2023-08-30  0:45   ` Sergey Senozhatsky [this message]

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=20230830004533.GG3913@google.com \
    --to=senozhatsky@chromium.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=tfiga@chromium.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).