From 0bb058c1f5fb419a059b3b48724a024cdf82ed60 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 24 Sep 2021 16:47:13 +0800 Subject: [PATCH] fix(mgb/lite): fix LITE_ASSERT bug while build with no exception GitOrigin-RevId: 05060dee1f89df661e02c2e66ae50cf667ec2b7a --- lite/src/misc.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lite/src/misc.h b/lite/src/misc.h index e6fe2e8f..88dc28f8 100644 --- a/lite/src/misc.h +++ b/lite/src/misc.h @@ -6,7 +6,8 @@ * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. */ #pragma once @@ -69,10 +70,11 @@ void print_log(LiteLogLevel level, const char* format = 0, ...) #if LITE_ENABLE_EXCEPTION #define LITE_THROW(msg) throw lite::Error(msg) #else -#define LITE_THROW(msg) \ - do { \ - LITE_ERROR(msg); \ - __builtin_trap(); \ +#define LITE_THROW(msg) \ + do { \ + std::string msg_str(msg); \ + LITE_ERROR(msg_str.c_str()); \ + __builtin_trap(); \ } while (0) #endif