|
|
|||
File indexing completed on 2025-12-16 09:40:43
0001 // Copyright 2019 The Abseil Authors. 0002 // 0003 // Licensed under the Apache License, Version 2.0 (the "License"); 0004 // you may not use this file except in compliance with the License. 0005 // You may obtain a copy of the License at 0006 // 0007 // https://www.apache.org/licenses/LICENSE-2.0 0008 // 0009 // Unless required by applicable law or agreed to in writing, software 0010 // distributed under the License is distributed on an "AS IS" BASIS, 0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0012 // See the License for the specific language governing permissions and 0013 // limitations under the License. 0014 // 0015 // ----------------------------------------------------------------------------- 0016 // File: options.h 0017 // ----------------------------------------------------------------------------- 0018 // 0019 // This file contains Abseil configuration options for setting specific 0020 // implementations instead of letting Abseil determine which implementation to 0021 // use at compile-time. Setting these options may be useful for package or build 0022 // managers who wish to guarantee ABI stability within binary builds (which are 0023 // otherwise difficult to enforce). 0024 // 0025 // *** IMPORTANT NOTICE FOR PACKAGE MANAGERS: It is important that 0026 // maintainers of package managers who wish to package Abseil read and 0027 // understand this file! *** 0028 // 0029 // Abseil contains a number of possible configuration endpoints, based on 0030 // parameters such as the detected platform, language version, or command-line 0031 // flags used to invoke the underlying binary. As is the case with all 0032 // libraries, binaries which contain Abseil code must ensure that separate 0033 // packages use the same compiled copy of Abseil to avoid a diamond dependency 0034 // problem, which can occur if two packages built with different Abseil 0035 // configuration settings are linked together. Diamond dependency problems in 0036 // C++ may manifest as violations to the One Definition Rule (ODR) (resulting in 0037 // linker errors), or undefined behavior (resulting in crashes). 0038 // 0039 // Diamond dependency problems can be avoided if all packages utilize the same 0040 // exact version of Abseil. Building from source code with the same compilation 0041 // parameters is the easiest way to avoid such dependency problems. However, for 0042 // package managers who cannot control such compilation parameters, we are 0043 // providing the file to allow you to inject ABI (Application Binary Interface) 0044 // stability across builds. Settings options in this file will neither change 0045 // API nor ABI, providing a stable copy of Abseil between packages. 0046 // 0047 // Care must be taken to keep options within these configurations isolated 0048 // from any other dynamic settings, such as command-line flags which could alter 0049 // these options. This file is provided specifically to help build and package 0050 // managers provide a stable copy of Abseil within their libraries and binaries; 0051 // other developers should not have need to alter the contents of this file. 0052 // 0053 // ----------------------------------------------------------------------------- 0054 // Usage 0055 // ----------------------------------------------------------------------------- 0056 // 0057 // For any particular package release, set the appropriate definitions within 0058 // this file to whatever value makes the most sense for your package(s). Note 0059 // that, by default, most of these options, at the moment, affect the 0060 // implementation of types; future options may affect other implementation 0061 // details. 0062 // 0063 // NOTE: the defaults within this file all assume that Abseil can select the 0064 // proper Abseil implementation at compile-time, which will not be sufficient 0065 // to guarantee ABI stability to package managers. 0066 0067 #ifndef ABSL_BASE_OPTIONS_H_ 0068 #define ABSL_BASE_OPTIONS_H_ 0069 0070 // ----------------------------------------------------------------------------- 0071 // Type Compatibility Options 0072 // ----------------------------------------------------------------------------- 0073 // 0074 // ABSL_OPTION_USE_STD_ANY 0075 // 0076 // This option controls whether absl::any is implemented as an alias to 0077 // std::any, or as an independent implementation. 0078 // 0079 // A value of 0 means to use Abseil's implementation. This requires only C++11 0080 // support, and is expected to work on every toolchain we support. 0081 // 0082 // A value of 1 means to use an alias to std::any. This requires that all code 0083 // using Abseil is built in C++17 mode or later. 0084 // 0085 // A value of 2 means to detect the C++ version being used to compile Abseil, 0086 // and use an alias only if a working std::any is available. This option is 0087 // useful when you are building your entire program, including all of its 0088 // dependencies, from source. It should not be used otherwise -- for example, 0089 // if you are distributing Abseil in a binary package manager -- since in 0090 // mode 2, absl::any will name a different type, with a different mangled name 0091 // and binary layout, depending on the compiler flags passed by the end user. 0092 // For more info, see https://abseil.io/about/design/dropin-types. 0093 // 0094 // User code should not inspect this macro. To check in the preprocessor if 0095 // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. 0096 0097 #define ABSL_OPTION_USE_STD_ANY 1 0098 0099 0100 // ABSL_OPTION_USE_STD_OPTIONAL 0101 // 0102 // This option controls whether absl::optional is implemented as an alias to 0103 // std::optional, or as an independent implementation. 0104 // 0105 // A value of 0 means to use Abseil's implementation. This requires only C++11 0106 // support, and is expected to work on every toolchain we support. 0107 // 0108 // A value of 1 means to use an alias to std::optional. This requires that all 0109 // code using Abseil is built in C++17 mode or later. 0110 // 0111 // A value of 2 means to detect the C++ version being used to compile Abseil, 0112 // and use an alias only if a working std::optional is available. This option 0113 // is useful when you are building your program from source. It should not be 0114 // used otherwise -- for example, if you are distributing Abseil in a binary 0115 // package manager -- since in mode 2, absl::optional will name a different 0116 // type, with a different mangled name and binary layout, depending on the 0117 // compiler flags passed by the end user. For more info, see 0118 // https://abseil.io/about/design/dropin-types. 0119 0120 // User code should not inspect this macro. To check in the preprocessor if 0121 // absl::optional is a typedef of std::optional, use the feature macro 0122 // ABSL_USES_STD_OPTIONAL. 0123 0124 #define ABSL_OPTION_USE_STD_OPTIONAL 1 0125 0126 0127 // ABSL_OPTION_USE_STD_STRING_VIEW 0128 // 0129 // This option controls whether absl::string_view is implemented as an alias to 0130 // std::string_view, or as an independent implementation. 0131 // 0132 // A value of 0 means to use Abseil's implementation. This requires only C++11 0133 // support, and is expected to work on every toolchain we support. 0134 // 0135 // A value of 1 means to use an alias to std::string_view. This requires that 0136 // all code using Abseil is built in C++17 mode or later. 0137 // 0138 // A value of 2 means to detect the C++ version being used to compile Abseil, 0139 // and use an alias only if a working std::string_view is available. This 0140 // option is useful when you are building your program from source. It should 0141 // not be used otherwise -- for example, if you are distributing Abseil in a 0142 // binary package manager -- since in mode 2, absl::string_view will name a 0143 // different type, with a different mangled name and binary layout, depending on 0144 // the compiler flags passed by the end user. For more info, see 0145 // https://abseil.io/about/design/dropin-types. 0146 // 0147 // User code should not inspect this macro. To check in the preprocessor if 0148 // absl::string_view is a typedef of std::string_view, use the feature macro 0149 // ABSL_USES_STD_STRING_VIEW. 0150 0151 #define ABSL_OPTION_USE_STD_STRING_VIEW 1 0152 0153 // ABSL_OPTION_USE_STD_VARIANT 0154 // 0155 // This option controls whether absl::variant is implemented as an alias to 0156 // std::variant, or as an independent implementation. 0157 // 0158 // A value of 0 means to use Abseil's implementation. This requires only C++11 0159 // support, and is expected to work on every toolchain we support. 0160 // 0161 // A value of 1 means to use an alias to std::variant. This requires that all 0162 // code using Abseil is built in C++17 mode or later. 0163 // 0164 // A value of 2 means to detect the C++ version being used to compile Abseil, 0165 // and use an alias only if a working std::variant is available. This option 0166 // is useful when you are building your program from source. It should not be 0167 // used otherwise -- for example, if you are distributing Abseil in a binary 0168 // package manager -- since in mode 2, absl::variant will name a different 0169 // type, with a different mangled name and binary layout, depending on the 0170 // compiler flags passed by the end user. For more info, see 0171 // https://abseil.io/about/design/dropin-types. 0172 // 0173 // User code should not inspect this macro. To check in the preprocessor if 0174 // absl::variant is a typedef of std::variant, use the feature macro 0175 // ABSL_USES_STD_VARIANT. 0176 0177 #define ABSL_OPTION_USE_STD_VARIANT 1 0178 0179 // ABSL_OPTION_USE_STD_ORDERING 0180 // 0181 // This option controls whether absl::{partial,weak,strong}_ordering are 0182 // implemented as aliases to the std:: ordering types, or as an independent 0183 // implementation. 0184 // 0185 // A value of 0 means to use Abseil's implementation. This requires only C++11 0186 // support, and is expected to work on every toolchain we support. 0187 // 0188 // A value of 1 means to use aliases. This requires that all code using Abseil 0189 // is built in C++20 mode or later. 0190 // 0191 // A value of 2 means to detect the C++ version being used to compile Abseil, 0192 // and use an alias only if working std:: ordering types are available. This 0193 // option is useful when you are building your program from source. It should 0194 // not be used otherwise -- for example, if you are distributing Abseil in a 0195 // binary package manager -- since in mode 2, they will name different types, 0196 // with different mangled names and binary layout, depending on the compiler 0197 // flags passed by the end user. For more info, see 0198 // https://abseil.io/about/design/dropin-types. 0199 // 0200 // User code should not inspect this macro. To check in the preprocessor if 0201 // the ordering types are aliases of std:: ordering types, use the feature macro 0202 // ABSL_USES_STD_ORDERING. 0203 0204 #define ABSL_OPTION_USE_STD_ORDERING 0 0205 0206 // ABSL_OPTION_USE_INLINE_NAMESPACE 0207 // ABSL_OPTION_INLINE_NAMESPACE_NAME 0208 // 0209 // These options controls whether all entities in the absl namespace are 0210 // contained within an inner inline namespace. This does not affect the 0211 // user-visible API of Abseil, but it changes the mangled names of all symbols. 0212 // 0213 // This can be useful as a version tag if you are distributing Abseil in 0214 // precompiled form. This will prevent a binary library build of Abseil with 0215 // one inline namespace being used with headers configured with a different 0216 // inline namespace name. Binary packagers are reminded that Abseil does not 0217 // guarantee any ABI stability in Abseil, so any update of Abseil or 0218 // configuration change in such a binary package should be combined with a 0219 // new, unique value for the inline namespace name. 0220 // 0221 // A value of 0 means not to use inline namespaces. 0222 // 0223 // A value of 1 means to use an inline namespace with the given name inside 0224 // namespace absl. If this is set, ABSL_OPTION_INLINE_NAMESPACE_NAME must also 0225 // be changed to a new, unique identifier name. In particular "head" is not 0226 // allowed. 0227 0228 #define ABSL_OPTION_USE_INLINE_NAMESPACE 1 0229 #define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_20240722 0230 0231 // ABSL_OPTION_HARDENED 0232 // 0233 // This option enables a "hardened" build in release mode (in this context, 0234 // release mode is defined as a build where the `NDEBUG` macro is defined). 0235 // 0236 // A value of 0 means that "hardened" mode is not enabled. 0237 // 0238 // A value of 1 means that "hardened" mode is enabled. 0239 // 0240 // Hardened builds have additional security checks enabled when `NDEBUG` is 0241 // defined. Defining `NDEBUG` is normally used to turn `assert()` macro into a 0242 // no-op, as well as disabling other bespoke program consistency checks. By 0243 // defining ABSL_OPTION_HARDENED to 1, a select set of checks remain enabled in 0244 // release mode. These checks guard against programming errors that may lead to 0245 // security vulnerabilities. In release mode, when one of these programming 0246 // errors is encountered, the program will immediately abort, possibly without 0247 // any attempt at logging. 0248 // 0249 // The checks enabled by this option are not free; they do incur runtime cost. 0250 // 0251 // The checks enabled by this option are always active when `NDEBUG` is not 0252 // defined, even in the case when ABSL_OPTION_HARDENED is defined to 0. The 0253 // checks enabled by this option may abort the program in a different way and 0254 // log additional information when `NDEBUG` is not defined. 0255 0256 #define ABSL_OPTION_HARDENED 0 0257 0258 #endif // ABSL_BASE_OPTIONS_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|