Bug 1563046: Move operator LogModule* out of line in debug builds. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D36675

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kyle Huey 2019-07-02 23:58:18 +00:00
Родитель d73e20e33d
Коммит 17b36a1a90
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -92,6 +92,15 @@
# define MOZ_NEVER_INLINE /* no support */ # define MOZ_NEVER_INLINE /* no support */
#endif #endif
/*
* MOZ_NEVER_INLINE_DEBUG is a macro which expands to MOZ_NEVER_INLINE
* in debug builds, and nothing in opt builds.
*/
#if defined(DEBUG)
# define MOZ_NEVER_INLINE_DEBUG MOZ_NEVER_INLINE
#else
# define MOZ_NEVER_INLINE_DEBUG /* don't inline in opt builds */
#endif
/* /*
* MOZ_NORETURN, specified at the start of a function declaration, indicates * MOZ_NORETURN, specified at the start of a function declaration, indicates
* that the given function does not return. (The function definition does not * that the given function does not return. (The function definition does not

Просмотреть файл

@ -168,7 +168,7 @@ class LazyLogModule final {
explicit constexpr LazyLogModule(const char* aLogName) explicit constexpr LazyLogModule(const char* aLogName)
: mLogName(aLogName), mLog(nullptr) {} : mLogName(aLogName), mLog(nullptr) {}
operator LogModule*() { MOZ_NEVER_INLINE_DEBUG operator LogModule*() {
// NB: The use of an atomic makes the reading and assignment of mLog // NB: The use of an atomic makes the reading and assignment of mLog
// thread-safe. There is a small chance that mLog will be set more // thread-safe. There is a small chance that mLog will be set more
// than once, but that's okay as it will be set to the same LogModule // than once, but that's okay as it will be set to the same LogModule