From 9ee7e899aa51d94e9dde0405983fdd15d6a27c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 2 Sep 2025 14:09:14 +0200 Subject: [PATCH] Ignore warnings of glaring uselessness on clang-cl. I hope those don't fire on regular Windows clang as well, this seems to be specific to the way how MSVC-compatible template instantiation works. --- src/Magnum/ShaderTools/AbstractConverter.h | 10 ++++++++++ src/Magnum/Text/AbstractFont.h | 10 ++++++++++ src/Magnum/Trade/AbstractImporter.h | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/Magnum/ShaderTools/AbstractConverter.h b/src/Magnum/ShaderTools/AbstractConverter.h index 3c2360d74..d82224fc1 100644 --- a/src/Magnum/ShaderTools/AbstractConverter.h +++ b/src/Magnum/ShaderTools/AbstractConverter.h @@ -1184,12 +1184,22 @@ class MAGNUM_SHADERTOOLS_EXPORT AbstractConverter: public PluginManager::Abstrac Containers::Optional>(*_inputFileCallback)(const std::string&, InputFileCallbackPolicy, void*){}; void* _inputFileCallbackUserData{}; + /* clang-cl on Windows complains about this field being unused if the + templated setFileCallback() isn't called. Well, sure, it isn't used + in that particular case, but what am I supposed to do?! */ + #ifdef CORRADE_TARGET_CLANG_CL + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-private-field" + #endif /* Used by the templated version only */ struct FileCallbackTemplate { void(*callback)(); const void* userData; /* GCC 4.8 complains loudly about missing initializers otherwise */ } _inputFileCallbackTemplate{nullptr, nullptr}; + #ifdef CORRADE_TARGET_CLANG_CL + #pragma GCC diagnostic pop + #endif }; /** diff --git a/src/Magnum/Text/AbstractFont.h b/src/Magnum/Text/AbstractFont.h index 30493f970..b5e0dcd41 100644 --- a/src/Magnum/Text/AbstractFont.h +++ b/src/Magnum/Text/AbstractFont.h @@ -805,12 +805,22 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { Containers::Optional>(*_fileCallback)(const std::string&, InputFileCallbackPolicy, void*){}; void* _fileCallbackUserData{}; + /* clang-cl on Windows complains about this field being unused if the + templated setFileCallback() isn't called. Well, sure, it isn't used + in that particular case, but what am I supposed to do?! */ + #ifdef CORRADE_TARGET_CLANG_CL + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-private-field" + #endif /* Used by the templated version only */ struct FileCallbackTemplate { void(*callback)(); const void* userData; /* GCC 4.8 complains loudly about missing initializers otherwise */ } _fileCallbackTemplate{nullptr, nullptr}; + #ifdef CORRADE_TARGET_CLANG_CL + #pragma GCC diagnostic pop + #endif Float _size{}, _ascent{}, _descent{}, _lineHeight{}; UnsignedInt _glyphCount{}; diff --git a/src/Magnum/Trade/AbstractImporter.h b/src/Magnum/Trade/AbstractImporter.h index 3ff4c23f6..da1ffcfec 100644 --- a/src/Magnum/Trade/AbstractImporter.h +++ b/src/Magnum/Trade/AbstractImporter.h @@ -2614,12 +2614,22 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi Containers::Optional>(*_fileCallback)(const std::string&, InputFileCallbackPolicy, void*){}; void* _fileCallbackUserData{}; + /* clang-cl on Windows complains about this field being unused if the + templated setFileCallback() isn't called. Well, sure, it isn't used + in that particular case, but what am I supposed to do?! */ + #ifdef CORRADE_TARGET_CLANG_CL + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-private-field" + #endif /* Used by the templated version only */ struct FileCallbackTemplate { void(*callback)(); const void* userData; /* GCC 4.8 complains loudly about missing initializers otherwise */ } _fileCallbackTemplate{nullptr, nullptr}; + #ifdef CORRADE_TARGET_CLANG_CL + #pragma GCC diagnostic pop + #endif #ifdef MAGNUM_BUILD_DEPRECATED struct CachedScenes;