Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > dd7a95aabe1c049ac9f84beede8143d3 > files > 1931

synopsis-doc-0.12-4.fc14.i686.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Emulating A Compiler</title><link rel="stylesheet" href="synopsis.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Synopsis Tutorial" /><link rel="up" href="using.html" title="Chapter 2. Using the synopsis tool" /><link rel="prev" href="parsing.html" title="Parsing Source-code" /><link rel="next" href="comments.html" title="Using Comments For Documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Emulating A Compiler</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parsing.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Using the synopsis tool</th><td width="20%" align="right"> <a accesskey="n" href="comments.html">Next</a></td></tr></table></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compiler-emulation"></a>Emulating A Compiler</h2></div></div></div><p>Whenever the code to be parsed includes <span class="emphasis"><em>system headers</em></span>, the parser needs
        to know about their location(s), and likely also about <span class="emphasis"><em>system macro</em></span> definitions
        that may be in effect. For example, parsing:</p><pre class="programlisting">
#include &lt;vector&gt;
#include &lt;string&gt;

typedef std::vector&lt;std::string&gt; option_list;
      </pre><p>requires the parser to know where to find the <code class="filename">vector</code> and <code class="filename">string</code>
        headers.</p><p>Synopsis will attempt to emulate a compiler for the current programming language. By default, 
        <strong class="userinput"><code>synopsis -p Cxx</code></strong> will try to locate <span class="application">c++</span> or similar, to
        query system flags. However, the compiler can be specified via the <code class="option">--emulate-compiler</code> option,
        e.g. <strong class="userinput"><code>synopsis -p Cxx -Wp,--emulate-compiler=/usr/local/gcc4/bin/g++</code></strong>.</p><p>All languages that use the <span class="type">Cpp</span> processor to preprocess the input accept the
        <code class="option">emulate-compiler</code> argument, and pass it down to the <span class="type">Cpp</span> parser.
        See <a class="xref" href="cpp-parser.html" title="The Cpp Parser">the section called “The Cpp Parser”</a> for a detailed discussion of this process.</p></div><div class="navfooter"><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="parsing.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="using.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="comments.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Parsing Source-code </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Using Comments For Documentation</td></tr></table></div></body></html>