From 755d7af3eb2b4eb27d6ba0b972c428b1d953be9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 2 Jan 2023 13:13:58 +0100 Subject: [PATCH] Don't use var-args for Q_DECLARE_EXPORTED_LOGGING_CATEGORY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSVC should deal just fine with a single argument macro, and this prevents the silent mistake of passing a single argument to Q_DECLARE_EXPORTED_LOGGING_CATEGORY which would result in no error or warning, but without exporting the category. Change-Id: I4190027f8914ad1ef3957759f8e8c0e6cbd8ba97 Reviewed-by: Kai Köhne (cherry picked from commit 9bf42425f1cfaca990e37200960615d819b31886) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/io/qloggingcategory.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 37cb3c2de11..5e0082e2aaf 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -108,11 +108,11 @@ template <> const bool QLoggingCategoryMacroHolder::IsOutputEnable #endif } // unnamed namespace -#define Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, ...) \ - __VA_ARGS__ const QLoggingCategory &name(); - #define Q_DECLARE_LOGGING_CATEGORY(name) \ - Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, /* prevent zero variadic arguments */ ) + const QLoggingCategory &name(); + +#define Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, export_macro) \ + export_macro Q_DECLARE_LOGGING_CATEGORY(name) #define Q_LOGGING_CATEGORY(name, ...) \ const QLoggingCategory &name() \