2012-02-03 19:27:08

by Stephen Hemminger

[permalink] [raw]
Subject: [PATCH] tags: fix regex passed to etags

Several of the regular expressions passed to etags where incorrect
and missing the backslash before the closing parenthesis, causing warning:
etags: Unmatched ( or \( while compiling pattern

Signed-off-by: Stephen Hemminger <[email protected]>


--- a/scripts/tags.sh 2012-02-03 11:21:08.880886637 -0800
+++ b/scripts/tags.sh 2012-02-03 11:21:57.753063962 -0800
@@ -178,27 +178,27 @@ emacs()
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
--regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
+ --regex='/PAGEFLAG\(([^,)]*\).*/Page\1/' \
+ --regex='/PAGEFLAG\(([^,)]*\).*/SetPage\1/' \
+ --regex='/PAGEFLAG\(([^,)]*\).*/ClearPage\1/' \
+ --regex='/TESTSETFLAG\(([^,)]*\).*/TestSetPage\1/' \
+ --regex='/TESTPAGEFLAG\(([^,)]*\).*/Page\1/' \
+ --regex='/SETPAGEFLAG\(([^,)]*\).*/SetPage\1/' \
+ --regex='/__SETPAGEFLAG\(([^,)]*\).*/__SetPage\1/' \
+ --regex='/TESTCLEARFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/__TESTCLEARFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/CLEARPAGEFLAG\(([^,)]*\).*/ClearPage\1/' \
+ --regex='/__CLEARPAGEFLAG\(([^,)]*\).*/__ClearPage\1/' \
+ --regex='/__PAGEFLAG\(([^,)]*\).*/__SetPage\1/' \
+ --regex='/__PAGEFLAG\(([^,)]*\).*/__ClearPage\1/' \
+ --regex='/PAGEFLAG_FALSE\(([^,)]*\).*/Page\1/' \
+ --regex='/TESTSCFLAG\(([^,)]*\).*/TestSetPage\1/' \
+ --regex='/TESTSCFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/SETPAGEFLAG_NOOP\(([^,)]*\).*/SetPage\1/' \
+ --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*\).*/ClearPage\1/' \
+ --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*\).*/__ClearPage\1/' \
+ --regex='/TESTCLEARFLAG_FALSE\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*\).*/__TestClearPage\1/'

all_kconfigs | xargs $1 -a \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'


2012-02-03 19:42:58

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] tags: fix regex passed to etags

On 02/03/12 11:27, Stephen Hemminger wrote:
> Several of the regular expressions passed to etags where incorrect
> and missing the backslash before the closing parenthesis, causing warning:
> etags: Unmatched ( or \( while compiling pattern
>
> Signed-off-by: Stephen Hemminger <[email protected]>
>

I'm confused how ctags didn't complain at me. It worked for me when I
tried it. Next time I'll try both. Thanks.

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2012-02-03 20:18:51

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH] tags: fix regex passed to etags

On Fri, 03 Feb 2012 11:42:53 -0800
Stephen Boyd <[email protected]> wrote:

> On 02/03/12 11:27, Stephen Hemminger wrote:
> > Several of the regular expressions passed to etags where incorrect
> > and missing the backslash before the closing parenthesis, causing warning:
> > etags: Unmatched ( or \( while compiling pattern
> >
> > Signed-off-by: Stephen Hemminger <[email protected]>
> >
>
> I'm confused how ctags didn't complain at me. It worked for me when I
> tried it. Next time I'll try both. Thanks.
>

Most likely a new check in newer version of the tags command.

2012-02-06 20:32:29

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] tags: fix regex passed to etags

> On Fri, 03 Feb 2012 11:42:53 -0800
> Stephen Boyd <[email protected]> wrote:
>
>> On 02/03/12 11:27, Stephen Hemminger wrote:
>> > Several of the regular expressions passed to etags where incorrect
>> > and missing the backslash before the closing parenthesis, causing
>> warning:
>> > etags: Unmatched ( or \( while compiling pattern
>> >
>> > Signed-off-by: Stephen Hemminger <[email protected]>
>> >
>>
>> I'm confused how ctags didn't complain at me. It worked for me when I
>> tried it. Next time I'll try both. Thanks.
>>
>
> Most likely a new check in newer version of the tags command.
>

Actually it looks like ctags also needs the fix. Can you resend with
both etags and ctags fixed?

2012-02-06 20:41:03

by Stephen Hemminger

[permalink] [raw]
Subject: [PATCH] tags: fix regex passed to etags and ctags

Several of the regular expressions passed to etags and ctags where incorrect
and missing the backslash before the closing paren, causing warning:
etags: Unmatched ( or \( while compiling pattern

Signed-off-by: Stephen Hemminger <[email protected]>

---
v2 - cover all regex (not just etags)


--- a/scripts/tags.sh 2012-02-06 12:38:53.243121989 -0800
+++ b/scripts/tags.sh 2012-02-06 12:39:00.507138571 -0800
@@ -130,30 +130,30 @@ exuberant()
-I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
--extra=+f --c-kinds=+px \
--regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \
- --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
- --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
- --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c++='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c++='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c++='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c++='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
+ --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*\).*/sys_\1/' \
+ --regex-c++='/^TRACE_EVENT\(([^,)]*\).*/trace_\1/' \
+ --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*\).*/trace_\1/' \
+ --regex-c++='/PAGEFLAG\(([^,)]*\).*/Page\1/' \
+ --regex-c++='/PAGEFLAG\(([^,)]*\).*/SetPage\1/' \
+ --regex-c++='/PAGEFLAG\(([^,)]*\).*/ClearPage\1/' \
+ --regex-c++='/TESTSETFLAG\(([^,)]*\).*/TestSetPage\1/' \
+ --regex-c++='/TESTPAGEFLAG\(([^,)]*\).*/Page\1/' \
+ --regex-c++='/SETPAGEFLAG\(([^,)]*\).*/SetPage\1/' \
+ --regex-c++='/__SETPAGEFLAG\(([^,)]*\).*/__SetPage\1/' \
+ --regex-c++='/TESTCLEARFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/__TESTCLEARFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/CLEARPAGEFLAG\(([^,)]*\).*/ClearPage\1/' \
+ --regex-c++='/__CLEARPAGEFLAG\(([^,)]*\).*/__ClearPage\1/' \
+ --regex-c++='/__PAGEFLAG\(([^,)]*\).*/__SetPage\1/' \
+ --regex-c++='/__PAGEFLAG\(([^,)]*\).*/__ClearPage\1/' \
+ --regex-c++='/PAGEFLAG_FALSE\(([^,)]*\).*/Page\1/' \
+ --regex-c++='/TESTSCFLAG\(([^,)]*\).*/TestSetPage\1/' \
+ --regex-c++='/TESTSCFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/SETPAGEFLAG_NOOP\(([^,)]*\).*/SetPage\1/' \
+ --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*\).*/ClearPage\1/' \
+ --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*\).*/__ClearPage\1/' \
+ --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*\).*/__TestClearPage\1/'

all_kconfigs | xargs $1 -a \
--langdef=kconfig --language-force=kconfig \
@@ -178,27 +178,27 @@ emacs()
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
--regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
+ --regex='/PAGEFLAG\(([^,)]*\).*/Page\1/' \
+ --regex='/PAGEFLAG\(([^,)]*\).*/SetPage\1/' \
+ --regex='/PAGEFLAG\(([^,)]*\).*/ClearPage\1/' \
+ --regex='/TESTSETFLAG\(([^,)]*\).*/TestSetPage\1/' \
+ --regex='/TESTPAGEFLAG\(([^,)]*\).*/Page\1/' \
+ --regex='/SETPAGEFLAG\(([^,)]*\).*/SetPage\1/' \
+ --regex='/__SETPAGEFLAG\(([^,)]*\).*/__SetPage\1/' \
+ --regex='/TESTCLEARFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/__TESTCLEARFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/CLEARPAGEFLAG\(([^,)]*\).*/ClearPage\1/' \
+ --regex='/__CLEARPAGEFLAG\(([^,)]*\).*/__ClearPage\1/' \
+ --regex='/__PAGEFLAG\(([^,)]*\).*/__SetPage\1/' \
+ --regex='/__PAGEFLAG\(([^,)]*\).*/__ClearPage\1/' \
+ --regex='/PAGEFLAG_FALSE\(([^,)]*\).*/Page\1/' \
+ --regex='/TESTSCFLAG\(([^,)]*\).*/TestSetPage\1/' \
+ --regex='/TESTSCFLAG\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/SETPAGEFLAG_NOOP\(([^,)]*\).*/SetPage\1/' \
+ --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*\).*/ClearPage\1/' \
+ --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*\).*/__ClearPage\1/' \
+ --regex='/TESTCLEARFLAG_FALSE\(([^,)]*\).*/TestClearPage\1/' \
+ --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*\).*/__TestClearPage\1/'

all_kconfigs | xargs $1 -a \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'

2012-02-06 23:05:29

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] tags: fix regex passed to etags and ctags

On 02/06/12 12:40, Stephen Hemminger wrote:
> Several of the regular expressions passed to etags and ctags where incorrect
> and missing the backslash before the closing paren, causing warning:
> etags: Unmatched ( or \( while compiling pattern
>
> Signed-off-by: Stephen Hemminger <[email protected]>
>
> ---
> v2 - cover all regex (not just etags)
>

Ok one more problem (my eyes hurt with all these parentheses).

--regex-c++='/PAGEFLAG\(([^,)]*\).*/Page\1/'


should be

--regex-c++='/PAGEFLAG(\([^,)]*\).*/Page\1/'


so that PAGEFLAG(Foo, ...) becomes PageFoo and not Page(Foo

After that:

Reviewed-by: Stephen Boyd <[email protected]>

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2012-02-06 23:15:49

by Stephen Hemminger

[permalink] [raw]
Subject: [PATCH] tags: fix use of parenthesis in regex

Several of the regular expressions passed to etags and ctags where incorrect
and missing the backslash before the closing paren, and matching the wrong
part of the start of the function causing warning:
etags: Unmatched ( or \( while compiling pattern

Signed-off-by: Stephen Hemminger <[email protected]>

---
v2 - cover all regex (not just etags)
v3 - fix match at start of function args


--- a/scripts/tags.sh 2012-02-06 12:38:53.243121989 -0800
+++ b/scripts/tags.sh 2012-02-06 15:13:33.400557183 -0800
@@ -129,31 +129,31 @@ exuberant()
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
-I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
--extra=+f --c-kinds=+px \
- --regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \
- --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
- --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
- --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c++='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex-c++='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c++='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex-c++='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
+ --regex-asm='/^(ENTRY|_GLOBAL)(\([^)]*)\).*/\2/' \
+ --regex-c='/^SYSCALL_DEFINE[[:digit:]]?(\([^,)]*\).*/sys_\1/' \
+ --regex-c++='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
+ --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*\).*/trace_\1/' \
+ --regex-c++='/PAGEFLAG(\([^,)]*\).*/Page\1/' \
+ --regex-c++='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \
+ --regex-c++='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/' \
+ --regex-c++='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/' \
+ --regex-c++='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/' \
+ --regex-c++='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/' \
+ --regex-c++='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
+ --regex-c++='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/' \
+ --regex-c++='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \
+ --regex-c++='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
+ --regex-c++='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \
+ --regex-c++='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/' \
+ --regex-c++='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/' \
+ --regex-c++='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/' \
+ --regex-c++='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \
+ --regex-c++='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
+ --regex-c++='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
+ --regex-c++='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/'

all_kconfigs | xargs $1 -a \
--langdef=kconfig --language-force=kconfig \
@@ -178,27 +178,27 @@ emacs()
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
--regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
- --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \
- --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \
- --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \
- --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \
- --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \
- --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \
- --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \
- --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
- --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
- --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/'
+ --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/' \
+ --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \
+ --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/' \
+ --regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/' \
+ --regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/' \
+ --regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/' \
+ --regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
+ --regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \
+ --regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/' \
+ --regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/' \
+ --regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \
+ --regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
+ --regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/' \
+ --regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/' \
+ --regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/' \
+ --regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/' \
+ --regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/' \
+ --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \
+ --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
+ --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
+ --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/'

all_kconfigs | xargs $1 -a \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'

2012-02-07 19:18:47

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] tags: fix use of parenthesis in regex

On 02/06/12 15:15, Stephen Hemminger wrote:
> Several of the regular expressions passed to etags and ctags where incorrect
> and missing the backslash before the closing paren, and matching the wrong
> part of the start of the function causing warning:
> etags: Unmatched ( or \( while compiling pattern
>
> Signed-off-by: Stephen Hemminger <[email protected]>
>

Reviewed-by: Stephen Boyd <[email protected]>

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2012-02-25 00:34:14

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH] tags: fix use of parenthesis in regex

On Mon, Feb 06, 2012 at 03:15:43PM -0800, Stephen Hemminger wrote:
> Several of the regular expressions passed to etags and ctags where incorrect
> and missing the backslash before the closing paren, and matching the wrong
> part of the start of the function causing warning:
> etags: Unmatched ( or \( while compiling pattern

But your patch introduces another imbalances, e.g.


> @@ -129,31 +129,31 @@ exuberant()
...
> - --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
...
> + --regex-c++='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \

The old version had left paren, start of group, ..., end of group
The new version has start of group, left paren, ..., right paren

Where left / right paren means the character without any special
meaning. I actually can't see anything wrong with the old TRACE_EVENT matching, the regular expression is correct and I think it does what it should do (turn
TRACE_EVENT(foo) into trace_foo).

Below is the full list of warnings I get from

Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Addresses: <[email protected]>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex


GEN tags
ctags: Warning: regcomp ^SYSCALL_DEFINE[[:digit:]]?(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp ^TRACE_EVENT(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp ^DEFINE_EVENT\([^,)]*, *([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp TESTSETFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp TESTPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp PAGEFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp SETPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
ctags: Warning: regcomp __TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(

The same list repeats, as ctags is called multiple times.

Michal

2012-02-25 00:56:26

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH] tags: fix use of parenthesis in regex

On Sat, 25 Feb 2012 01:34:12 +0100
Michal Marek <[email protected]> wrote:

> On Mon, Feb 06, 2012 at 03:15:43PM -0800, Stephen Hemminger wrote:
> > Several of the regular expressions passed to etags and ctags where incorrect
> > and missing the backslash before the closing paren, and matching the wrong
> > part of the start of the function causing warning:
> > etags: Unmatched ( or \( while compiling pattern
>
> But your patch introduces another imbalances, e.g.
>
>
> > @@ -129,31 +129,31 @@ exuberant()
> ...
> > - --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
> ...
> > + --regex-c++='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
>
> The old version had left paren, start of group, ..., end of group
> The new version has start of group, left paren, ..., right paren
>
> Where left / right paren means the character without any special
> meaning. I actually can't see anything wrong with the old TRACE_EVENT matching, the regular expression is correct and I think it does what it should do (turn
> TRACE_EVENT(foo) into trace_foo).
>
> Below is the full list of warnings I get from
>
> Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
> Addresses: <[email protected]>, http://ctags.sourceforge.net
> Optional compiled features: +wildcards, +regex
>
>
> GEN tags
> ctags: Warning: regcomp ^SYSCALL_DEFINE[[:digit:]]?(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp ^TRACE_EVENT(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp ^DEFINE_EVENT\([^,)]*, *([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTSETFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp SETPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
>
> The same list repeats, as ctags is called multiple times.
>
> Michal

The problem is that in proper regex each start of sub-expression \(
needs to have a matching end of sub-expression \)
The old version had no matching-end of sub-expression and therefore was technically
malformed, probably old tools just ignored it.

--regex='/PAGEFLAG\(([^,)]*).*/Page\1/'
^
start but no end?

My initial patch just fixed those, but others kept wanting more.


2012-02-25 09:37:36

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH] tags: fix use of parenthesis in regex

Dne 25.2.2012 01:56, Stephen Hemminger napsal(a):
> On Sat, 25 Feb 2012 01:34:12 +0100
> Michal Marek <[email protected]> wrote:
>
>> On Mon, Feb 06, 2012 at 03:15:43PM -0800, Stephen Hemminger wrote:
>>> Several of the regular expressions passed to etags and ctags where incorrect
>>> and missing the backslash before the closing paren, and matching the wrong
>>> part of the start of the function causing warning:
>>> etags: Unmatched ( or \( while compiling pattern
>>
>> But your patch introduces another imbalances, e.g.
>>
>>
>>> @@ -129,31 +129,31 @@ exuberant()
>> ...
>>> - --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \
>> ...
>>> + --regex-c++='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
>>
>> The old version had left paren, start of group, ..., end of group
>> The new version has start of group, left paren, ..., right paren
>>
>> Where left / right paren means the character without any special
>> meaning. I actually can't see anything wrong with the old TRACE_EVENT matching, the regular expression is correct and I think it does what it should do (turn
>> TRACE_EVENT(foo) into trace_foo).
>>
>> Below is the full list of warnings I get from
>>
>> Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>> Addresses: <[email protected]>, http://ctags.sourceforge.net
>> Optional compiled features: +wildcards, +regex
>>
>>
>> GEN tags
>> ctags: Warning: regcomp ^SYSCALL_DEFINE[[:digit:]]?(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp ^TRACE_EVENT(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp ^DEFINE_EVENT\([^,)]*, *([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp TESTSETFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp TESTPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp PAGEFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp SETPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
>> ctags: Warning: regcomp __TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
>>
>> The same list repeats, as ctags is called multiple times.
>>
>> Michal
>
> The problem is that in proper regex each start of sub-expression \(
> needs to have a matching end of sub-expression \)

But both *tags programs expect extended regexps, where \( is not start
of sub-expression, but a verbatim left paren. So you balanced verbatim
parens (which was not necessary, as the right paren is eaten by the
trailing .*) and broke expression grouping.

Michal