About meson clang-tidy issue on some repos

Lei Yu yulei.sh at bytedance.com
Wed Feb 12 17:23:28 AEDT 2025


On Wed, Feb 12, 2025 at 9:42 AM Patrick Williams <patrick at stwcx.xyz> wrote:

> > # The issue
> >
> > With the current meson calling "clang-tidy-fix", it introduces another
> > issue in that it runs **all** the c/c++ like files of the repo, even
> > if it's not configured to be compiled.
> >
> > For example, `phosphor-debug-collector` has the
> > `openpower-dumps-extension` feature disabled by default, and its
> > `dump-extensions.cpp` includes `openpower_dumps_config.h` that is
> > generated when the feature is enabled. By default, it's missing, and
> > it gets a clang-tidy failure on checking this file.
>
> Can we just fix the issues?  We merged the fix for the phosphor-debug-collector
> one already today.

It's not a "fix" but a "workaround". It's always possible for a repo
to have a disabled-by-default config.
Instead, it's more like a bug in meson clang-tidy, that it is not
expected to check the code that is not configured to be built.

>
> >
> > # How to fix
> >
> > I would like to ask how to fix such issues from OpenBMC's perspective.
> >
> > Several potential options to discuss:
> > 1. To fix meson's clang-tidy to run only files from `compile_commands.json`.
> >     Drawback: this way, it will not run clang-tidy on hpp files anymore.
>
> I think we/you should discuss this issue upstream with Meson.  I'm also
> surprised they made this change, not because of the hpp, but because of
> dependency issues like the one I fixed in phosphor-debug-collector.

Agreed. It's a meson clang-tidy issue.
What is your comment on this? Which files are expected to be checked
by clang-tidy?
a. **all** the c-like files in a repo
b. or just the files to be built
c. or ideally, the c-like files (including .h/hpp) configured to be built.

-- 
BRs,
Lei YU


More information about the openbmc mailing list