BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls_buildtarget.h
Go to the documentation of this file.
1/// @file bsls_buildtarget.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bsls_buildtarget.h -*-C++-*-
8#ifndef INCLUDED_BSLS_BUILDTARGET
9#define INCLUDED_BSLS_BUILDTARGET
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bsls_buildtarget bsls_buildtarget
15/// @brief Provide build-target information in object files.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bsls
19/// @{
20/// @addtogroup bsls_buildtarget
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bsls_buildtarget-purpose"> Purpose</a>
25/// * <a href="#bsls_buildtarget-macros"> Macros </a>
26/// * <a href="#bsls_buildtarget-description"> Description </a>
27/// * <a href="#bsls_buildtarget-compiler-version-check-macro"> Compiler Version Check Macro </a>
28/// * <a href="#bsls_buildtarget-standard-version-inconsistency-check-macro"> Standard Version Inconsistency Check Macro </a>
29/// * <a href="#bsls_buildtarget-deprecation-control-macros"> Deprecation Control Macros </a>
30/// * <a href="#bsls_buildtarget-usage"> Usage </a>
31///
32/// # Purpose {#bsls_buildtarget-purpose}
33/// Provide build-target information in object files.
34///
35/// # Macros {#bsls_buildtarget-macros}
36///
37/// - BDE_BUILD_TARGET_EXC: flag identifying exception-enabled builds
38/// - BDE_BUILD_TARGET_NO_EXC: flag identifying exception-disabled builds
39/// - BDE_BUILD_TARGET_MT: flag identifying multi-threaded builds
40/// - BDE_BUILD_TARGET_NO_MT: flag identifying builds that do not support threads
41/// - BDE_BUILD_SKIP_VERSION_CHECKS: turn off compiler version checks
42/// - BDE_OMIT_DEPRECATED: legacy flag to deprecate a block of code
43/// - BDE_OMIT_INTERNAL_DEPRECATED: legacy flag to deprecate internal-only code
44/// - BDE_OPENSOURCE_PUBLICATION: marker for non-deprecated internal-only code
45///
46/// @see bsls_deprecate
47///
48/// # Description {#bsls_buildtarget-description}
49/// The purpose of this component is to cause a link-time error
50/// when trying to link an executable with incompatible libraries. This
51/// component defines type names that indicate two build target parameters.
52/// These parameters determine whether the build was exception-enabled (which is
53/// the case unless overridden by defining the `BDE_BUILD_TARGET_NO_EXC` macro),
54/// and whether it was multi-threaded (which is enabled unless overridden by
55/// defining the `BDE_BUILD_TARGET_NO_MT` macro). The types defined by this
56/// component should not be used directly. This component also documents macros
57/// that can be used to disable checks that are performed elsewhere.
58///
59/// ## Compiler Version Check Macro {#bsls_buildtarget-compiler-version-check-macro}
60///
61///
62/// By design, programs using BDE fail to build if support for a C++ standard
63/// version is requested but the compiler's support for that standard is not
64/// sufficiently stable (possibly causing issues at runtime that are very
65/// difficult to debug). We provide the macro `BDE_BUILD_SKIP_VERSION_CHECKS`
66/// to disable these checks for the purpose of testing and experimenting with
67/// different compiler configurations. This macro should **not** be defined for
68/// integrated production builds such as dpkg, as doing so may result in
69/// unstable code being deployed to production.
70///
71/// ## Standard Version Inconsistency Check Macro {#bsls_buildtarget-standard-version-inconsistency-check-macro}
72///
73///
74/// C++ object files built using a particular standard version must be linked
75/// with BDE libraries built using the same standard version, or else the
76/// program will be ill formed, no diagnostic required (IFNDR) and may exhibit
77/// issues at runtime that are very difficult to debug.
78///
79/// ## Deprecation Control Macros {#bsls_buildtarget-deprecation-control-macros}
80///
81///
82/// In addition to the `BDE_BUILD_TARGET_*` macros that determine the link-time
83/// compatibility of different libraries built on BDE, this component documents
84/// a macro that determines whether deprecated interfaces are available to
85/// programs built on BDE:
86///
87/// `BDE_OMIT_DEPRECATED`:
88/// This macro, if defined, indicates that all code deprecated before BDE
89/// 3.2 will be either omitted from a build of the library (if the code has
90/// not been updated to use @ref bsls_deprecate ), or identified to the
91/// compiler as deprecated (if the code has been updated to use
92/// @ref bsls_deprecate ). New uses of this macro are not supported; use
93/// @ref bsls_deprecate instead.
94///
95/// In addition to `BDE_OMIT_DEPRECATED`, there are two other macros that also
96/// determine whether deprecated interfaces are available to programs built on
97/// BDE:
98///
99/// `BDE_OMIT_INTERNAL_DEPRECATED`:
100/// This macro, if defined, indicates that all internal-only code
101/// deprecated before BDE 3.2 will be either omitted from a build of the
102/// library (if the code has not been updated to use @ref bsls_deprecate ), or
103/// identified to the compiler as deprecated (if the code has been updated
104/// to use @ref bsls_deprecate ). This category consists almost entirely of
105/// code that was already deprecated at the time of a component's initial
106/// release to open-source. New uses of this macro are not supported; use
107/// @ref bsls_deprecate instead.
108///
109/// `BDE_OPENSOURCE_PUBLICATION`:
110/// This macro marks code that is not deprecated, but is nevertheless
111/// excluded from the open-source release of BDE. This category consists
112/// primarily of code that exists to support STLPort containers, which were
113/// not included in the open-source release, or that documents backward
114/// compatibility access to the package-prefix versions of non-deprecated
115/// symbols in BSL. `BDE_OPENSOURCE_PUBLICATION` exists for purposes of
116/// documentation only, and should not be defined for any build of the
117/// library. In particular, there is no guarantee that the library will
118/// build or will function correctly if `BDE_OPENSOURCE_PUBLICATION` is
119/// defined.
120///
121/// Together with `BDE_OMIT_DEPRECATED`, these macros divide the BDE codebase
122/// into four categories:
123/// @code
124/// +-----------------------------------------+------------------------------+
125/// | CATEGORY | LABEL |
126/// +=========================================+==============================+
127/// | universally distributed code | no label |
128/// +-----------------------------------------+------------------------------+
129/// | Bloomberg-only code | BDE_OPENSOURCE_PUBLICATION |
130/// +-----------------------------------------+------------------------------+
131/// | universally distributed code deprecated | BDE_OMIT_DEPRECATED |
132/// | before BDE 3.2 | |
133/// +-----------------------------------------+------------------------------+
134/// | Bloomberg-only code deprecated before | BDE_OMIT_INTERNAL_DEPRECATED |
135/// | BDE 3.2 | |
136/// +-----------------------------------------+------------------------------+
137/// @endcode
138/// By default, all code in BDE is both current and universally distributed.
139/// All code that is deprecated, excluded from our open-source distribution, or
140/// both, is surrounded with conditional compilation macros to allow test builds
141/// without that code, and/or to make it easy to prepare an open-source
142/// distribution from the full internal BDE codebase. The conditional
143/// compilation macros are:
144///
145/// ## Usage {#bsls_buildtarget-usage}
146///
147///
148/// There is no usage example for this component since it is not meant for
149/// direct client use.
150/// @}
151/** @} */
152/** @} */
153
154/** @addtogroup bsl
155 * @{
156 */
157/** @addtogroup bsls
158 * @{
159 */
160/** @addtogroup bsls_buildtarget
161 * @{
162 */
163
164#include <bsls_linkcoercion.h>
165#include <bsls_platform.h>
166
167
168
169// ============================================================================
170// BDE_BUILD_TARGET_EXC/BDE_BUILD_TARGET_NO_EXC
171// ============================================================================
172
173// Default to an exception-enabled build unless 'BDE_BUILD_TARGET_NO_EXC' is
174// defined.
175
176#ifndef BDE_BUILD_TARGET_NO_EXC
177
178#ifndef BDE_BUILD_TARGET_EXC
179#define BDE_BUILD_TARGET_EXC
180#endif
181
182namespace bsls {
183
185 static const int s_isBuildTargetExc;
186};
188
189} // close package namespace
190
191#else
192
193#ifdef BDE_BUILD_TARGET_EXC
194#error Do not define both BDE_BUILD_TARGET_EXC and BDE_BUILD_TARGET_NO_EXC
195#endif
196
197namespace bsls {
198
199struct BuildTargetExcNo {
200 static const int s_isBuildTargetExc;
201};
202typedef BuildTargetExcNo BuildTargetExc;
203
204} // close package namespace
205
206#endif
207
209 const int,
210 bsls_buildtarget_coerce_exc,
212
213// ============================================================================
214// BDE_BUILD_TARGET_MT/BDE_BUILD_TARGET_NO_MT
215// ============================================================================
216
217// Default to a threaded (MT) build unless 'BDE_BUILD_TARGET_NO_MT' is defined.
218
219#ifndef BDE_BUILD_TARGET_NO_MT
220
221#ifndef BDE_BUILD_TARGET_MT
222#define BDE_BUILD_TARGET_MT
223#endif
224
225namespace bsls {
226
227struct BuildTargetMtYes {
228 static const int s_isBuildTargetMt;
229};
230typedef BuildTargetMtYes BuildTargetMt;
231
232} // close package namespace
233
234#else
235
236#ifdef BDE_BUILD_TARGET_MT
237#error Do not define both BDE_BUILD_TARGET_MT and BDE_BUILD_TARGET_NO_MT
238#endif
239
240namespace bsls {
241
242struct BuildTargetMtNo {
243 static const int s_isBuildTargetMt;
244};
245typedef BuildTargetMtNo BuildTargetMt;
246
247} // close package namespace
248
249#endif
250
252 const int,
253 bsls_buildtarget_coerce_mt,
254 bsls::BuildTargetMt::s_isBuildTargetMt)
255
256
257
258#endif
259
260// ----------------------------------------------------------------------------
261// Copyright 2013 Bloomberg Finance L.P.
262//
263// Licensed under the Apache License, Version 2.0 (the "License");
264// you may not use this file except in compliance with the License.
265// You may obtain a copy of the License at
266//
267// http://www.apache.org/licenses/LICENSE-2.0
268//
269// Unless required by applicable law or agreed to in writing, software
270// distributed under the License is distributed on an "AS IS" BASIS,
271// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
272// See the License for the specific language governing permissions and
273// limitations under the License.
274// ----------------------------- END-OF-FILE ----------------------------------
275
276/** @} */
277/** @} */
278/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_LINKCOERCION_FORCE_SYMBOL_DEPENDENCY(type, refName, referredSymbol)
Definition bsls_linkcoercion.h:194
Definition bdlt_iso8601util.h:691
BuildTargetExcYes BuildTargetExc
Definition bsls_buildtarget.h:187
Definition bsls_buildtarget.h:184
static const int s_isBuildTargetExc
Definition bsls_buildtarget.h:185