mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Add noexcept to no_cfi_icall templates
Change-Id: I8115406303813c983bb4bb627e3b25adbdb3efee Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2441392 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
0e03f8e7fa
commit
79d43b8ac3
@ -50,7 +50,7 @@ template <typename Functor>
|
||||
struct FunctorTraits;
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct FunctorTraits<R (*)(Args...)> {
|
||||
struct FunctorTraits<R (*)(Args...) noexcept> {
|
||||
template <typename Function, typename... RunArgs>
|
||||
DISABLE_CFI_ICALL static R Invoke(Function&& function, RunArgs&&... args) {
|
||||
return std::forward<Function>(function)(std::forward<RunArgs>(args)...);
|
||||
@ -58,7 +58,7 @@ struct FunctorTraits<R (*)(Args...)> {
|
||||
};
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct FunctorTraits<R (*)(Args..., ...)> {
|
||||
struct FunctorTraits<R (*)(Args..., ...) noexcept> {
|
||||
template <typename Function, typename... RunArgs>
|
||||
DISABLE_CFI_ICALL static R Invoke(Function&& function, RunArgs&&... args) {
|
||||
return std::forward<Function>(function)(std::forward<RunArgs>(args)...);
|
||||
@ -67,7 +67,7 @@ struct FunctorTraits<R (*)(Args..., ...)> {
|
||||
|
||||
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
|
||||
template <typename R, typename... Args>
|
||||
struct FunctorTraits<R(__stdcall*)(Args...)> {
|
||||
struct FunctorTraits<R(__stdcall*)(Args...) noexcept> {
|
||||
template <typename... RunArgs>
|
||||
DISABLE_CFI_ICALL static R Invoke(R(__stdcall* function)(Args...),
|
||||
RunArgs&&... args) {
|
||||
|
@ -34,13 +34,16 @@ namespace test {
|
||||
namespace {
|
||||
|
||||
TEST(NoCfiIcall, NullptrIsFalse) {
|
||||
NoCfiIcall<void (*)(void)> call(nullptr);
|
||||
NoCfiIcall<void (*)(void) noexcept> call(nullptr);
|
||||
ASSERT_FALSE(call);
|
||||
}
|
||||
|
||||
int TestFunc() noexcept {
|
||||
return 42;
|
||||
}
|
||||
|
||||
TEST(NoCfiIcall, SameDSOICall) {
|
||||
static int (*func)() = []() { return 42; };
|
||||
NoCfiIcall<decltype(func)> call(func);
|
||||
NoCfiIcall<decltype(TestFunc)*> call(&TestFunc);
|
||||
ASSERT_TRUE(call);
|
||||
ASSERT_EQ(call(), 42);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user