Question

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++ code?

Was it helpful?

Solution

-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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top