зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1814600 - Annotate abort calls as __attribute__((nomerge)) to get clearer line number when crashing on assertion failure. r=gsvelto,yjuglaret
Differential Revision: https://phabricator.services.mozilla.com/D168960
This commit is contained in:
Родитель
6a82880fac
Коммит
643afe2840
|
@ -210,13 +210,13 @@ MOZ_NoReturn(int aLine) {
|
|||
# define MOZ_REALLY_CRASH(line) \
|
||||
do { \
|
||||
*((volatile int*)MOZ_CRASH_WRITE_ADDR) = line; /* NOLINT */ \
|
||||
::abort(); \
|
||||
MOZ_NOMERGE ::abort(); \
|
||||
} while (false)
|
||||
# else
|
||||
# define MOZ_REALLY_CRASH(line) \
|
||||
do { \
|
||||
*((volatile int*)MOZ_CRASH_WRITE_ADDR) = line; /* NOLINT */ \
|
||||
abort(); \
|
||||
MOZ_NOMERGE abort(); \
|
||||
} while (false)
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -88,6 +88,22 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Per clang's documentation:
|
||||
*
|
||||
* If a statement is marked nomerge and contains call expressions, those call
|
||||
* expressions inside the statement will not be merged during optimization. This
|
||||
* attribute can be used to prevent the optimizer from obscuring the source
|
||||
* location of certain calls.
|
||||
*
|
||||
* This is useful to have clearer information on assertion failures.
|
||||
*/
|
||||
#if defined(__clang__) && __has_attribute(nomerge)
|
||||
# define MOZ_NOMERGE __attribute__((nomerge))
|
||||
#else
|
||||
# define MOZ_NOMERGE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MOZ_NEVER_INLINE is a macro which expands to tell the compiler that the
|
||||
* method decorated with it must never be inlined, even if the compiler would
|
||||
|
|
Загрузка…
Ссылка в новой задаче