[Openmp-commits] [PATCH] D106543: [libomptarget][nfc] Improve static assert message in dlwrap
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jul 22 07:25:00 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e9cd3e9f1da: [libomptarget][nfc] Improve static assert message in dlwrap (authored by JonChesterfield).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106543/new/
https://reviews.llvm.org/D106543
Files:
openmp/libomptarget/include/dlwrap.h
Index: openmp/libomptarget/include/dlwrap.h
===================================================================
--- openmp/libomptarget/include/dlwrap.h
+++ openmp/libomptarget/include/dlwrap.h
@@ -127,6 +127,10 @@
return {{dlwrap::type::symbol<Is>::call()...}};
}
+template <size_t Requested, size_t Required> constexpr void verboseAssert() {
+ static_assert(Requested == Required, "Arity Error");
+}
+
} // namespace dlwrap
#define DLWRAP_INSTANTIATE(SYM_USE, SYM_DEF, ARITY) \
@@ -153,12 +157,12 @@
struct SYMBOL##_Trait : public dlwrap::trait<decltype(&SYMBOL)> { \
using T = dlwrap::trait<decltype(&SYMBOL)>; \
static T::FunctionType get() { \
+ verboseAssert<ARITY, trait<decltype(&SYMBOL)>::nargs>(); \
constexpr size_t Index = DLWRAP_ID() - 1; \
void *P = *dlwrap::pointer(Index); \
return reinterpret_cast<T::FunctionType>(P); \
} \
}; \
- static_assert(ARITY == trait<decltype(&SYMBOL)>::nargs, "Arity Error"); \
}
#define DLWRAP_IMPL(SYMBOL, ARITY) \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106543.360804.patch
Type: text/x-patch
Size: 1449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210722/a0797df2/attachment.bin>
More information about the Openmp-commits
mailing list