[PATCH] D117248: Get rid of global constructor in llvm/lib/Support/Signals.cpp in C++20 mode

Evgeny Mandrikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 13:36:56 PST 2022


Godin created this revision.
Herald added subscribers: dexonsmith, hiraditya.
Godin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Without this patch when using CMAKE_CXX_STANDARD=20 and Clang 13
build fails with

llvm/lib/Support/Signals.cpp:86:26: error: declaration requires a global constructor [-Werror,-Wglobal-constructors]


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117248

Files:
  llvm/lib/Support/Signals.cpp


Index: llvm/lib/Support/Signals.cpp
===================================================================
--- llvm/lib/Support/Signals.cpp
+++ llvm/lib/Support/Signals.cpp
@@ -83,7 +83,7 @@
   std::atomic<Status> Flag;
 };
 static constexpr size_t MaxSignalHandlerCallbacks = 8;
-static CallbackAndCookie CallBacksToRun[MaxSignalHandlerCallbacks];
+static CallbackAndCookie CallBacksToRun[MaxSignalHandlerCallbacks]{};
 
 // Signal-safe.
 void sys::RunSignalHandlers() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117248.399772.patch
Type: text/x-patch
Size: 469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/34ce3883/attachment.bin>


More information about the llvm-commits mailing list