Skip to content

Commit

Permalink
Silence ARM inline asm warning in libunwind (dotnet#38971)
Browse files Browse the repository at this point in the history
The libunwind headers define unw_getcontext in the libunwind headers for ARM
as inline assembly with stmia instruction storing SP and PC, which clang
complains about as deprecated. However, it is required for atomic restoration
of the context, so disable that warning.

This change silences that warning.
  • Loading branch information
janvorli authored Jul 9, 2020
1 parent f170594 commit 866e831
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/coreclr/src/pal/src/exception/seh-unwind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,18 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
}

#if !UNWIND_CONTEXT_IS_UCONTEXT_T
// The unw_getcontext is defined in the libunwind headers for ARM as inline assembly with
// stmia instruction storing SP and PC, which clang complains about as deprecated.
// However, it is required for atomic restoration of the context, so disable that warning.
#if defined(__llvm__) && defined(TARGET_ARM)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winline-asm"
#endif
st = unw_getcontext(&unwContext);
#if defined(__llvm__) && defined(TARGET_ARM)
#pragma clang diagnostic pop
#endif

if (st < 0)
{
return FALSE;
Expand Down

0 comments on commit 866e831

Please sign in to comment.