On Tue, 3 Nov 2026 at 15:57, Petr Pavlu <[email protected]> wrote: > > On 11/3/26 1:58 PM, Giuliano Procida wrote: > > diff --git a/scripts/misc-check b/scripts/misc-check > > index 40e5a4b01ff4..b39d731cb413 100755 > > --- a/scripts/misc-check > > +++ b/scripts/misc-check > > @@ -45,7 +45,7 @@ check_tracked_ignored_files () { > > # does not automatically fix it. > > check_missing_include_linux_export_h () { > > > > - git -C "${srctree:-.}" grep --files-with-matches -E > > 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' \ > > + git -C "${srctree:-.}" grep --files-with-matches -E > > 'EXPORT_SYMBOL((_RUST)?(_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' \ > > -- '*.[ch]' :^tools/ :^include/linux/export.h | > > xargs -r git -C "${srctree:-.}" grep --files-without-match > > '#include[[:space:]]*<linux/export\.h>' | > > xargs -r printf "%s: warning: EXPORT_SYMBOL() is used, but #include > > <linux/export.h> is missing\n" >&2 > > @@ -58,7 +58,7 @@ check_unnecessary_include_linux_export_h () { > > > > git -C "${srctree:-.}" grep --files-with-matches > > '#include[[:space:]]*<linux/export\.h>' \ > > -- '*.[c]' :^tools/ | > > - xargs -r git -C "${srctree:-.}" grep --files-without-match -E > > 'EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' | > > + xargs -r git -C "${srctree:-.}" grep --files-without-match -E > > 'EXPORT_SYMBOL((_RUST)?(_NS)?(_GPL)?|_FOR_MODULES)\(.*\)' | > > xargs -r printf "%s: warning: EXPORT_SYMBOL() is not used, but > > #include <linux/export.h> is present\n" >&2 > > } > > > > This is minor, but the updated pattern matches non-existent > EXPORT_SYMBOL() variants. To preserve the current strict matching, it > should instead be changed to: > > EXPORT_SYMBOL((_NS)?(_GPL)?|_FOR_MODULES|_RUST_GPL)\(.*\)
I'll take this suggestion which was also my initial thought. My second thought was that if Linux were ever going to allow non-GPL or namespaced Rust symbols, the syntax I came up with would be the best future-proofing. > Alternatively, I think the pattern could be made more permissive in > general, something like: > > EXPORT_SYMBOL(_[A-Z_]+)?\(.*\) > > This has the advantage of not requiring changes when a variant of > EXPORT_SYMBOL() is added/removed and shouldn't sacrifice any of the > desired functionality. AI analysis: Using a permissive regex in check_missing_include_linux_export_h introduces 81 to 84 false-positive warnings across the kernel. Things like: EXPORT_SYMBOL_IF_KUNIT, EXPORT_SYMBOL_ACPI_LIB. > -- Petr
