office-gobmx/config_host/config_global.h.in
Stephan Bergmann 689dc63287 constinit, here we come
Following up on b13421011d "better data
structures for some static const vars":

* Make the o3tl::sorted_vector ctor taking an initializer_list constexpr.
  <https://wg21.link/P0202R3> "Add Constexpr Modifiers to Functions in
  <algorithm> and <utility> Headers", which will be in C++2a and is already
  implemented by recent libc++ and libstdc++ according to
  <https://en.cppreference.com/w/cpp/compiler_support
  #C.2B.2B2a_library_features>, makes std::sort constexpr but explicitly keeps
  std::stable_sort non-constexpr.  ("Algorithms stable_partition, inplace_merge
  and stable_sort allocate memory, construct variables using placement new, use
  unique_ptr and do other things not acceptable in constexpr expressions.
  Making those algorithms constexpr seems to be a hard task that would require
  a lot of intrinsics.  Those algorithms are not marked with constexpr in this
  wording.")  But keep o3tl::sorted_vector::Resort (which was introduced in
  c59355e936 "fdo#58793: re-implement
  SwpHintsArray::Resort()") using std::stable_sort instead of std::sort, in
  case that is relevant for its pre-exisiting uses.

* <https://wg21.link/P1004R2> "Making std::vector constexpr", which was voted
  into C++2a according to <https://wg21.link/n4829> "Editors' Report --
  Programming Languages -- C++", will make the relevant parts of std::vector
  constexpr.  But none of libc++, libstdc++, and MSVC implement that as of now.

* Introduce HAVE_CPP_CONSTINIT_SORTED_VECTOR to hide the constinit behind for
  now for the one case from b13421011d "better
  data structures for some static const vars" that can clearly be constinit
  once constexpr std::vector is supported by compilers.  The other three cases
  (s_aContainerDocumentCommands in
  chart2/source/controller/main/CommandDispatchContainer.cxx,
  aMetricCompatibleMap in vcl/source/font/PhysicalFontCollection.cxx, and
  aBlacklist in writerfilter/source/dmapper/PropertyMap.cxx) would each need a
  constexpr OUString first.  (Technically, the constinit would not even be
  needed, but it nicely documents our intent that this will actually be
  initialized at compile-time once compilers support that.)

Change-Id: Ibeb138f120528be3a7a09b3912143bf795fbab29
Reviewed-on: https://gerrit.libreoffice.org/79556
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-25 20:55:53 +02:00

36 lines
1.2 KiB
C

/*
Global configuration file.
Only for settings that apply to every source file and are unlikely to change often,
such as whether a certain C++11 feature is available.
Do NOT use for settings local to some code or for settings that can change often.
Any change in this header will cause a rebuild of almost everything.
*/
#ifndef CONFIG_GLOBAL_H
#define CONFIG_GLOBAL_H
#define HAVE_GCC_BUILTIN_ATOMIC 0
#define HAVE_GCC_BUILTIN_FFS 0
/* _Pragma */
#define HAVE_GCC_PRAGMA_OPERATOR 0
#define HAVE_GCC_DEPRECATED_MESSAGE 0
#define HAVE_SYSLOG_H 0
/* Compiler supports __attribute__((warn_unused)). */
#define HAVE_GCC_ATTRIBUTE_WARN_UNUSED 0
/* Guaranteed copy elision (C++17), __cpp_guaranteed_copy_elision (C++2a): */
#define HAVE_CPP_GUARANTEED_COPY_ELISION 0
// Compiler supports all of C++2a <https://wg21.link/P0202R3> "Add Constexpr Modifiers to Functions
// in <algorithm> and <utility> Headers", <https://wg21.link/P1004R2> "Making std::vector
// constexpr", and <https://wg21.link/P1143R2> "Adding the constinit keyword":
#define HAVE_CPP_CONSTINIT_SORTED_VECTOR 0
/* GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87150> "move ctor wrongly chosen in return
stmt (derived vs. base)": */
#define HAVE_GCC_BUG_87150 0
#endif