Open chleroy opened 6 months ago
Good catch. Locally, ctags
appears to return the right thing:
⟩ export LXR_REPO_DIR="/absolute/path/to/linux"
⟩ cd $LXR_REPO_DIR
⟩ git ls-tree v6.8 arch/powerpc/include/asm/bug.h
100644 blob 1db485aacbd9b7c4e77847dbcb5e112ebb011ab2 arch/powerpc/include/asm/bug.h
⟩ $elixir_path/script.sh parse-defs \
1db485aacbd9b7c4e77847dbcb5e112ebb011ab2 foo.c C | \
grep __WARN_FLAGS
__WARN_FLAGS macro 75
⟩ ctags --version
Universal Ctags 6.1.0(v6.1.0), Copyright (C) 2015-2023 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Dec 28 2023, 18:49:35
URL: https://ctags.io/
Output version: 0.0
Optional compiled features: +wildcards, +regex, +iconv, +option-directory,
+xpath, +json, +interactive, +sandbox, +yaml, +packcc,
+optscript, +pcre2
This does a call to parse_defs_C
in script.sh
that confirms my local ctags
returns the right value. macro
is the expected type for a macro declaration. There are many other possible reasons:
ctags
version;Digging deeper is required.
parse-defs also returns wrong data on my local docker instance. (older kernel tag but that does not matter https://elixir.bootlin.com/linux/v6.1/A/ident/__WARN_FLAGS).
root@80a0a2bce64f:/srv/elixir-data/linux/repo# git ls-tree v6.1 arch/powerpc/include/asm/bug.h
100644 blob 61a4736355c244448104080e144631a3cb8839b2 arch/powerpc/include/asm/bug.h
root@80a0a2bce64f:/srv/elixir-data/linux/repo# cd /usr/local/elixir/
root@80a0a2bce64f:/usr/local/elixir# ./script.sh parse-defs 61a4736355c244448104080e144631a3cb8839b2 foo.c C
_ASM_POWERPC_BUG_H macro 3
_exception prototype 165
_exception_pkey prototype 166
bad_page_fault prototype 164
die prototype 167
die_mce prototype 168
die_will_crash prototype 169
hash__do_page_fault prototype 163
panic_flush_kmsg_end prototype 171
panic_flush_kmsg_start prototype 170
I suspect ctags version is the issue. Ctags in the debian docker image is pinned to a rather old version and perhaps the same applies to production. Manually upgrading ctags to the latest nightly version seems to fix the issue (not that I advocate using nightly on prod, since there exists a stable release that also works). ctags included in Debian Bookworm repos seems to be too old.
Thanks for the check using the old ctags
version. I remember this version is patched for a reason, @michaelopdenacker will be able to tell us more about why. Upgrading it makes sense. The question will be if we still need custom patches on top or if we can use upstream.
This commit suggests, that the changes from the special ctags version were upstreamed.
The packages should probably be removed from the Dockerfile, same with pygments.
https://elixir.bootlin.com/linux/v6.8/A/ident/__WARN_FLAGS
The powerpc version is not seen as a macro, why ?