[all-commits] [llvm/llvm-project] 26a184: [libc] Warn on use of global constructors in `libc`

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu Jul 20 09:30:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 26a1849cca4e84feeaac303fba05f8dabca84050
      https://github.com/llvm/llvm-project/commit/26a1849cca4e84feeaac303fba05f8dabca84050
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-07-20 (Thu, 20 Jul 2023)

  Changed paths:
    M libc/cmake/modules/LLVMLibCObjectRules.cmake

  Log Message:
  -----------
  [libc] Warn on use of global constructors in `libc`

Clang supports the `-Wglobal-constructors` flag which will indicate if a
global constructor is being used. The current goal in `libc` is to make
the constructors `constexpr` to prevent this from happening with
straight construction. However, there are many other cases where we can
emit a constructor that this won't catch. This should give warning if
someone accidentally introduces a global constructor.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D155721




More information about the All-commits mailing list