BDE 4.2.0 Release¶
Schedule¶
The BDE team announces that the BDE 4.2.0 production release was completed on Wednesday, February 7, 2024.
BDE 4.2.0 Release Highlights¶
Enable support for PMR allocators¶
This release enables support for PMR allocators. Please note that this does not
include support for std::pmr::string
( which is explicitely suppressed by
the production toolchains for backward compatibility ).
New Feature: balcl::CommandLine
Support for Passing Options By Environment Variable¶
This release adds functionality to
balcl::CommandLine
for supplying options through the environment. For example, imagine we had a
program myprog
that takes a single string argument “-f” or “–filename”,
and we want to be able to configure the filename through the environment
variable "MYPROG_FILENAME"
. Such a option would be would be configured
with an balcl::OptionInfo
table like the following:
static const balcl::OptionInfo specTable[] = {
{
"f|filename",
"fileName",
"name of input file",
balcl::TypeInfo(balcl::OptionType::k_STRING),
balcl::OccurrenceInfo::e_REQUIRED,
"MYPROG_FILENAME" // (optionally) specify an environment variable name
// for the option
}
};
Within the main
for myprog
, the OptionInfo
object specTable
(above) would be used to construct a
balcl::CommandLine
used to parse the command line.
Note
We recommended that environment variable names be all upper case, and prefixed with the name of the program or subsystem of the application to ensure they are unique.
Below we demonstrate how to execute myprog
and supply an input file via the
environment:
$ export MYPROG_FILENAME=/home/myname/my_input_file.txt
$ myprog
balc::CommandLine
incorporates environment variables into the logic to
determine the value for an option as follows:
If an environment variable name is not supplied for an option’s configuration (the default), that option is unaffected by the environment.
If an environment variable name is supplied for an option’s configuration:
If an option value is provided on the command line, the command line option value is used (the environment is ignored)
If an option value is not provided on the command line, and the configure environment variable has a value, the option value supplied by the environment is used
If an option value is not provided on the command line, or via the environment, then the default value for the option, if any, is used
See balcl_commanline component documentation for more details.
New Feature: Configurable Behavior when Throwing Exceptions from BSL¶
The bslstl_stdexceptutil component provides functions that will
throw common standard exceptions, without the caller having to include
<exception>
or <stdexcept>
. In builds without exceptions, the
throws are replaced by calls to abort
. This component’s most typical use
is in throwing standard exceptions from the BSL standard library, but is used
in other places to throw standard exceptions.
In this release, we’ve added to this component the ability to install custom
handlers, typically for logging purposes, that are invoked prior to throwing
exceptions. This may be useful in diagnosing the cause of uncaught exceptions
thrown from standard library containers or other components making use of
standard exceptions via StdExceptUtil
.
For each exception type supported by this component, we have added a “pre-throw hook”, a function pointer that is normally null. If that pointer is set to a function, that function is called prior to the throw. This gives the client a chance to log a message.
struct StdExceptUtil {
typedef void (*PreThrowHook)(const char *exceptionName,
const char *message);
static void setRuntimeErrorHook(PreThrowHook hook);
static void setLogicErrorHook( PreThrowHook hook);
...
};
We provide two new off-the-shelf functions that can be set as pre-throw hooks that provide stack traces. The first, bslstl::StdExceptUtil::logCheapStackTrace, will log a “cheap stack trace”, that is a sequence of hex addresses from the stack.
The second function is balst::StackTracePrintUtil::logExceptionStackTrace, that will log a full multi-line stack trace with symbols and, on some platforms, symbol demangling, line numbers, and source file names. This alternative requires considerable disk access and is therefore orders of magnitude slower than the cheap stack trace.
Both functions do output using the bsls_log
facility. Because the
balst
stack trace is so expensive, it is not recommended for exceptions
that are expected to be frequently thrown, caught, and recovered from. The
bslstl
cheap stack trace function logs with severity
bsls::LogSeverity::e_WARN, the balst
stack trace function logs with
severity bsls::LogSeverity::e_FATAL.
See bslstl_stdexceptutil component documentation for more details.
Fixed gdb printers to support new allocator model¶
Gdb pretty printers support new layout for the BDE allocator-aware types. The gdb pretty printers have been updated to support the new, BDE 4.0, layout for BDE allocator-aware types.
Fixed DRQSs:¶
Summary |
---|
bslstl::StdExceptUtil: add cheap stack trace to all std exceptions thrown |
balcl: Support configuring by environment variable as well |
Fix deprecation warning in bslma_usesbslmaallocator |
Correct introduced clang pragma warning |
a_cdb2: add support for CDB2_REQUIRE_FASTSQL flag |
sim_cpp11_features breaking change |
Add eraseIf(key, predicate) to bdlcc::StripedUnorderedMap and bdlcc::StripedUnor# |
Enchance PMR related library features detection and usage. |
Multiple gdb pretty printers broken possibly due to BDE 4 allocator changes |
bbs_build –cpp11-verify-no-change option has no effect unless passed to configure |
Please augment bdlb::NullableValueRef interface |
Copy ctor issue for ConstNullableValueRef<TYPE> |
baljsn::Decode fails when called from a static initialiser on Solaris |
Fix clang linker errors for missing Default_NewDeleteSetter |