mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Gorsunov <gorsunov@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	Vladimir Gorsunov <gorsunov@gmail.com>
Subject: [PATCH] scripts/tags.sh: fix Kconfig indexing when using etags from emacs package
Date: Tue, 27 Oct 2026 11:25:42 +0100	[thread overview]
Message-ID: <20261027102543.22151-1-gorsunov@gmail.com> (raw)

'+' and '?' operators in regular expressions are handled differently
in Universal/Exuberant ctags and emacs. In emacs, + and ? are
operators, and \+ and \? are literals. In Universal, it's the
reverse

Replace \+ with an interval the same way \? is handled already

Signed-off-by: Vladimir Gorsunov <gorsunov@gmail.com>
---

 Hello, my first attempt to contribute something here. If anyone
 could test, you need Emacs >= 31.0, because character classes
 (:alnum: etc.) did not work in etags since 27.0 due to a bug

 scripts/tags.sh | 45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 41e38df96984..ce2fa0ef5910 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -162,6 +162,7 @@ dogtags()
 # the following limitations:
 # - No regex modifiers
 # - Use \{0,1\} instead of \?, because etags expects an unescaped ?
+# - Use \{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;
@@ -212,8 +213,8 @@ regex_c=(
 	'/\<DEFINE_\(RT_MUTEX\|MUTEX\|SEMAPHORE\|SPINLOCK\)([[:space:]]*\([[:alnum:]_]*\)/\2/v/'
 	'/\<DEFINE_\(RAW_SPINLOCK\|RWLOCK\|SEQLOCK\)([[:space:]]*\([[:alnum:]_]*\)/\2/v/'
 	'/\<DEFINE_TIMER(\([^,)]*\),/\1/'
-	'/\<DECLARE_\(RWSEM\|COMPLETION\)([[:space:]]*\([[:alnum:]_]\+\)/\2/v/'
-	'/\<DECLARE_BITMAP([[:space:]]*\([[:alnum:]_]\+\)/\1/v/'
+	'/\<DECLARE_\(RWSEM\|COMPLETION\)([[:space:]]*\([[:alnum:]_]\{1,\}\)/\2/v/'
+	'/\<DECLARE_BITMAP([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/v/'
 	'/\(^\|\s\)\(\|L\|H\)LIST_HEAD([[:space:]]*\([[:alnum:]_]*\)/\3/v/'
 	'/\(^\|\s\)RADIX_TREE([[:space:]]*\([[:alnum:]_]*\)/\2/v/'
 	'/\<DEFINE_PER_CPU([^,]*,[[:space:]]*\([[:alnum:]_]*\)/\1/v/'
@@ -223,31 +224,31 @@ regex_c=(
 	'/\(^\s\)OFFSET([[:space:]]*\([[:alnum:]_]*\)/\2/v/'
 	'/\(^\s\)DEFINE([[:space:]]*\([[:alnum:]_]*\)/\2/v/'
 	'/\<\(DEFINE\|DECLARE\)_HASHTABLE([[:space:]]*\([[:alnum:]_]*\)/\2/v/'
-	'/\<DEFINE_ID\(R\|A\)([[:space:]]*\([[:alnum:]_]\+\)/\2/'
-	'/\<DEFINE_WD_CLASS([[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/\<ATOMIC_NOTIFIER_HEAD([[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/\<RAW_NOTIFIER_HEAD([[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/\<DECLARE_FAULT_ATTR([[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/\<BLOCKING_NOTIFIER_HEAD([[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/\<DEVICE_ATTR_\(RW\|RO\|WO\)([[:space:]]*\([[:alnum:]_]\+\)/dev_attr_\2/'
-	'/\<DRIVER_ATTR_\(RW\|RO\|WO\)([[:space:]]*\([[:alnum:]_]\+\)/driver_attr_\2/'
-	'/\<\(DEFINE\|DECLARE\)_STATIC_KEY_\(TRUE\|FALSE\)\(\|_RO\)([[:space:]]*\([[:alnum:]_]\+\)/\4/'
+	'/\<DEFINE_ID\(R\|A\)([[:space:]]*\([[:alnum:]_]\{1,\}\)/\2/'
+	'/\<DEFINE_WD_CLASS([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/\<ATOMIC_NOTIFIER_HEAD([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/\<RAW_NOTIFIER_HEAD([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/\<DECLARE_FAULT_ATTR([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/\<BLOCKING_NOTIFIER_HEAD([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/\<DEVICE_ATTR_\(RW\|RO\|WO\)([[:space:]]*\([[:alnum:]_]\{1,\}\)/dev_attr_\2/'
+	'/\<DRIVER_ATTR_\(RW\|RO\|WO\)([[:space:]]*\([[:alnum:]_]\{1,\}\)/driver_attr_\2/'
+	'/\<\(DEFINE\|DECLARE\)_STATIC_KEY_\(TRUE\|FALSE\)\(\|_RO\)([[:space:]]*\([[:alnum:]_]\{1,\}\)/\4/'
 	'/^SEQCOUNT_LOCKTYPE(\([^,]*\),[[:space:]]*\([^,]*\),[^)]*)/seqcount_\2_t/'
 	'/^SEQCOUNT_LOCKTYPE(\([^,]*\),[[:space:]]*\([^,]*\),[^)]*)/seqcount_\2_init/'
-	'/^\<DECLARE_IDTENTRY[[:alnum:]_]*([^,)]*,[[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/^\<DEFINE_IDTENTRY[[:alnum:]_]*([[:space:]]*\([[:alnum:]_]\+\)/\1/'
-	'/^\<DEFINE_FREE(\([[:alnum:]_]\+\)/cleanup_\1/'
-	'/^\<DEFINE_CLASS(\([[:alnum:]_]\+\)/class_\1/'
-	'/^\<EXTEND_CLASS(\([[:alnum:]_]\+\),[[:space:]]*\([[:alnum:]_]\+\)/class_\1\2/'
-	'/^\<DEFINE_GUARD(\([[:alnum:]_]\+\)/class_\1/'
-	'/^\<DEFINE_GUARD_COND(\([[:alnum:]_]\+\),[[:space:]]*\([[:alnum:]_]\+\)/class_\1\2/'
-	'/^\<DEFINE_LOCK_GUARD_[[:digit:]](\([[:alnum:]_]\+\)/class_\1/'
-	'/^\<DEFINE_LOCK_GUARD_[[:digit:]]_COND(\([[:alnum:]_]\+\),[[:space:]]*\([[:alnum:]_]\+\)/class_\1\2/'
+	'/^\<DECLARE_IDTENTRY[[:alnum:]_]*([^,)]*,[[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/^\<DEFINE_IDTENTRY[[:alnum:]_]*([[:space:]]*\([[:alnum:]_]\{1,\}\)/\1/'
+	'/^\<DEFINE_FREE(\([[:alnum:]_]\{1,\}\)/cleanup_\1/'
+	'/^\<DEFINE_CLASS(\([[:alnum:]_]\{1,\}\)/class_\1/'
+	'/^\<EXTEND_CLASS(\([[:alnum:]_]\{1,\}\),[[:space:]]*\([[:alnum:]_]\{1,\}\)/class_\1\2/'
+	'/^\<DEFINE_GUARD(\([[:alnum:]_]\{1,\}\)/class_\1/'
+	'/^\<DEFINE_GUARD_COND(\([[:alnum:]_]\{1,\}\),[[:space:]]*\([[:alnum:]_]\{1,\}\)/class_\1\2/'
+	'/^\<DEFINE_LOCK_GUARD_[[:digit:]](\([[:alnum:]_]\{1,\}\)/class_\1/'
+	'/^\<DEFINE_LOCK_GUARD_[[:digit:]]_COND(\([[:alnum:]_]\{1,\}\),[[:space:]]*\([[:alnum:]_]\{1,\}\)/class_\1\2/'
 	'/^context_lock_struct(\([^,)]*\)[^)]*)/struct \1/'
 )
 regex_kconfig=(
-	'/^[[:blank:]]*\(menu\|\)config[[:blank:]]\+\([[:alnum:]_]\+\)/\2/'
-	'/^[[:blank:]]*\(menu\|\)config[[:blank:]]\+\([[:alnum:]_]\+\)/CONFIG_\2/'
+	'/^[[:blank:]]*\(menu\|\)config[[:blank:]]\{1,\}\([[:alnum:]_]\{1,\}\)/\2/'
+	'/^[[:blank:]]*\(menu\|\)config[[:blank:]]\{1,\}\([[:alnum:]_]\{1,\}\)/CONFIG_\2/'
 )
 setup_regex()
 {

base-commit: 83deedcf85af511dc120b3cd8ee597d211cdf2fb
-- 
2.56.0


                 reply	other threads:[~2026-10-27 10:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261027102543.22151-1-gorsunov@gmail.com \
    --to=gorsunov@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.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

all inboxes | Powered by JetHome®