Open chleroy opened 8 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.
I can confirm the issue comes from the ctags version used on the indexing server / production server (not the same ones but anyway, they both have an old ctags).
⟩ ctags --version
Universal Ctags 5.9.0, Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Sep 3 2021, 18:12:18
URL: https://ctags.io/
Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml, +packcc, +optscript
⟩ ctags -x /tmp/bug.h
EMIT_WARN_ENTRY macro 114 /tmp/bug.h #define EMIT_WARN_ENTRY EMIT_BUG_ENTRY
_ASM_POWERPC_BUG_H macro 3 /tmp/bug.h #define _ASM_POWERPC_BUG_H
⟩ $new_ctags --version
Universal Ctags 6.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: Nov 8 2024, 17:48:48
URL: https://ctags.io/
Output version: 0.0
Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +yaml, +packcc, +optscript, +pcre2
⟩ $new_ctags -x /tmp/bug.h
BUG macro 69 /tmp/bug.h #define BUG() do { \
BUG_ENTRY macro 54 /tmp/bug.h #define BUG_ENTRY(insn, flags, ...) \
BUG_ON macro 78 /tmp/bug.h #define BUG_ON(x) do { \
EMIT_WARN_ENTRY macro 114 /tmp/bug.h #define EMIT_WARN_ENTRY EMIT_BUG_ENTRY
HAVE_ARCH_BUG macro 73 /tmp/bug.h #define HAVE_ARCH_BUG
HAVE_ARCH_BUG_ON macro 100 /tmp/bug.h #define HAVE_ARCH_BUG_ON
HAVE_ARCH_WARN_ON macro 101 /tmp/bug.h #define HAVE_ARCH_WARN_ON
WARN_ON macro 87 /tmp/bug.h #define WARN_ON(x) ({ \
_ASM_POWERPC_BUG_H macro 3 /tmp/bug.h #define _ASM_POWERPC_BUG_H
_EMIT_BUG_ENTRY macro 38 /tmp/bug.h #define _EMIT_BUG_ENTRY \
_EMIT_BUG_ENTRY macro 46 /tmp/bug.h #define _EMIT_BUG_ENTRY \
_EMIT_BUG_ENTRY macro 110 /tmp/bug.h #define _EMIT_BUG_ENTRY
__WARN_FLAGS macro 75 /tmp/bug.h #define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))
This is pretty annoying to solve: we are on Ubuntu which doesn't package a recent version.
I manually installed the latest version, and updated the $PATH
for it to be used. We still need a full reindexing for this issue to get closed. Note to self: if done on a side server, don't forget the updated ctags...
https://elixir.bootlin.com/linux/v6.8/A/ident/__WARN_FLAGS
The powerpc version is not seen as a macro, why ?