mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags
@ 2022-12-29  5:54 Kevin Hao
  2022-12-29 12:33 ` Cristian Ciocaltea
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hao @ 2022-12-29  5:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Cristian Ciocaltea, Vipin Sharma

The Kconfig language has already been built-in in the latest ctags, so
it would error exit if we try to define it as an user-defined language
via '--langdef=kconfig'. This results that there is no Kconfig tags in
the final tag file. Fix this by skipping the user Kconfig definition for
the latest ctags.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 scripts/tags.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index e137cf15aae9..c56b13ae3fdf 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -264,10 +264,12 @@ exuberant()
 	--$CTAGS_EXTRA=+fq --c-kinds=+px --fields=+iaS --langmap=c:+.h \
 	"${regex[@]}"
 
-	setup_regex exuberant kconfig
-	all_kconfigs | xargs $1 -a                              \
-	--langdef=kconfig --language-force=kconfig "${regex[@]}"
-
+	KCONFIG_ARGS=""
+	if ! $1 --list-languages | grep -iq kconfig; then
+		setup_regex exuberant kconfig
+		KCONFIG_ARGS="--langdef=kconfig --language-force=kconfig ${regex[@]}"
+	fi
+	all_kconfigs | xargs $1 -a $KCONFIG_ARGS
 }
 
 emacs()
-- 
2.38.1


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

* Re: [PATCH] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags
  2022-12-29  5:54 [PATCH] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags Kevin Hao
@ 2022-12-29 12:33 ` Cristian Ciocaltea
  2022-12-30  2:56   ` Kevin Hao
  0 siblings, 1 reply; 3+ messages in thread
From: Cristian Ciocaltea @ 2022-12-29 12:33 UTC (permalink / raw)
  To: Kevin Hao, linux-kernel; +Cc: Greg Kroah-Hartman, Vipin Sharma


On 12/29/22 07:54, Kevin Hao wrote:
> The Kconfig language has already been built-in in the latest ctags, so
> it would error exit if we try to define it as an user-defined language
> via '--langdef=kconfig'. This results that there is no Kconfig tags in
> the final tag file. Fix this by skipping the user Kconfig definition for
> the latest ctags.
> 
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
>   scripts/tags.sh | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/tags.sh b/scripts/tags.sh
> index e137cf15aae9..c56b13ae3fdf 100755
> --- a/scripts/tags.sh
> +++ b/scripts/tags.sh
> @@ -264,10 +264,12 @@ exuberant()
>   	--$CTAGS_EXTRA=+fq --c-kinds=+px --fields=+iaS --langmap=c:+.h \
>   	"${regex[@]}"
>   
> -	setup_regex exuberant kconfig
> -	all_kconfigs | xargs $1 -a                              \
> -	--langdef=kconfig --language-force=kconfig "${regex[@]}"
> -
> +	KCONFIG_ARGS=""
> +	if ! $1 --list-languages | grep -iq kconfig; then
> +		setup_regex exuberant kconfig
> +		KCONFIG_ARGS="--langdef=kconfig --language-force=kconfig ${regex[@]}"
> +	fi
> +	all_kconfigs | xargs $1 -a $KCONFIG_ARGS
>   }

The 'regex' array needs quoting to prevent word splitting/globbing. I 
would suggest to transform 'KCONFIG_ARGS' into an array as well:

KCONFIG_ARGS=()
if ! $1 --list-languages | grep -iq kconfig; then
	setup_regex exuberant kconfig
	KCONFIG_ARGS=(--langdef=kconfig --language-force=kconfig "${regex[@]}")
fi
all_kconfigs | xargs $1 -a "${KCONFIG_ARGS[@]}"


>   emacs()

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

* Re: [PATCH] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags
  2022-12-29 12:33 ` Cristian Ciocaltea
@ 2022-12-30  2:56   ` Kevin Hao
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Hao @ 2022-12-30  2:56 UTC (permalink / raw)
  To: Cristian Ciocaltea; +Cc: linux-kernel, Greg Kroah-Hartman, Vipin Sharma

[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]

On Thu, Dec 29, 2022 at 02:33:15PM +0200, Cristian Ciocaltea wrote:
> 
> On 12/29/22 07:54, Kevin Hao wrote:
> > The Kconfig language has already been built-in in the latest ctags, so
> > it would error exit if we try to define it as an user-defined language
> > via '--langdef=kconfig'. This results that there is no Kconfig tags in
> > the final tag file. Fix this by skipping the user Kconfig definition for
> > the latest ctags.
> > 
> > Signed-off-by: Kevin Hao <haokexin@gmail.com>
> > ---
> >   scripts/tags.sh | 10 ++++++----
> >   1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/scripts/tags.sh b/scripts/tags.sh
> > index e137cf15aae9..c56b13ae3fdf 100755
> > --- a/scripts/tags.sh
> > +++ b/scripts/tags.sh
> > @@ -264,10 +264,12 @@ exuberant()
> >   	--$CTAGS_EXTRA=+fq --c-kinds=+px --fields=+iaS --langmap=c:+.h \
> >   	"${regex[@]}"
> > -	setup_regex exuberant kconfig
> > -	all_kconfigs | xargs $1 -a                              \
> > -	--langdef=kconfig --language-force=kconfig "${regex[@]}"
> > -
> > +	KCONFIG_ARGS=""
> > +	if ! $1 --list-languages | grep -iq kconfig; then
> > +		setup_regex exuberant kconfig
> > +		KCONFIG_ARGS="--langdef=kconfig --language-force=kconfig ${regex[@]}"
> > +	fi
> > +	all_kconfigs | xargs $1 -a $KCONFIG_ARGS
> >   }
> 
> The 'regex' array needs quoting to prevent word splitting/globbing.

Fair enough.

> I would
> suggest to transform 'KCONFIG_ARGS' into an array as well:

Sounds great. V2 is coming.

Thanks,
Kevin

> 
> KCONFIG_ARGS=()
> if ! $1 --list-languages | grep -iq kconfig; then
> 	setup_regex exuberant kconfig
> 	KCONFIG_ARGS=(--langdef=kconfig --language-force=kconfig "${regex[@]}")
> fi
> all_kconfigs | xargs $1 -a "${KCONFIG_ARGS[@]}"
> 
> 
> >   emacs()

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-12-30  2:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-29  5:54 [PATCH] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags Kevin Hao
2022-12-29 12:33 ` Cristian Ciocaltea
2022-12-30  2:56   ` Kevin Hao

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®