llvm-project/libcxx/benchmarks
Louis Dionne 53623d4aa7 [libc++] Always generate a __config_site header
Before this patch, the __config_site header was only generated when at
least one __config_site macro needed to be defined. This lead to two
different code paths in how libc++ is configured, depending on whether
a __config_site header was generated or not. After this patch, the
__config_site is always generated, but it can be empty in case there
are no macros to define in it.

More context on why this change is important
--------------------------------------------
In addition to being confusing, this double-code-path situation lead to
broken code being checked in undetected in 2405bd6898, which introduced
the LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT CMake setting. Specifically,
the _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT <__config_site> macro was
supposed NOT to be defined unless LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
was specified explicitly on the CMake command line. Instead, what happened
is that it was defined to 0 if it wasn't specified explicitly and a
<__config_site> header was generated. And defining that macro to 0 had
the important effect of using the non-unique RTTI comparison implementation,
which changes the ABI.

This change in behavior wasn't noticed because the <__config_site> header
is not generated by default. However, the Apple configuration does cause
a <__config_site> header to be generated, which lead to the wrong RTTI
implementation being used, and to https://llvm.org/PR45549. We came close
to an ABI break in the dylib, but were saved due to a downstream-only
change that overrode the decision of the <__config_site> for the purpose
of RTTI comparisons in libc++abi. This is an incredible luck that we should
not rely on ever again.

While the problem itself was fixed with 2464d8135e by setting
LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT explicitly in the Apple
CMake cache and then in d0fcdcd28f by making the setting less
brittle, the point still is that we should have had a single code
path from the beginning. Unlike most normal libraries, the macros
that configure libc++ are really complex, there's a lot of them and
they control important properties of the C++ runtime. There must be
a single code path for that, and it must be simple and robust.

Differential Revision: https://reviews.llvm.org/D80927
2020-06-26 00:47:48 -04:00
..
CMakeLists.txt [libc++] Always generate a __config_site header 2020-06-26 00:47:48 -04:00
CartesianBenchmarks.h [libc++][NFC] Remove excess trailing newlines from most files 2019-10-23 08:08:57 -07:00
ContainerBenchmarks.h libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
GenerateInput.h libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
Utilities.h libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
algorithms.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
algorithms.partition_point.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
allocation.bench.cpp Add benchmarks to test the cost of allocator 2019-08-02 21:13:38 +00:00
deque.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
filesystem.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
function.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
lit.cfg.py Rename cxx-benchmark-unittests target and convert to LIT. 2018-11-14 20:38:46 +00:00
lit.site.cfg.py.in Rename cxx-benchmark-unittests target and convert to LIT. 2018-11-14 20:38:46 +00:00
ordered_set.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
string.bench.cpp Add benchmarks for basic_string::erase 2020-02-19 17:09:25 -05:00
stringstream.bench.cpp Add test macros for always_inline and noinline 2018-10-10 18:22:23 +00:00
unordered_set_operations.bench.cpp [libcxx][NFC] Strip trailing whitespace, fix typo. 2019-10-23 11:49:43 -07:00
util_smartptr.bench.cpp Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
vector_operations.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00