xref: /netbsd-src/external/gpl3/gcc.old/dist/libstdc++-v3/doc/html/manual/using_macros.html (revision c9496f6b604074a9451a67df576a5b423068e71e)
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!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>Macros</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_headers.html" title="Headers" /><link rel="next" href="using_dual_abi.html" title="Dual ABI" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Macros</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_headers.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_dual_abi.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.macros"></a>Macros</h2></div></div></div><p>
3     All library macros begin with <code class="code">_GLIBCXX_</code>.
4   </p><p>
5     Furthermore, all pre-processor macros, switches, and
6      configuration options are gathered in the
7      file <code class="filename">c++config.h</code>, which
8      is generated during the libstdc++ configuration and build
9      process. This file is then included when needed by files part of
10      the public libstdc++ API, like
11      <code class="filename">&lt;ios&gt;</code>. Most of these
12      macros should not be used by consumers of libstdc++, and are reserved
13      for internal implementation use. <span class="emphasis"><em>These macros cannot
14      be redefined</em></span>.
15   </p><p>
16     A select handful of macros control libstdc++ extensions and extra
17      features, or provide versioning information for the API.  Only
18      those macros listed below are offered for consideration by the
19      general public.
20   </p><p>Below is the macro which users may check for library version
21      information. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">__GLIBCXX__</code></span></dt><dd><p>The current version of
22    libstdc++ in compressed ISO date format, as an unsigned
23    long. For details on the value of this particular macro for a
24    particular release, please consult the <a class="link" href="abi.html" title="ABI Policy and Guidelines">
25    ABI Policy and Guidelines</a> appendix.
26    </p></dd></dl></div><p>Below are the macros which users may change with #define/#undef or
27      with -D/-U compiler flags.  The default state of the symbol is
28      listed.</p><p><span class="quote">“<span class="quote">Configurable</span>”</span> (or <span class="quote">“<span class="quote">Not configurable</span>”</span>) means
29      that the symbol is initially chosen (or not) based on
30      --enable/--disable options at library build and configure time
31      (documented in
32      <a class="link" href="configure.html" title="Configure">Configure</a>),
33      with the various --enable/--disable choices being translated to
34      #define/#undef).
35   </p><p> <acronym class="acronym">ABI</acronym> means that changing from the default value may
36  mean changing the <acronym class="acronym">ABI</acronym> of compiled code. In other words,
37  these choices control code which has already been compiled (i.e., in a
38  binary such as libstdc++.a/.so).  If you explicitly #define or
39  #undef these macros, the <span class="emphasis"><em>headers</em></span> may see different code
40  paths, but the <span class="emphasis"><em>libraries</em></span> which you link against will not.
41  Experimenting with different values with the expectation of
42  consistent linkage requires changing the config headers before
43  building/installing the library.
44   </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">_GLIBCXX_USE_DEPRECATED</code></span></dt><dd><p>
45	Defined by default. Not configurable. ABI-changing. Turning this off
46	removes older ARM-style iostreams code, and other anachronisms
47	from the API.  This macro is dependent on the version of the
48	standard being tracked, and as a result may give different results for
49	<code class="code">-std=c++98</code> and <code class="code">-std=c++11</code>. This may
50	be useful in updating old C++ code which no longer meet the
51	requirements of the language, or for checking current code
52	against new language standards.
53    </p></dd><dt><span class="term"><code class="code">_GLIBCXX_USE_CXX11_ABI</code></span></dt><dd><p>
54        Defined to the value <code class="literal">1</code> by default.
55        Configurable via  <code class="code">--disable-libstdcxx-dual-abi</code>
56        and/or <code class="code">--with-default-libstdcxx-abi</code>.
57        ABI-changing.
58        When defined to a non-zero value the library headers will use the
59        new C++11-conforming ABI introduced in GCC 5, rather than the older
60        ABI introduced in GCC 3.4. This changes the definition of several
61        class templates, including <code class="classname">std:string</code>,
62        <code class="classname">std::list</code> and some locale facets.
63        For more details see <a class="xref" href="using_dual_abi.html" title="Dual ABI">Dual ABI</a>.
64    </p></dd><dt><span class="term"><code class="code">_GLIBCXX_CONCEPT_CHECKS</code></span></dt><dd><p>
65	Undefined by default.  Configurable via
66	<code class="code">--enable-concept-checks</code>.  When defined, performs
67	compile-time checking on certain template instantiations to
68	detect violations of the requirements of the standard.  This
69	is described in more detail in
70	<a class="link" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks">Compile Time Checks</a>.
71      </p></dd><dt><span class="term"><code class="code">_GLIBCXX_DEBUG</code></span></dt><dd><p>
72	Undefined by default. When defined, compiles user code using
73	the <a class="link" href="debug_mode.html" title="Chapter 17. Debug Mode">debug mode</a>.
74      </p></dd><dt><span class="term"><code class="code">_GLIBCXX_DEBUG_PEDANTIC</code></span></dt><dd><p>
75	Undefined by default. When defined while compiling with
76	the <a class="link" href="debug_mode.html" title="Chapter 17. Debug Mode">debug mode</a>, makes
77	the debug mode extremely picky by making the use of libstdc++
78	extensions and libstdc++-specific behavior into errors.
79      </p></dd><dt><span class="term"><code class="code">_GLIBCXX_PARALLEL</code></span></dt><dd><p>Undefined by default. When defined, compiles user code
80	using the <a class="link" href="parallel_mode.html" title="Chapter 18. Parallel Mode">parallel
81	mode</a>.
82      </p></dd><dt><span class="term"><code class="code">_GLIBCXX_PROFILE</code></span></dt><dd><p>Undefined by default. When defined, compiles user code
83	using the <a class="link" href="profile_mode.html" title="Chapter 19. Profile Mode">profile
84	mode</a>.
85      </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="using_headers.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="using_dual_abi.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Headers </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Dual ABI</td></tr></table></div></body></html>