/usr/share/doc/gccxml/gccxml.html is in gccxml 0.9.0+cvs20120420-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | <html>
<body>
<h2>How to Run GCC-XML</h2>
<blockquote><code>
gccxml [options] <input-file> -fxml=<output-file>
</code></blockquote>
GCC-XML parses a C++ source file as it is seen by the compiler when it is built. An easy-to-parse XML representation of the class, function, and namespace declarations is dumped to a specified file. Full C preprocessing transforms the file into a C++ translation unit as seen by the compiler. This means that GCC-XML should make use of the same standard library and other header files as the compiler. GCC-XML can be configured to simulate any of several popular compilers.
<h2>Command-line Options</h2>
The following options are available for running GCC-XML:
<ul>
<li>
<b><code>--copyright</code></b>: Print the GCC-XML copyright and exit.
</li>
<li>
<b><code>--debug</code></b>: Print extra debugging information. This option causes GCC-XML to print the executable name and command-line arguments used to execute the patched GCC C++ parser. This is useful when attempting to simulate an unsupported compiler.
</li>
<li>
<b><code>-fxml=<output-file></code></b>: Specify the XML output file. This option is passed directly on to the patched GCC C++ parser. It enables the XML dump and specifies the output file name.
</li>
<li>
<b><code>-fxml-start=<xxx>[,...]</code></b>: Specify a list of starting declarations. This option is passed directly on to the patched GCC C++ parser. It is meaningful only if -fxml= is also specified. This specifies a comma-separated list of named starting declarations. GCC-XML will dump only the subset of the declarations in the translation unit that is reachable through a sequence of source references from one of the specified starting declarations.
</li>
<li>
<b><code>--gccxml-compiler <xxx></code></b>: Set GCCXML_COMPILER to "xxx".
</li>
<li>
<b><code>--gccxml-cxxflags <xxx></code></b>: Set GCCXML_CXXFLAGS to "xxx".
</li>
<li>
<b><code>--gccxml-executable <xxx></code></b>: Set GCCXML_EXECUTABLE to "xxx".
</li>
<li>
<b><code>--gccxml-cpp <xxx></code></b>: Set GCCXML_CPP to "xxx".
</li>
<li>
<b><code>--gccxml-config <xxx></code></b>: Set GCCXML_CONFIG to "xxx".
</li>
<li>
<b><code>--gccxml-root <xxx></code></b>: Set GCCXML_ROOT to "xxx".
</li>
<li>
<b><code>--gccxml-gcc-options <xxx></code></b>: Read GCC options from file "xxx". This option specifies a file from which to read options to pass to the patched GCC C++ parser. This is useful for specifying a long list of include directories. Each line in the file becomes one option. Empty lines and lines beginning in '#' are ignored.
</li>
<li>
<b><code>--help</code></b>: Print full help and exit. Full help displays most of the documentation provided by the UNIX man page. It is provided for use on non-UNIX platforms, but is also convenient if the man page is not installed.
</li>
<li>
<b><code>--help-html</code></b>: Print full help in HTML format. This option is used by GCC-XML authors to help produce web pages.
</li>
<li>
<b><code>--man</code></b>: Print a UNIX man page and exit. This option is used by GCC-XML authors to generate the UNIX man page.
</li>
<li>
<b><code>--print</code></b>: Print configuration settings and exit. GCC-XML has many configuration options to help it simulate another compiler. Using this option will cause GCC-XML to configure itself as if it were going to parse the C++ source, but stop and print the configuration found. This is useful for checking the configuration.
</li>
<li>
<b><code>--preprocess</code></b>: Preprocess the input and exit. GCC-XML simulates the proprocessor of another compiler. Using this option will cause GCC-XML to configure itself as if it were going to parse the C++ source, but stop after preprocessing. This is useful for debugging problems related to simulation of the other compiler.
</li>
<li>
<b><code>-E</code></b>: Alias for --preprocess.
</li>
<li>
<b><code>--version</code></b>: Show program name/version banner and exit.
</li>
</ul>
Other flags, such as -I and -D, are passed on to the patched GCC C++ parser executable.
<h2>Configuration Settings</h2>
GCC-XML is designed to simulate a compiler's parser while reading C++ source code. Some configuration settings are needed to determine how to simulate a particular compiler of the user's choice. The following settings can be used to configure GCC-XML:
<ul>
<li>
<b><code>GCCXML_COMPILER</code></b>: The C++ compiler to be simulated. GCC-XML will attempt to automatically determine how to simulate the compiler specified by this setting. The compiler is specified by its executable name (such as "g++"). For Visual Studio, the compiler is specified by "msvc6", "msvc7", "msvc71", or "msvc8" (if "cl" is given, GCC-XML attempts to guess which VS to use).
</li>
<li>
<b><code>GCCXML_CXXFLAGS</code></b>: The flags for the C++ compiler to be simulated. The behavior of most compilers can be adjusted by specifying flags on the command line. When GCC-XML attempts to automatically determine how to simulate a compiler, these flags are taken into consideration.
</li>
<li>
<b><code>GCCXML_CONFIG</code></b>: The configuration file for common settings. When non-default settings are often used, it is convenient to write a single file containing them. When such a file is specified, it will be read to configure any settings that are not yet known. Each line of the file consists of one assignment of the form KEY="VALUE" (for example, GCCXML_COMPILER="g++").
</li>
<li>
<b><code>GCCXML_EXECUTABLE</code></b>: Specify the patched GCC C++ parser executable. The GCC-XML program as seen by the user is actually a front-end that determines the flags needed to configure the patched GCC C++ parser to simulate another compiler. This setting specifies the real executable to run once the flags have been determined. Users should rarely need to change this value from its default.
</li>
<li>
<b><code>GCCXML_CPP</code></b>: Specify the GCC C preprocessor executable. The GCC-XML program as seen by the user is actually a front-end that determines the flags needed to configure the patched GCC C++ parser to simulate another compiler. This setting specifies the preprocessor to run with the flags that have been determined for debugging purposes. Users should rarely need to change this value from its default.
</li>
<li>
<b><code>GCCXML_ROOT</code></b>: The GCC-XML support library directory. Since GCC-XML is only one C++ parser, it cannot exactly duplicate the functionality of every compiler it tries to simulate. Some compilers provide standard headers with code that GCC-XML cannot directly handle. To work around this limitation, a support library is provided for each compiler. This consists of a set of header files that are used in place of the compiler's system headers. These files contain slight tweaks and then include the corresponding real header. The root of the directory tree containing these support library headers is specified by this setting. Users should rarely need to change this value from its default.
</li>
<li>
<b><code>GCCXML_FLAGS</code></b>: Flags used to simulate the other compiler. When GCC-XML runs the patched GCC C++ parser, these flags are passed to the program to tell it how to simulate a particular compiler. This setting is usually detected automatically from the other settings, but it can be specified directly by advanced users. Most users should not attempt to change this value from the automatic configuration.
</li>
<li>
<b><code>GCCXML_USER_FLAGS</code></b>: Additional user flags for compiler simulation. When GCC-XML runs the patched GCC C++ parser, these flags are passed in addition to those specified by GCCXML_FLAGS. This allows advanced users to tweak the compiler simulation while still using the automatic configuration of GCCXML_FLAGS. Users should rarely need to change this value from its default.
</li>
</ul>
There are several means by which these settings are configured. They are listed here in order of precedence (highest first):
<ul>
<li>
<b><code>Command-line Options</code></b>: Settings can be specified by their corresponding options. When a setting's corresponding command-line option is provided, it is used in favor over any other means of configuration. If GCCXML_CONFIG is set on the command-line, settings are read from the file with precedence just slightly lower than other command-line options.
</li>
<li>
<b><code>Environment Variables</code></b>: Settings are configured by name in the environment. Each setting not already known is read from an environment variable with its name. If GCCXML_CONFIG is set by the environment, settings are read from the file with precedence just slightly lower than other environment variables.
</li>
<li>
<b><code>Configuration Files</code></b>: A search for GCCXML_CONFIG is performed. If GCCXML_CONFIG has not yet been set, an attempt is made to find a configuration file automatically. First, if the file $HOME/.gccxml/config exists, it will be used. Second, if GCC-XML is being executed from its build directory, a config file from that directory will be used. Finally, if a config file is found in the installation's support library directory, it will be used. Once found, any unknown settings are read from the configuration file.
</li>
<li>
<b><code>Guessing</code></b>: Guesses are made based on other settings. Once GCCXML_COMPILER has been set, it is used to automatically find the setting for GCCXML_FLAGS. If it is not set, the "CXX" environment variable is checked as a last-resort to find the compiler setting and determine GCCXML_FLAGS.
</li>
</ul>
Most users should not have to adjust the defaults for these settings. There is a default GCCXML_CONFIG file provided in the support library directory after installation. It configures GCC-XML to simulate the compiler that was used to build it.
<h2>Supported Compilers</h2>
GCC-XML can simulate any of the following compilers:
<ul>
<li>
<b><code>GCC</code></b>: Versions 4.2, 4.1, 4.0, 3.4, 3.3, 3.2, 2.95.x
</li>
<li>
<b><code>Visual C++</code></b>: Versions 8, 7.1, 7.0, and 6 (sp5)
</li>
<li>
<b><code>Borland, Intel, SGI</code></b>: formerly supported but no longer tested
</li>
</ul>
The following extra C preprocessor definitions are provided:
<ul>
<li>
<b><code>-D__GCCXML__=MMmmpp</code></b>: MM, mm, and pp are the major, minor, and patch versions of GCC-XML. This preprocessor symbol identifies GCC-XML to the source code as it is preprocessed. It can be used to enable GCC-XML-specific information.
</li>
<li>
<b><code>-D__GCCXML_GNUC__=M</code></b>: Defined to internal GCC parser major version.
</li>
<li>
<b><code>-D__GCCXML_GNUC_MINOR__=m</code></b>: Defined to internal GCC parser minor version.
</li>
<li>
<b><code>-D__GCCXML_GNUC_PATCHLEVEL__=p</code></b>: Defined to internal GCC parser patchlevel.
</li>
</ul>
Advanced users can simulate other compilers by manually configuring the GCCXML_FLAGS setting. Contact the mailing list for help.
<h2>C++ Meta Information</h2>
GCC-XML has added a new attribute to the legal set of C/C++ attributes. The attribute is used to attach meta information to C/C++ source code, which will then appear in the XML output. The syntax for declaring an attribute is as follows:
<ul>
<li>
<b><code>__attribute((gccxml(<string>, <string>, ...)))</code></b>: Here <string> is a quoted string. There must be at least one argument to the 'gccxml' attribute, but there is no upper limit to the total number of arguments. Each argument is verified to be a string - if a non-string argument is found, the attribute is ignored.
</li>
</ul>
The XML output for the code element that is tagged with the attribute will then contain the following:
<ul>
<li>
<b><code>attributes=" ... gccxml(<string>,<string>,<string> ...) ... "</code></b>: The 'attributes' XML attribute contains all attributes applied to the code element. Each argument of the attribute is printed without enclosing quotes, so if an argument contains the ',' character, the argument will appear to be multiple arguments.
</li>
</ul>
The 'gccxml' attribute can be applied to any declaration including structs, classes, fields, parameters, methods, functions, variables, and typedefs. The only exception is that GCC's handling of the '__attribute' language element is currently broken for enumerations and constructors with an inlined body. The 'gccxml' attribute can be used any number of times on a given declaration.
As an example of how this attribute can be used to attach meta information to C++ declarations, consider the following macro:
<ul>
<li>
<b><code>#define _out_ __attribute((gccxml("out")))</code></b>: Here '_out_' has been defined to be the gccxml attribute where the first argument is the string "out". It is recommended that the first argument be used as a unique string name for the type of meta information begin applied.
</li>
</ul>
Now a method declaration can be written as follows:
<ul>
<li>
<b><code>void getInteger(_out_ int& i);</code></b>: This will cause the XML output to contain meta information for the '_out_' attribute, in the form "gccxml(out)".
</li>
</ul>
Using the 'gccxml' attribute enables meta information to be included directly within C++ source code, without the need for a custom parser to extract the meta information. The 'gccxml' attribute is provided for convenience only - there is no guarantee that future versions of GCC will accept the '__attribute' language element in a bug-free manner.
</body>
</html>
|