mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
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:
parent
6a82880fac
commit
643afe2840
@ -210,13 +210,13 @@ MOZ_NoReturn(int aLine) {
|
|||||||
# define MOZ_REALLY_CRASH(line) \
|
# define MOZ_REALLY_CRASH(line) \
|
||||||
do { \
|
do { \
|
||||||
*((volatile int*)MOZ_CRASH_WRITE_ADDR) = line; /* NOLINT */ \
|
*((volatile int*)MOZ_CRASH_WRITE_ADDR) = line; /* NOLINT */ \
|
||||||
::abort(); \
|
MOZ_NOMERGE ::abort(); \
|
||||||
} while (false)
|
} while (false)
|
||||||
# else
|
# else
|
||||||
# define MOZ_REALLY_CRASH(line) \
|
# define MOZ_REALLY_CRASH(line) \
|
||||||
do { \
|
do { \
|
||||||
*((volatile int*)MOZ_CRASH_WRITE_ADDR) = line; /* NOLINT */ \
|
*((volatile int*)MOZ_CRASH_WRITE_ADDR) = line; /* NOLINT */ \
|
||||||
abort(); \
|
MOZ_NOMERGE abort(); \
|
||||||
} while (false)
|
} while (false)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,6 +88,22 @@
|
|||||||
# endif
|
# endif
|
||||||
#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
|
* 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
|
* method decorated with it must never be inlined, even if the compiler would
|
||||||
|
Loading…
Reference in New Issue
Block a user