You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have a cmake project (generally a C project, linux/gcc, using the libpipewire library).
When I run clang-tidy -p build somefile.c it works properly, as in, somefile.c comes from source directory, and build is a cmake build dir.
When I run code analysis from vscode, i get tons of errors, one per file, about errors in libpipewire header files. All these errors relate to some optional functions and stuff coming from locale.h.
For example:
call to undeclared function 'newlocale'; ISO C99 and later do not support implicit function declarations
I know that definition is introduced by defining some macros like _GNU_SOURCE, and if I actually do this, it starts working. However, normal cmake building and clang-tidy works without.
I think it's caused by the fact -std= is defined differently by default or in cmake builds, differently when running clang-tidy from vscode, as I can repro this when compiling any of these files and disabling language extensions.
Is this a cmake or c++ extension bug, or what?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have a cmake project (generally a C project, linux/gcc, using the libpipewire library).
When I run
clang-tidy -p build somefile.c
it works properly, as in, somefile.c comes from source directory, andbuild
is a cmake build dir.When I run code analysis from vscode, i get tons of errors, one per file, about errors in libpipewire header files. All these errors relate to some optional functions and stuff coming from locale.h.
For example:
I know that definition is introduced by defining some macros like _GNU_SOURCE, and if I actually do this, it starts working. However, normal cmake building and clang-tidy works without.
I think it's caused by the fact -std= is defined differently by default or in cmake builds, differently when running clang-tidy from vscode, as I can repro this when compiling any of these files and disabling language extensions.
Is this a cmake or c++ extension bug, or what?
Beta Was this translation helpful? Give feedback.
All reactions