Whenever the code to be parsed includes system headers, the parser needs to know about their location(s), and likely also about system macro definitions that may be in effect. For example, parsing:
#include <vector> #include <string> typedef std::vector<std::string> option_list;
requires the parser to know where to find the vector
and string
headers.
Synopsis will attempt to emulate a compiler for the current programming language. By default,
synopsis -p Cxx
will try to locate c++ or similar, to
query system flags. However, the compiler can be specified via the --emulate-compiler
option,
e.g. synopsis -p Cxx -Wp,--emulate-compiler=/usr/local/gcc4/bin/g++
.
All languages that use the Cpp processor to preprocess the input accept the
emulate-compiler
argument, and pass it down to the Cpp parser.
See the section called “The Cpp Parser” for a detailed discussion of this process.