[libc-commits] [PATCH] D153304: [libc] Remove flexible array and replace with a template

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jun 19 13:05:11 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: sivachandra, lntue, michaelrj, jdoerfert, JonChesterfield.
Herald added subscribers: libc-commits, mattd, asavonic, kerbowa, jvesely.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.

Currently the implementation of the RPC interface requires a flexible
struct. This caused problems when compilling the RPC server with GCC as
would be required if trying to export the RPC server interface. This
required that we either move to the `x[1]` workaround or make it a
template parameter. While just using `x[1]` would be much less noisy,
this is technically undefined behavior. For this reason I elected to use
templates.

The downside to using templates is that the server code must now be able
to handle multiple different types at runtime. I was unable to find a
good solution that didn't rely on type erasure so I simply branch off of
the given value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153304

Files:
  libc/src/__support/RPC/rpc.h
  libc/src/__support/RPC/rpc_client.cpp
  libc/src/gpu/rpc_reset.cpp
  libc/startup/gpu/amdgpu/start.cpp
  libc/startup/gpu/nvptx/start.cpp
  libc/utils/gpu/server/Server.cpp
  libc/utils/gpu/server/Server.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153304.532742.patch
Type: text/x-patch
Size: 28501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230619/f6b2907d/attachment-0001.bin>


More information about the libc-commits mailing list