BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslscm_version.h
Go to the documentation of this file.
1/// @file bslscm_version.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslscm_version.h -*-C++-*-
8#ifndef INCLUDED_BSLSCM_VERSION
9#define INCLUDED_BSLSCM_VERSION
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bslscm_version bslscm_version
15/// @brief Provide source control management (versioning) information.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslscm
19/// @{
20/// @addtogroup bslscm_version
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslscm_version-purpose"> Purpose</a>
25/// * <a href="#bslscm_version-classes"> Classes </a>
26/// * <a href="#bslscm_version-description"> Description </a>
27/// * <a href="#bslscm_version-usage"> Usage </a>
28///
29/// # Purpose {#bslscm_version-purpose}
30/// Provide source control management (versioning) information.
31///
32/// # Classes {#bslscm_version-classes}
33///
34/// - bslscm::Version: namespace for RCS and SCCS versioning information for `bsl`
35///
36/// # Description {#bslscm_version-description}
37/// This component provides source control management (versioning)
38/// information for the `bsl` package group. In particular, this component
39/// embeds RCS-style and SCCS-style version strings in binary executable files
40/// that use one or more components from the `bsl` package group. This version
41/// information may be extracted from binary files using common UNIX utilities
42/// (e.g., `ident` and `what`). In addition, the `version` `static` member
43/// function in the `bslscm::Version` `struct` can be used to query version
44/// information for the `bsl` package group at runtime. The following usage
45/// examples illustrate these two basic capabilities.
46///
47/// Note that unless the `version` method will be called, it is not necessary to
48/// `#include` this component header file to get `bsl` version information
49/// embedded in an executable. It is only necessary to use one or more `bsl`
50/// components (and, hence, link in the `bsl` library).
51///
52/// ## Usage {#bslscm_version-usage}
53///
54///
55/// A program can display the version of BSL that was used to build it by
56/// printing the version string returned by `bslscm::Version::version()` to
57/// `stdout` as follows:
58/// @code
59/// std::printf("BSL version: %s\n", bslscm::Version::version());
60/// @endcode
61/// @}
62/** @} */
63/** @} */
64
65/** @addtogroup bsl
66 * @{
67 */
68/** @addtogroup bslscm
69 * @{
70 */
71/** @addtogroup bslscm_version
72 * @{
73 */
74
75#include <bsls_buildtarget.h> // need to ensure consistent build options
76#include <bsls_platform.h>
77#include <bsls_linkcoercion.h>
78
79#include <bslscm_versiontag.h> // BSL_VERSION_MAJOR, BSL_VERSION_MINOR
80
81
82
83namespace bslscm {
84
85 // =======
86 // Version
87 // =======
88
89/// This struct provides a namespace for (1) source control management
90/// (versioning) information that is embedded in binary executable files,
91/// and (2) a facility to query that information at runtime.
92///
93/// See @ref bslscm_version
94struct Version {
95
96 // CLASS DATA
97 static const char *s_ident;
98 static const char *s_what;
99
100#define BSLSCM_CONCAT2(a,b,c,d,e,f) a ## b ## c ## d ## e ## f
101#define BSLSCM_CONCAT(a,b,c,d,e,f) BSLSCM_CONCAT2(a,b,c,d,e,f)
102
103// 'BSLSCM_D_VERSION' is a symbol whose name warns users of version mismatch
104// linking errors. Note that the exact string "compiled_this_object" must be
105// present in this version coercion symbol. Tools may look for this pattern to
106// warn users of mismatches.
107
108#define BSLSCM_S_VERSION BSLSCM_CONCAT(s_version_BSL_, \
109 BSL_VERSION_MAJOR, _, \
110 BSL_VERSION_MINOR, _, \
111 compiled_this_object)
112
113 static const char *BSLSCM_S_VERSION;
114
115 static const char *s_dependencies;
116 static const char *s_buildInfo;
117 static const char *s_timestamp;
118 static const char *s_sourceControlInfo;
119
120 // CLASS METHODS
121
122 /// Return the address of a character string that identifies the version
123 /// of the `bsl` package group in use.
124 static const char *version();
125};
126
127// ============================================================================
128// INLINE DEFINITIONS
129// ============================================================================
130
131 // --------------
132 // struct Version
133 // --------------
134
135// CLASS METHODS
136inline
137const char *Version::version()
138{
139 return BSLSCM_S_VERSION;
140}
141
142} // close package namespace
143
144// Force linker to pull in this component's object file.
145
147 bslscm_version_assertion,
149
150
151
152#endif
153
154// ----------------------------------------------------------------------------
155// Copyright 2013 Bloomberg Finance L.P.
156//
157// Licensed under the Apache License, Version 2.0 (the "License");
158// you may not use this file except in compliance with the License.
159// You may obtain a copy of the License at
160//
161// http://www.apache.org/licenses/LICENSE-2.0
162//
163// Unless required by applicable law or agreed to in writing, software
164// distributed under the License is distributed on an "AS IS" BASIS,
165// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
166// See the License for the specific language governing permissions and
167// limitations under the License.
168// ----------------------------- END-OF-FILE ----------------------------------
169
170/** @} */
171/** @} */
172/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_LINKCOERCION_FORCE_SYMBOL_DEPENDENCY(type, refName, referredSymbol)
Definition bsls_linkcoercion.h:203
Definition bslscm_version.h:83
Definition bslscm_version.h:94
static const char * s_sourceControlInfo
Definition bslscm_version.h:118
static const char * BSLSCM_S_VERSION
Definition bslscm_version.h:113
static const char * s_ident
Definition bslscm_version.h:97
static const char * s_what
Definition bslscm_version.h:98
static const char * s_dependencies
Definition bslscm_version.h:115
static const char * s_timestamp
Definition bslscm_version.h:117
static const char * s_buildInfo
Definition bslscm_version.h:116
static const char * version()
Definition bslscm_version.h:137