Commit 3589fae9 authored by Lalit Chandivade's avatar Lalit Chandivade Committed by Commit Bot

Fix compile error

1. Function defined noreturn
2. Fix following compilation error for aarch64 on win -

error: Unsupported architecture 'aarch64' for MS-style inline assembly
IMMEDIATE_CRASH();
        ^
./base/logging.h(595,6):  note: expanded from macro 'IMMEDIATE_CRASH'
    {__asm int 3 __asm ud2 __asm push __COUNTER__}; \

Bug: 893460
Change-Id: I5ed953c3e29480d469d694cf15f5a292e6920cd7
Reviewed-on: https://chromium-review.googlesource.com/c/1298091
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607562}
parent dda5fa8b
...@@ -507,6 +507,7 @@ Kyoungdeok Kwon <kkd927@gmail.com> ...@@ -507,6 +507,7 @@ Kyoungdeok Kwon <kkd927@gmail.com>
Kyung Yeol Kim <chitacan@gmail.com> Kyung Yeol Kim <chitacan@gmail.com>
Kyungtae Kim <ktf.kim@samsung.com> Kyungtae Kim <ktf.kim@samsung.com>
Kyungyoung Heo <bbvch13531@gmail.com> Kyungyoung Heo <bbvch13531@gmail.com>
Lalit Chandivade <lalit.chandivade@einfochips.com>
Laszlo Gombos <l.gombos@samsung.com> Laszlo Gombos <l.gombos@samsung.com>
Laszlo Radanyi <bekkra@gmail.com> Laszlo Radanyi <bekkra@gmail.com>
Lauren Yeun Kim <lauren.yeun.kim@gmail.com> Lauren Yeun Kim <lauren.yeun.kim@gmail.com>
......
...@@ -559,29 +559,6 @@ class CheckOpResult { ...@@ -559,29 +559,6 @@ class CheckOpResult {
#define TRAP_SEQUENCE() __builtin_trap() #define TRAP_SEQUENCE() __builtin_trap()
#endif // ARCH_CPU_* #endif // ARCH_CPU_*
// CHECK() and the trap sequence can be invoked from a constexpr function.
// This could make compilation fail on GCC, as it forbids directly using inline
// asm inside a constexpr function. However, it allows calling a lambda
// expression including the same asm.
// The side effect is that the top of the stacktrace will not point to the
// calling function, but to this anonymous lambda. This is still useful as the
// full name of the lambda will typically include the name of the function that
// calls CHECK() and the debugger will still break at the right line of code.
#if !defined(__clang__)
#define WRAPPED_TRAP_SEQUENCE() \
do { \
[] { TRAP_SEQUENCE(); }(); \
} while (false)
#else
#define WRAPPED_TRAP_SEQUENCE() TRAP_SEQUENCE()
#endif
#define IMMEDIATE_CRASH() \
({ \
WRAPPED_TRAP_SEQUENCE(); \
__builtin_unreachable(); \
})
#elif defined(COMPILER_MSVC) #elif defined(COMPILER_MSVC)
// Clang is cleverer about coalescing int3s, so we need to add a unique-ish // Clang is cleverer about coalescing int3s, so we need to add a unique-ish
...@@ -596,20 +573,42 @@ class CheckOpResult { ...@@ -596,20 +573,42 @@ class CheckOpResult {
// __COUNTER__, so eventually it will emit the dword form of push. // __COUNTER__, so eventually it will emit the dword form of push.
// TODO(scottmg): Reinvestigate a short sequence that will work on both // TODO(scottmg): Reinvestigate a short sequence that will work on both
// compilers once clang supports more intrinsics. See https://crbug.com/693713. // compilers once clang supports more intrinsics. See https://crbug.com/693713.
#if defined(__clang__) #if !defined(__clang__)
#define IMMEDIATE_CRASH() \ #define TRAP_SEQUENCE() __debugbreak()
({ \ #elif defined(ARCH_CPU_ARM64)
{__asm int 3 __asm ud2 __asm push __COUNTER__}; \ #define TRAP_SEQUENCE() \
__builtin_unreachable(); \ __asm volatile("brk #0\n hlt %0\n" ::"i"(__COUNTER__ % 65536));
})
#else #else
#define IMMEDIATE_CRASH() __debugbreak() #define TRAP_SEQUENCE() ({ {__asm int 3 __asm ud2 __asm push __COUNTER__}; })
#endif // __clang__ #endif // __clang__
#else #else
#error Port #error Port
#endif // COMPILER_GCC
// CHECK() and the trap sequence can be invoked from a constexpr function.
// This could make compilation fail on GCC, as it forbids directly using inline
// asm inside a constexpr function. However, it allows calling a lambda
// expression including the same asm.
// The side effect is that the top of the stacktrace will not point to the
// calling function, but to this anonymous lambda. This is still useful as the
// full name of the lambda will typically include the name of the function that
// calls CHECK() and the debugger will still break at the right line of code.
#if !defined(COMPILER_GCC)
#define WRAPPED_TRAP_SEQUENCE() TRAP_SEQUENCE()
#else
#define WRAPPED_TRAP_SEQUENCE() \
do { \
[] { TRAP_SEQUENCE(); }(); \
} while (false)
#endif #endif
#define IMMEDIATE_CRASH() \
({ \
WRAPPED_TRAP_SEQUENCE(); \
__builtin_unreachable(); \
})
// CHECK dies with a fatal error if condition is not true. It is *not* // CHECK dies with a fatal error if condition is not true. It is *not*
// controlled by NDEBUG, so the check will be executed regardless of // controlled by NDEBUG, so the check will be executed regardless of
// compilation mode. // compilation mode.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment