From 22d4747038cd07efc632abee6725c0e961ec4611 Mon Sep 17 00:00:00 2001 From: Anthony Nicholls Date: Tue, 16 Apr 2024 11:55:03 +0100 Subject: [PATCH] Warnings: Fix JUCE_COMPILER_WARNING macro to expect strings --- modules/juce_core/system/juce_PlatformDefs.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/juce_core/system/juce_PlatformDefs.h b/modules/juce_core/system/juce_PlatformDefs.h index e683fb4916..dacbfa9e95 100644 --- a/modules/juce_core/system/juce_PlatformDefs.h +++ b/modules/juce_core/system/juce_PlatformDefs.h @@ -265,21 +265,20 @@ namespace juce //============================================================================== #if JUCE_MSVC && ! defined (DOXYGEN) - #define JUCE_WARNING_HELPER(file, line, mess) message(file "(" JUCE_STRINGIFY (line) ") : Warning: " #mess) - #define JUCE_COMPILER_WARNING(message) __pragma(JUCE_WARNING_HELPER (__FILE__, __LINE__, message)) + #define JUCE_COMPILER_WARNING(msg) __pragma (message (__FILE__ "(" JUCE_STRINGIFY (__LINE__) ") : Warning: " msg)) #else - #ifndef DOXYGEN - #define JUCE_WARNING_HELPER(mess) message(#mess) - #endif /** This macro allows you to emit a custom compiler warning message. Very handy for marking bits of code as "to-do" items, or for shaming code written by your co-workers in a way that's hard to ignore. - GCC and Clang provide the \#warning directive, but MSVC doesn't, so this macro - is a cross-compiler way to get the same functionality as \#warning. + GCC and Clang provide the \#warning directive, but MSVC doesn't, so this + macro is a cross-compiler way to get the same functionality as \#warning. + + Unlike the \#warning directive in GCC and Clang this macro requires the + argument to passed as a quoted string. */ - #define JUCE_COMPILER_WARNING(message) _Pragma(JUCE_STRINGIFY (JUCE_WARNING_HELPER (message))) + #define JUCE_COMPILER_WARNING(msg) _Pragma (JUCE_STRINGIFY (message (msg))) #endif