2022-12-30 04:01:19

by Kevin Hao

[permalink] [raw]
Subject: [PATCH v2] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags

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 <[email protected]>
---
v2: Convert 'KCONFIG_ARGS' into array as suggested by Cristian.

scripts/tags.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index e137cf15aae9..84775f08260f 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


2022-12-30 09:34:24

by Cristian Ciocaltea

[permalink] [raw]
Subject: Re: [PATCH v2] scripts/tags.sh: Fix the Kconfig tags generation when using latest ctags

On 12/30/22 04:56, 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 <[email protected]>
> ---
> v2: Convert 'KCONFIG_ARGS' into array as suggested by Cristian.
>
> scripts/tags.sh | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/tags.sh b/scripts/tags.sh
> index e137cf15aae9..84775f08260f 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()

Reviewed-by: Cristian Ciocaltea <[email protected]>

Thanks,
Cristian