linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/checkkconfigsymbols.py: support default statements
@ 2015-07-25 14:11 Valentin Rothberg
  2015-07-27 10:33 ` [PATCH v2] " Valentin Rothberg
  0 siblings, 1 reply; 5+ messages in thread
From: Valentin Rothberg @ 2015-07-25 14:11 UTC (permalink / raw)
  To: gregkh, stefan.hengelein, linux-kernel, pebolle; +Cc: Valentin Rothberg

Until now, checkkonfigsymbols.py did not check default statements for
references on missing Kconfig symbols (i.e., undefined Kconfig options).
Hence, add support to parse and check the Kconfig default statement.

Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
---
 scripts/checkkconfigsymbols.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index c89fdcaf06e8..1ba171b97e02 100755
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -20,18 +20,21 @@ OPERATORS = r"&|\(|\)|\||\!"
 FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}"
 DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*"
 EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+"
-STMT = r"^\s*(?:if|select|depends\s+on)\s+" + EXPR
+DEFAULT = r"default\s+.*?(?:if\s.+){,1}"
+STMT = r"^\s*(?:if|select|depends\s+on|(?:" + DEFAULT + r"))\s+" + EXPR
 SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")"
 
+
 # regex objects
 REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$")
-REGEX_FEATURE = re.compile(r"(" + FEATURE + r")")
+REGEX_FEATURE = re.compile(r'(?!\B"[^"]*)' + FEATURE + r'(?![^"]*"\B)')
 REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE)
 REGEX_KCONFIG_DEF = re.compile(DEF)
 REGEX_KCONFIG_EXPR = re.compile(EXPR)
 REGEX_KCONFIG_STMT = re.compile(STMT)
 REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$")
 REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$")
+REGEX_NUMERIC = re.compile(r"0x[0-9a-f]+|[0-9]+")
 
 
 def parse_options():
@@ -279,6 +282,9 @@ def parse_kconfig_file(kfile, defined_features, referenced_features):
                 line = line.strip('\n')
                 features.extend(get_features_in_line(line))
             for feature in set(features):
+                if REGEX_NUMERIC.match(feature):
+                    # ignore numeric values
+                    continue
                 paths = referenced_features.get(feature, set())
                 paths.add(kfile)
                 referenced_features[feature] = paths
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2] scripts/checkkconfigsymbols.py: support default statements
  2015-07-25 14:11 [PATCH] scripts/checkkconfigsymbols.py: support default statements Valentin Rothberg
@ 2015-07-27 10:33 ` Valentin Rothberg
  2015-08-24 14:49   ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Valentin Rothberg @ 2015-07-27 10:33 UTC (permalink / raw)
  To: gregkh, stefan.hengelein, linux-kernel, pebolle; +Cc: Valentin Rothberg

Until now, checkkonfigsymbols.py did not check default statements for
references on missing Kconfig symbols (i.e., undefined Kconfig options).
Hence, add support to parse and check the Kconfig default statement.

Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
---
Changelog:
    v2 (thanks to Stefan Hengelein):
    - update NUMERIC regex (Kconfig accepts 'X' and 'A-F')
    - remove mistakenly added blank line from v1

 scripts/checkkconfigsymbols.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index c89fdcaf06e8..4ce00fbede94 100755
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -20,18 +20,20 @@ OPERATORS = r"&|\(|\)|\||\!"
 FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}"
 DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*"
 EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+"
-STMT = r"^\s*(?:if|select|depends\s+on)\s+" + EXPR
+DEFAULT = r"default\s+.*?(?:if\s.+){,1}"
+STMT = r"^\s*(?:if|select|depends\s+on|(?:" + DEFAULT + r"))\s+" + EXPR
 SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")"
 
 # regex objects
 REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$")
-REGEX_FEATURE = re.compile(r"(" + FEATURE + r")")
+REGEX_FEATURE = re.compile(r'(?!\B"[^"]*)' + FEATURE + r'(?![^"]*"\B)')
 REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE)
 REGEX_KCONFIG_DEF = re.compile(DEF)
 REGEX_KCONFIG_EXPR = re.compile(EXPR)
 REGEX_KCONFIG_STMT = re.compile(STMT)
 REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$")
 REGEX_FILTER_FEATURES = re.compile(r"[A-Za-z0-9]$")
+REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+")
 
 
 def parse_options():
@@ -279,6 +281,9 @@ def parse_kconfig_file(kfile, defined_features, referenced_features):
                 line = line.strip('\n')
                 features.extend(get_features_in_line(line))
             for feature in set(features):
+                if REGEX_NUMERIC.match(feature):
+                    # ignore numeric values
+                    continue
                 paths = referenced_features.get(feature, set())
                 paths.add(kfile)
                 referenced_features[feature] = paths
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] scripts/checkkconfigsymbols.py: support default statements
  2015-07-27 10:33 ` [PATCH v2] " Valentin Rothberg
@ 2015-08-24 14:49   ` Michal Marek
  2015-08-24 14:52     ` Valentin Rothberg
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2015-08-24 14:49 UTC (permalink / raw)
  To: Valentin Rothberg, gregkh, stefan.hengelein, linux-kernel, pebolle

On 2015-07-27 12:33, Valentin Rothberg wrote:
> Until now, checkkonfigsymbols.py did not check default statements for
> references on missing Kconfig symbols (i.e., undefined Kconfig options).
> Hence, add support to parse and check the Kconfig default statement.
> 
> Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
> ---
> Changelog:
>     v2 (thanks to Stefan Hengelein):
>     - update NUMERIC regex (Kconfig accepts 'X' and 'A-F')
>     - remove mistakenly added blank line from v1
> 
>  scripts/checkkconfigsymbols.py | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Applied to kbuild.git#kconfig.

Michal


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] scripts/checkkconfigsymbols.py: support default statements
  2015-08-24 14:49   ` Michal Marek
@ 2015-08-24 14:52     ` Valentin Rothberg
  2015-08-24 14:57       ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Valentin Rothberg @ 2015-08-24 14:52 UTC (permalink / raw)
  To: Michal Marek; +Cc: Greg KH, hengelein Stefan, linux-kernel, Paul Bolle

Hi Michal,

On Mon, Aug 24, 2015 at 4:49 PM, Michal Marek <mmarek@suse.cz> wrote:
> On 2015-07-27 12:33, Valentin Rothberg wrote:
>> Until now, checkkonfigsymbols.py did not check default statements for
>> references on missing Kconfig symbols (i.e., undefined Kconfig options).
>> Hence, add support to parse and check the Kconfig default statement.
>>
>> Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
>> ---
>> Changelog:
>>     v2 (thanks to Stefan Hengelein):
>>     - update NUMERIC regex (Kconfig accepts 'X' and 'A-F')
>>     - remove mistakenly added blank line from v1
>>
>>  scripts/checkkconfigsymbols.py | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> Applied to kbuild.git#kconfig.
>
> Michal
>

The patch above already went through Greg's tree to linux-next (see
commit 0bd38ae35522).

Kind regards,
 Valentin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] scripts/checkkconfigsymbols.py: support default statements
  2015-08-24 14:52     ` Valentin Rothberg
@ 2015-08-24 14:57       ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2015-08-24 14:57 UTC (permalink / raw)
  To: Valentin Rothberg; +Cc: Greg KH, hengelein Stefan, linux-kernel, Paul Bolle

On 2015-08-24 16:52, Valentin Rothberg wrote:
> Hi Michal,
> 
> On Mon, Aug 24, 2015 at 4:49 PM, Michal Marek <mmarek@suse.cz> wrote:
>> On 2015-07-27 12:33, Valentin Rothberg wrote:
>>> Until now, checkkonfigsymbols.py did not check default statements for
>>> references on missing Kconfig symbols (i.e., undefined Kconfig options).
>>> Hence, add support to parse and check the Kconfig default statement.
>>>
>>> Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
>>> ---
>>> Changelog:
>>>     v2 (thanks to Stefan Hengelein):
>>>     - update NUMERIC regex (Kconfig accepts 'X' and 'A-F')
>>>     - remove mistakenly added blank line from v1
>>>
>>>  scripts/checkkconfigsymbols.py | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> Applied to kbuild.git#kconfig.
>>
>> Michal
>>
> 
> The patch above already went through Greg's tree to linux-next (see
> commit 0bd38ae35522).

Thanks for the information. I'll undo the change in my tree (I haven't
pushed yet).

Michal


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-24 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-25 14:11 [PATCH] scripts/checkkconfigsymbols.py: support default statements Valentin Rothberg
2015-07-27 10:33 ` [PATCH v2] " Valentin Rothberg
2015-08-24 14:49   ` Michal Marek
2015-08-24 14:52     ` Valentin Rothberg
2015-08-24 14:57       ` Michal Marek

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).