1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

AK+LibCpp: Remove DEBUG_SPAM in favour of per-application defines

What happens if one file defines DEBUG_SPAM, and another doesn't,
then we link them together and get ODR violations? -- @ADKaster
This commit is contained in:
Ali Mohammad Pur 2021-05-06 16:58:44 +04:30 committed by Andreas Kling
parent 080f2c0e3e
commit 62af7c4bdf
3 changed files with 35 additions and 34 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Denis Campredon <deni_@hotmail.fr>
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -10,9 +11,9 @@
#include <AK/StringBuilder.h>
namespace AK {
template<bool = true>
class ScopeLogger {
public:
#ifdef DEBUG_SPAM
ScopeLogger(StringView extra, const SourceLocation& location = SourceLocation::current())
: m_location(location)
, m_extra(extra)
@ -49,10 +50,15 @@ private:
static inline size_t m_depth = 0;
SourceLocation m_location;
StringView m_extra;
#else
ScopeLogger() = default;
#endif
};
template<>
class ScopeLogger<false> {
public:
template<typename... Args>
ScopeLogger(Args...) { }
};
}
using AK::ScopeLogger;