[libc-commits] [PATCH] D155720: [libc] Fix global constructor being emitted for the RPC client

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 19 08:59:58 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: JonChesterfield, sivachandra, michaelrj.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
jhuber6 requested review of this revision.

The indirection here is for some reason causing an unnecessary
constructor. If we leave this uninitialized we will get the default
constructor which simply zero initliaizes the global. I've checked the
output and confirmed that it uses the `zeroinitializer` so this should
be safe.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155720

Files:
  libc/src/__support/RPC/rpc.h


Index: libc/src/__support/RPC/rpc.h
===================================================================
--- libc/src/__support/RPC/rpc.h
+++ libc/src/__support/RPC/rpc.h
@@ -87,7 +87,7 @@
   cpp::Atomic<uint32_t> *outbox;
   Packet *packet;
 
-  cpp::Atomic<uint32_t> lock[DEFAULT_PORT_COUNT] = {0};
+  cpp::Atomic<uint32_t> lock[DEFAULT_PORT_COUNT];
 
   /// Initialize the communication channels.
   LIBC_INLINE void reset(uint64_t port_count, void *buffer) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155720.542053.patch
Type: text/x-patch
Size: 462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230719/e340f044/attachment.bin>


More information about the libc-commits mailing list