Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » C++ syntax validator

This thread is locked; no one can reply to it. rss feed Print
C++ syntax validator
Kevin Adrian
Member #7,087
April 2006
avatar

Hi,

can anybody give a suggestion for a C++ syntax checking/validation tool? In my job we are using a scripting language with a C++ syntax. I've already searched for such tool but Google just found code analysing tools regarding to performance and code quality measurement. I just want to test, if there are any syntax errors in my source code. The syntax checking of the scripting language we are using at work has a very poor and not reliable error reporting.

By the way, an open source tool would be awesome :-)

Thanks in advance!

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Erin Maus
Member #7,537
July 2006
avatar

Clang and GCC have an option, -fsyntax-only, to only check for syntax errors. Assuming the language is a strict subset of C or C++, that should work.

---
ItsyRealm, a quirky 2D/3D RPG where you fight, skill, and explore in a medieval world with horrors unimaginable.
they / she

Kevin Adrian
Member #7,087
April 2006
avatar

OK thanks! I'll try that.

My mouth will speak words of wisdom; the utterance from my heart will give understanding. (Psalm 49:3)

Chris Katko
Member #1,881
January 2002
avatar

Also, the term you're looking for is a Linter. A tool that merely checks the code validity.

One of the most popular C++ linters is called CppCheck and it's a huge, well-supported, project.

http://cppcheck.sourceforge.net/

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: