[all-commits] [llvm/llvm-project] beff86: Build libSupport with -Werror=global-constructors ...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon Jul 26 16:08:58 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: beff86e8ff429f11da6fe37efde86d22ea636ed5
      https://github.com/llvm/llvm-project/commit/beff86e8ff429f11da6fe37efde86d22ea636ed5
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2021-07-26 (Mon, 26 Jul 2021)

  Changed paths:
    M llvm/lib/Support/CMakeLists.txt

  Log Message:
  -----------
  Build libSupport with -Werror=global-constructors (NFC)

Ensure that libSupport does not carry any static global initializer.
libSupport can be embedded in use cases where we don't want to load all
cl::opt unless we want to parse the command line.
ManagedStatic can be used to enable lazy-initialization of globals.

The -Werror=global-constructors is only added on platform that have
support for the flag and for which std::mutex does not have a global
destructor. This is ensured by having CMake trying to compile a file
with a global mutex before adding the flag to libSupport.




More information about the All-commits mailing list