diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2015-11-18 05:33:38 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2015-11-18 05:33:38 +0000 |
commit | e113b5e9afeda18d249aca75d473350b94fcda5f (patch) | |
tree | 87901c2fce23099f1dc8f489da7a562ca9ec9815 | |
parent | 64705c8e7baddd60dd5d9562d9d6b369ee73e67a (diff) | |
download | llvm-e113b5e9afeda18d249aca75d473350b94fcda5f.zip llvm-e113b5e9afeda18d249aca75d473350b94fcda5f.tar.gz llvm-e113b5e9afeda18d249aca75d473350b94fcda5f.tar.bz2 |
c++abi: use __builtin_offsetof instead of offsetof
Use `__builtin_offsetof` in place of `offsetof`. Certain environments provide a
macro definition of `offsetof` which may end up causing issues. This was
observed on Windows. Use `__builtin_offsetof` to ensure correct evaluation
everywhere. NFC.
llvm-svn: 253435
-rw-r--r-- | libcxxabi/src/cxa_exception.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp index ae2b39c..068152b 100644 --- a/libcxxabi/src/cxa_exception.cpp +++ b/libcxxabi/src/cxa_exception.cpp @@ -448,14 +448,15 @@ void __cxa_end_catch() static_assert(sizeof(__cxa_exception) == sizeof(__cxa_dependent_exception), "sizeof(__cxa_exception) must be equal to " "sizeof(__cxa_dependent_exception)"); - static_assert(offsetof(__cxa_exception, referenceCount) == - offsetof(__cxa_dependent_exception, primaryException), - "the layout of __cxa_exception must match the layout of " - "__cxa_dependent_exception"); - static_assert(offsetof(__cxa_exception, handlerCount) == - offsetof(__cxa_dependent_exception, handlerCount), - "the layout of __cxa_exception must match the layout of " - "__cxa_dependent_exception"); + static_assert(__builtin_offsetof(__cxa_exception, referenceCount) == + __builtin_offsetof(__cxa_dependent_exception, + primaryException), + "the layout of __cxa_exception must match the layout of " + "__cxa_dependent_exception"); + static_assert(__builtin_offsetof(__cxa_exception, handlerCount) == + __builtin_offsetof(__cxa_dependent_exception, handlerCount), + "the layout of __cxa_exception must match the layout of " + "__cxa_dependent_exception"); __cxa_eh_globals* globals = __cxa_get_globals_fast(); // __cxa_get_globals called in __cxa_begin_catch __cxa_exception* exception_header = globals->caughtExceptions; // If we've rethrown a foreign exception, then globals->caughtExceptions |