Re: tags: Unify emacs and exuberant rules

2016-01-21 Thread Michal Marek
On 2016-01-21 06:22, Dave Jones wrote:
> On Wed, Jan 20, 2016 at 06:22:04PM +, Linux Kernel wrote:
>  > Web:
> https://git.kernel.org/torvalds/c/93209d65c1d38f86ffb3f61a1214130b581a9709
>  > Commit: 93209d65c1d38f86ffb3f61a1214130b581a9709
>  > Parent: a1ccdb63b5535dc3446b0a9efc6d97aca82c72ef
>  > Refname:refs/heads/master
>  > Author: Michal Marek 
>  > AuthorDate: Wed Oct 14 11:48:06 2015 +0200
>  > Committer:  Michal Marek 
>  > CommitDate: Tue Jan 5 22:18:48 2016 +0100
>  > 
>  > tags: Unify emacs and exuberant rules
>  > 
>  > The emacs rules were constantly lagging behind the exuberant ones. Use 
> a
>  > single set of rules for both, to make the script easier to maintain.
>  > The language understood by both tools is basic regular expression with
>  > some limitations, which are documented in a comment. To be able to 
> store
>  > the rules in an array and easily iterate over it, the script requires
>  > bash now. In the exuberant case, the change fixes some false matches in
>  >  and also some too greedy matches in the arguments
>  > of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
>  > not working rules are matching now. Tested with these versions of the
>  > tools:
>  > 
>  >   Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>  >   etags (GNU Emacs 24.5)
>  > 
>  > Signed-off-by: Michal Marek 
> 
> Since today, make tags got a lot more noisy for me on Debian unstable
> (exuberant-ctags 1:5.9~svn20110310-10)
> 
> $ make tags
> GEN tags
> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name 
> pattern "\1"
> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name 
> pattern "\1"
> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern 
> "\1"
> ctags: Warning: kernel/workqueue.c:307: null expansion of name pattern "\1"
> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern 
> "\1"
> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern 
> "\1"
> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
> 
> Looks like it's choking on DEFINE_PER_CPU definitions ?

Yes. But each time I submitted a patch to remove the line breaks in
DEFINE_PER_CPU, somebody came up with the clever idea to fix ctags instead.

Michal



Re: tags: Unify emacs and exuberant rules

2016-01-21 Thread Michal Marek
On 2016-01-21 06:22, Dave Jones wrote:
> On Wed, Jan 20, 2016 at 06:22:04PM +, Linux Kernel wrote:
>  > Web:
> https://git.kernel.org/torvalds/c/93209d65c1d38f86ffb3f61a1214130b581a9709
>  > Commit: 93209d65c1d38f86ffb3f61a1214130b581a9709
>  > Parent: a1ccdb63b5535dc3446b0a9efc6d97aca82c72ef
>  > Refname:refs/heads/master
>  > Author: Michal Marek <mma...@suse.com>
>  > AuthorDate: Wed Oct 14 11:48:06 2015 +0200
>  > Committer:  Michal Marek <mma...@suse.com>
>  > CommitDate: Tue Jan 5 22:18:48 2016 +0100
>  > 
>  > tags: Unify emacs and exuberant rules
>  > 
>  > The emacs rules were constantly lagging behind the exuberant ones. Use 
> a
>  > single set of rules for both, to make the script easier to maintain.
>  > The language understood by both tools is basic regular expression with
>  > some limitations, which are documented in a comment. To be able to 
> store
>  > the rules in an array and easily iterate over it, the script requires
>  > bash now. In the exuberant case, the change fixes some false matches in
>  >  and also some too greedy matches in the arguments
>  > of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
>  > not working rules are matching now. Tested with these versions of the
>  > tools:
>  > 
>  >   Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>  >   etags (GNU Emacs 24.5)
>  > 
>  > Signed-off-by: Michal Marek <mma...@suse.com>
> 
> Since today, make tags got a lot more noisy for me on Debian unstable
> (exuberant-ctags 1:5.9~svn20110310-10)
> 
> $ make tags
> GEN tags
> ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name 
> pattern "\1"
> ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name 
> pattern "\1"
> ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern 
> "\1"
> ctags: Warning: kernel/workqueue.c:307: null expansion of name pattern "\1"
> ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern 
> "\1"
> ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern 
> "\1"
> ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
> ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
> ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"
> 
> Looks like it's choking on DEFINE_PER_CPU definitions ?

Yes. But each time I submitted a patch to remove the line breaks in
DEFINE_PER_CPU, somebody came up with the clever idea to fix ctags instead.

Michal



Re: tags: Unify emacs and exuberant rules

2016-01-20 Thread Dave Jones
On Wed, Jan 20, 2016 at 06:22:04PM +, Linux Kernel wrote:
 > Web:
 > https://git.kernel.org/torvalds/c/93209d65c1d38f86ffb3f61a1214130b581a9709
 > Commit: 93209d65c1d38f86ffb3f61a1214130b581a9709
 > Parent: a1ccdb63b5535dc3446b0a9efc6d97aca82c72ef
 > Refname:refs/heads/master
 > Author: Michal Marek 
 > AuthorDate: Wed Oct 14 11:48:06 2015 +0200
 > Committer:  Michal Marek 
 > CommitDate: Tue Jan 5 22:18:48 2016 +0100
 > 
 >     tags: Unify emacs and exuberant rules
 > 
 > The emacs rules were constantly lagging behind the exuberant ones. Use a
 > single set of rules for both, to make the script easier to maintain.
 > The language understood by both tools is basic regular expression with
 > some limitations, which are documented in a comment. To be able to store
 > the rules in an array and easily iterate over it, the script requires
 > bash now. In the exuberant case, the change fixes some false matches in
 >  and also some too greedy matches in the arguments
 > of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
 > not working rules are matching now. Tested with these versions of the
 > tools:
 > 
 >   Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
 >   etags (GNU Emacs 24.5)
 > 
 > Signed-off-by: Michal Marek 

Since today, make tags got a lot more noisy for me on Debian unstable
(exuberant-ctags 1:5.9~svn20110310-10)

$ make tags
GEN tags
ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name 
pattern "\1"
ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name 
pattern "\1"
ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern 
"\1"
ctags: Warning: kernel/workqueue.c:307: null expansion of name pattern "\1"
ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"

Looks like it's choking on DEFINE_PER_CPU definitions ?

Dave


Re: tags: Unify emacs and exuberant rules

2016-01-20 Thread Dave Jones
On Wed, Jan 20, 2016 at 06:22:04PM +, Linux Kernel wrote:
 > Web:
 > https://git.kernel.org/torvalds/c/93209d65c1d38f86ffb3f61a1214130b581a9709
 > Commit: 93209d65c1d38f86ffb3f61a1214130b581a9709
 > Parent: a1ccdb63b5535dc3446b0a9efc6d97aca82c72ef
 > Refname:refs/heads/master
 > Author: Michal Marek <mma...@suse.com>
 > AuthorDate: Wed Oct 14 11:48:06 2015 +0200
 > Committer:  Michal Marek <mma...@suse.com>
 > CommitDate: Tue Jan 5 22:18:48 2016 +0100
 > 
 > tags: Unify emacs and exuberant rules
 > 
 > The emacs rules were constantly lagging behind the exuberant ones. Use a
 > single set of rules for both, to make the script easier to maintain.
 > The language understood by both tools is basic regular expression with
 > some limitations, which are documented in a comment. To be able to store
 > the rules in an array and easily iterate over it, the script requires
 > bash now. In the exuberant case, the change fixes some false matches in
 >  and also some too greedy matches in the arguments
 > of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
 > not working rules are matching now. Tested with these versions of the
 > tools:
 > 
 >   Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
 >   etags (GNU Emacs 24.5)
 > 
 > Signed-off-by: Michal Marek <mma...@suse.com>

Since today, make tags got a lot more noisy for me on Debian unstable
(exuberant-ctags 1:5.9~svn20110310-10)

$ make tags
GEN tags
ctags: Warning: drivers/xen/events/events_2l.c:41: null expansion of name 
pattern "\1"
ctags: Warning: drivers/acpi/processor_idle.c:64: null expansion of name 
pattern "\1"
ctags: Warning: kernel/locking/lockdep.c:153: null expansion of name pattern 
"\1"
ctags: Warning: kernel/workqueue.c:307: null expansion of name pattern "\1"
ctags: Warning: kernel/rcu/rcutorture.c:133: null expansion of name pattern "\1"
ctags: Warning: kernel/rcu/rcutorture.c:135: null expansion of name pattern "\1"
ctags: Warning: net/rds/page.c:45: null expansion of name pattern "\1"
ctags: Warning: net/ipv6/syncookies.c:44: null expansion of name pattern "\1"
ctags: Warning: net/ipv4/syncookies.c:53: null expansion of name pattern "\1"

Looks like it's choking on DEFINE_PER_CPU definitions ?

Dave


Re: [PATCH v2 7/8] tags: Unify emacs and exuberant rules

2016-01-05 Thread Michal Marek
Dne 4.12.2015 v 16:26 Michal Marek napsal(a):
> The emacs rules were constantly lagging behind the exuberant ones. Use a
> single set of rules for both, to make the script easier to maintain.
> The language understood by both tools is basic regular expression with
> some limitations, which are documented in a comment. To be able to store
> the rules in an array and easily iterate over it, the script requires
> bash now. In the exuberant case, the change fixes some false matches in
>  and also some too greedy matches in the arguments
> of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
> not working rules are matching now. Tested with these versions of the
> tools:
> 
>   Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>   etags (GNU Emacs 24.5)
> 
> Signed-off-by: Michal Marek 
> ---
> v2: Rebased onto current linux-next

I applied the series up to 7/8 to kbuild.git#misc. I will repost 8/8
with a more convincing changelog.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 7/8] tags: Unify emacs and exuberant rules

2016-01-05 Thread Michal Marek
Dne 4.12.2015 v 16:26 Michal Marek napsal(a):
> The emacs rules were constantly lagging behind the exuberant ones. Use a
> single set of rules for both, to make the script easier to maintain.
> The language understood by both tools is basic regular expression with
> some limitations, which are documented in a comment. To be able to store
> the rules in an array and easily iterate over it, the script requires
> bash now. In the exuberant case, the change fixes some false matches in
>  and also some too greedy matches in the arguments
> of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
> not working rules are matching now. Tested with these versions of the
> tools:
> 
>   Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>   etags (GNU Emacs 24.5)
> 
> Signed-off-by: Michal Marek 
> ---
> v2: Rebased onto current linux-next

I applied the series up to 7/8 to kbuild.git#misc. I will repost 8/8
with a more convincing changelog.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 7/8] tags: Unify emacs and exuberant rules

2015-12-04 Thread Michal Marek
The emacs rules were constantly lagging behind the exuberant ones. Use a
single set of rules for both, to make the script easier to maintain.
The language understood by both tools is basic regular expression with
some limitations, which are documented in a comment. To be able to store
the rules in an array and easily iterate over it, the script requires
bash now. In the exuberant case, the change fixes some false matches in
 and also some too greedy matches in the arguments
of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
not working rules are matching now. Tested with these versions of the
tools:

  Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  etags (GNU Emacs 24.5)

Signed-off-by: Michal Marek 
---
v2: Rebased onto current linux-next

 scripts/tags.sh | 199 ++--
 1 file changed, 108 insertions(+), 91 deletions(-)
 mode change 100755 => 100644 scripts/tags.sh

diff --git a/scripts/tags.sh b/scripts/tags.sh
old mode 100755
new mode 100644
index 17ff331f8840..23ba1c6a0a59
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Generate tags or cscope files
 # Usage tags.sh 
 #
@@ -145,8 +145,107 @@ dogtags()
all_target_sources | gtags -i -f -
 }
 
+# Basic regular expressions with an optional /kind-spec/ for ctags and
+# the following limitations:
+# - No regex modifiers
+# - Use \{0,1\} instead of \?, because etags expects an unescaped ?
+# - \s is not working with etags, use a space or [ \t]
+# - \w works, but does not match underscores in etags
+# - etags regular expressions have to match at the start of a line;
+#   a ^[^#] is prepended by setup_regex unless an anchor is already present
+regex_asm=(
+   '/^\(ENTRY\|_GLOBAL\)(\([[:alnum:]_\\]*\)).*/\2/'
+)
+regex_c=(
+   '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/'
+   '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/'
+   '/^TESTSETFLAG(\([[:alnum:]_]*\).*/TestSetPage\1/'
+   '/^TESTPAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^SETPAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/\<__SETPAGEFLAG(\([[:alnum:]_]*\).*/__SetPage\1/'
+   '/\http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 7/8] tags: Unify emacs and exuberant rules

2015-12-04 Thread Michal Marek
The emacs rules were constantly lagging behind the exuberant ones. Use a
single set of rules for both, to make the script easier to maintain.
The language understood by both tools is basic regular expression with
some limitations, which are documented in a comment. To be able to store
the rules in an array and easily iterate over it, the script requires
bash now. In the exuberant case, the change fixes some false matches in
 and also some too greedy matches in the arguments
of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
not working rules are matching now. Tested with these versions of the
tools:

  Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  etags (GNU Emacs 24.5)

Signed-off-by: Michal Marek 
---
v2: Rebased onto current linux-next

 scripts/tags.sh | 199 ++--
 1 file changed, 108 insertions(+), 91 deletions(-)
 mode change 100755 => 100644 scripts/tags.sh

diff --git a/scripts/tags.sh b/scripts/tags.sh
old mode 100755
new mode 100644
index 17ff331f8840..23ba1c6a0a59
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Generate tags or cscope files
 # Usage tags.sh 
 #
@@ -145,8 +145,107 @@ dogtags()
all_target_sources | gtags -i -f -
 }
 
+# Basic regular expressions with an optional /kind-spec/ for ctags and
+# the following limitations:
+# - No regex modifiers
+# - Use \{0,1\} instead of \?, because etags expects an unescaped ?
+# - \s is not working with etags, use a space or [ \t]
+# - \w works, but does not match underscores in etags
+# - etags regular expressions have to match at the start of a line;
+#   a ^[^#] is prepended by setup_regex unless an anchor is already present
+regex_asm=(
+   '/^\(ENTRY\|_GLOBAL\)(\([[:alnum:]_\\]*\)).*/\2/'
+)
+regex_c=(
+   '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/'
+   '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/'
+   '/^TESTSETFLAG(\([[:alnum:]_]*\).*/TestSetPage\1/'
+   '/^TESTPAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^SETPAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/\<__SETPAGEFLAG(\([[:alnum:]_]*\).*/__SetPage\1/'
+   '/\

[PATCH 8/9] tags: Unify emacs and exuberant rules

2015-10-15 Thread Michal Marek
The emacs rules were constantly lagging behind the exuberant ones. Use a
single set of rules for both, to make the script easier to maintain.
The language understood by both tools is basic regular expression with
some limitations, which are documented in a comment. To be able to store
the rules in an array and easily iterate over it, the script requires
bash now. In the exuberant case, the change fixes some false matches in
 and also some too greedy matches in the arguments
of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
not working rules are matching now. Tested with these versions of the
tools:

  Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  etags (GNU Emacs 24.5)

Signed-off-by: Michal Marek 
---
 scripts/tags.sh | 200 ++--
 1 file changed, 108 insertions(+), 92 deletions(-)
 mode change 100755 => 100644 scripts/tags.sh

diff --git a/scripts/tags.sh b/scripts/tags.sh
old mode 100755
new mode 100644
index 06246b64c0a1..4979ab645e5e
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Generate tags or cscope files
 # Usage tags.sh 
 #
@@ -145,8 +145,107 @@ dogtags()
all_target_sources | gtags -i -f -
 }
 
+# Basic regular expressions with an optional /kind-spec/ for ctags and
+# the following limitations:
+# - No regex modifiers
+# - Use \{0,1\} instead of \?, because etags expects an unescaped ?
+# - \s is not working with etags, use a space or [ \t]
+# - \w works, but does not match underscores in etags
+# - etags regular expressions have to match at the start of a line;
+#   a ^[^#] is prepended by setup_regex unless an anchor is already present
+regex_asm=(
+   '/^\(ENTRY\|_GLOBAL\)(\([[:alnum:]_\\]*\)).*/\2/'
+)
+regex_c=(
+   '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/'
+   '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/'
+   '/^TESTSETFLAG(\([[:alnum:]_]*\).*/TestSetPage\1/'
+   '/^TESTPAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^SETPAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/\<__SETPAGEFLAG(\([[:alnum:]_]*\).*/__SetPage\1/'
+   '/\http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 8/9] tags: Unify emacs and exuberant rules

2015-10-15 Thread Michal Marek
The emacs rules were constantly lagging behind the exuberant ones. Use a
single set of rules for both, to make the script easier to maintain.
The language understood by both tools is basic regular expression with
some limitations, which are documented in a comment. To be able to store
the rules in an array and easily iterate over it, the script requires
bash now. In the exuberant case, the change fixes some false matches in
 and also some too greedy matches in the arguments
of the DECLARE_*/DEFINE_* macros. In the emacs case, several previously
not working rules are matching now. Tested with these versions of the
tools:

  Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  etags (GNU Emacs 24.5)

Signed-off-by: Michal Marek 
---
 scripts/tags.sh | 200 ++--
 1 file changed, 108 insertions(+), 92 deletions(-)
 mode change 100755 => 100644 scripts/tags.sh

diff --git a/scripts/tags.sh b/scripts/tags.sh
old mode 100755
new mode 100644
index 06246b64c0a1..4979ab645e5e
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Generate tags or cscope files
 # Usage tags.sh 
 #
@@ -145,8 +145,107 @@ dogtags()
all_target_sources | gtags -i -f -
 }
 
+# Basic regular expressions with an optional /kind-spec/ for ctags and
+# the following limitations:
+# - No regex modifiers
+# - Use \{0,1\} instead of \?, because etags expects an unescaped ?
+# - \s is not working with etags, use a space or [ \t]
+# - \w works, but does not match underscores in etags
+# - etags regular expressions have to match at the start of a line;
+#   a ^[^#] is prepended by setup_regex unless an anchor is already present
+regex_asm=(
+   '/^\(ENTRY\|_GLOBAL\)(\([[:alnum:]_\\]*\)).*/\2/'
+)
+regex_c=(
+   '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/'
+   '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/'
+   '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1/'
+   '/^DEFINE_EVENT([^,)]*, *\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/^PAGEFLAG(\([[:alnum:]_]*\).*/ClearPage\1/'
+   '/^TESTSETFLAG(\([[:alnum:]_]*\).*/TestSetPage\1/'
+   '/^TESTPAGEFLAG(\([[:alnum:]_]*\).*/Page\1/'
+   '/^SETPAGEFLAG(\([[:alnum:]_]*\).*/SetPage\1/'
+   '/\<__SETPAGEFLAG(\([[:alnum:]_]*\).*/__SetPage\1/'
+   '/\