mesonbuild/meson

Add support for -fsyntax-only

Open

#12,228 建立於 2023年9月7日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Python (4,978 star) (1,465 fork)batch import
good first issue

描述

Both gcc and clang have a -fsyntax-only flag that skips the actual compilation stage. This seems like a very useful thing for a fast build check step in CIs before running proper compilation.

This is currently not usable with meson directly as passing the flag will immediately fail compiler detection as no object files are produced.

The idea would be to add a new ninja target like bikeshed-syntax-only which would only run on build steps where the compiler indicates support for such a mode (aka, all *.o targets). In case of gcc/clang, that would pass -fsyntax-only to the regular command line.

Obviously, some amount of regular targets/builds might need to be run to to produce input header/source/etc., but this should overall allow for a very fast build check step that would allow catching simple syntax/warning gotchas that tend to only show up in CI without having to wait for the 900 build steps that a commit isn't touching to finish compiling.

This is essentially the equivalent to cargo check. Including that not all errors will be found, in particular those that appear during linking.

貢獻者指南