开发者

g++/clang ultra fast parse but not compile mode?

开发者 https://www.devze.com 2022-12-25 10:31 出处:网络
Is there some ultra fast \"syntax check my code, but don\'t compile mode\" for g++/clang? Where the only goal is to just check if the code I have is valid C++ co开发者_StackOverflow中文版de?-fsyntax-o

Is there some ultra fast "syntax check my code, but don't compile mode" for g++/clang? Where the only goal is to just check if the code I have is valid C++ co开发者_StackOverflow中文版de?


-fsyntax-only for GCC, this should probably work for Clang as well since they emulate GCC's command line options. Whether or not it's significantly faster, you'll have to time.


You can have a look at gcc-xml ( http://www.gccxml.org/HTML/Index.html ), which reuses the gcc frontend to produce an xml description of the source.

Another option is to use the edg frontend ( http://www.edg.com/index.php?location=c_frontend ), but is is not open source, and far from cheap.


Maybe cppcheck is an option for you? I do not know exactly what result you want. cppcheck is not a pure syntax check. And if cppcheck is fast enougth.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号