Use inline namespaces rather than "using" for logging categories
Amends commit fa4bd30caa079a3b1e5eac1bb4f17365f456b8f9. Fixes: QTBUG-132111 Change-Id: Iad7969a1841b8cea162e4b0e6624d02313618ef1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 529ebb31702e8465a9ba42f4c56c749cb7bf7b75) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
443bdb9620
commit
2a512fd901
@ -104,20 +104,17 @@ template <> const bool QLoggingCategoryMacroHolder<QtWarningMsg>::IsOutputEnable
|
||||
} // unnamed namespace
|
||||
|
||||
#define QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(name, export_macro) \
|
||||
namespace QtPrivateLogging { export_macro const QLoggingCategory &name(); } \
|
||||
using QtPrivateLogging::name;
|
||||
inline namespace QtPrivateLogging { export_macro const QLoggingCategory &name(); }
|
||||
|
||||
#if QT_BUILDING_QT
|
||||
#define Q_DECLARE_LOGGING_CATEGORY(name) \
|
||||
namespace QtPrivateLogging { const QLoggingCategory &name(); } \
|
||||
using QtPrivateLogging::name;
|
||||
inline namespace QtPrivateLogging { const QLoggingCategory &name(); }
|
||||
|
||||
#define Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, export_macro) \
|
||||
namespace QtPrivateLogging { \
|
||||
inline namespace QtPrivateLogging { \
|
||||
Q_DECL_DEPRECATED_X("Use QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY in Qt") \
|
||||
export_macro const QLoggingCategory &name(); \
|
||||
} \
|
||||
using QtPrivateLogging::name;
|
||||
}
|
||||
|
||||
#define Q_LOGGING_CATEGORY_IMPL(name, ...) \
|
||||
const QLoggingCategory &name() \
|
||||
@ -126,22 +123,13 @@ template <> const bool QLoggingCategoryMacroHolder<QtWarningMsg>::IsOutputEnable
|
||||
return category; \
|
||||
}
|
||||
|
||||
#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU < 1000
|
||||
// GCC <10 thinks the "using" declaration from QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY
|
||||
// or Q_DECLARE_LOGGING_CATEGORY conflicts with any weak overload created as part of the definition.
|
||||
// So let's make it happy and repeat the "using" instead.
|
||||
#define Q_LOGGING_CATEGORY(name, ...) \
|
||||
namespace QtPrivateLogging { Q_LOGGING_CATEGORY_IMPL(name, __VA_ARGS__) } \
|
||||
using QtPrivateLogging::name;
|
||||
#else
|
||||
#define Q_LOGGING_CATEGORY(name, ...) \
|
||||
namespace QtPrivateLogging { Q_LOGGING_CATEGORY_IMPL(name, __VA_ARGS__) } \
|
||||
inline namespace QtPrivateLogging { Q_LOGGING_CATEGORY_IMPL(name, __VA_ARGS__) } \
|
||||
Q_WEAK_OVERLOAD \
|
||||
Q_DECL_DEPRECATED_X("Use Q_STATIC_LOGGING_CATEGORY or add " \
|
||||
"either Q_DECLARE_LOGGING_CATEGORY or " \
|
||||
"QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY in a header") \
|
||||
const QLoggingCategory &name() { return QtPrivateLogging::name(); }
|
||||
#endif
|
||||
|
||||
#define Q_STATIC_LOGGING_CATEGORY(name, ...) \
|
||||
static Q_LOGGING_CATEGORY_IMPL(name, __VA_ARGS__)
|
||||
|
@ -39,24 +39,13 @@ QT_BEGIN_NAMESPACE
|
||||
return category; \
|
||||
}
|
||||
|
||||
#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU < 1000
|
||||
// GCC <10 thinks the "using" declaration from QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY
|
||||
// or Q_DECLARE_LOGGING_CATEGORY conflicts with any weak overload created as part of the definition.
|
||||
// So let's make it happy and repeat the "using" instead.
|
||||
#define Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE(name, env, categoryName) \
|
||||
namespace QtPrivateLogging { \
|
||||
Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE_IMPL(name, env, categoryName) \
|
||||
} \
|
||||
using QtPrivateLogging::name;
|
||||
#else
|
||||
#define Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE(name, env, categoryName) \
|
||||
namespace QtPrivateLogging { \
|
||||
inline namespace QtPrivateLogging { \
|
||||
Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE_IMPL(name, env, categoryName) \
|
||||
} \
|
||||
Q_WEAK_OVERLOAD \
|
||||
Q_DECL_DEPRECATED_X("Logging categories should either be static or declared in a header") \
|
||||
const QLoggingCategory &name() { return QtPrivateLogging::name(); }
|
||||
#endif
|
||||
|
||||
#define Q_STATIC_LOGGING_CATEGORY_WITH_ENV_OVERRIDE(name, env, categoryName) \
|
||||
static Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE_IMPL(name, env, categoryName)
|
||||
|
Loading…
x
Reference in New Issue
Block a user