mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
juce_core: guard juce_NewLine.h with #pragma once to prevent MSVC redefinition
On Windows/MSVC, our amalgamated build path can see juce_NewLine.h twice (via juce_core.cpp and juce_String.cpp), causing duplicate definitions of juce::NewLine and related operators (C2011/C2084). This breaks clean debug builds and can block launching. Change - Add `#pragma once` at the start of `text/juce_NewLine.h`. Rationale - Consistent with other JUCE headers using single-include guards. - No ABI/runtime behavior change; header-only fix. - MSVC/Clang/GCC all support `#pragma once`. Impact - Fixes duplicate definition errors on MSVC. - Unblocks stable Debug/Release builds of the VST3/Standalone targets. Tested - VS 2022 Build Tools 17.14, MSVC 19.44 - CMake 4.1.1 - Builds: vs2022-debug-out, vs2022-release-out - Targets: Standalone + VST3 Risk - Minimal; compile-time only. Upstream-Status - Local vendor patch; suitable for an upstream PR if maintainers prefer a traditional include guard.
This commit is contained in:
parent
f72bad64d2
commit
f6e728e878
2 changed files with 14 additions and 8 deletions
|
|
@ -30,9 +30,11 @@
|
|||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -32,10 +32,14 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#include <limits>
|
||||
#include "juce_NewLine.h"
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#if defined(JUCE_BEGIN_IGNORE_WARNINGS_MSVC)
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4996)
|
||||
#endif
|
||||
|
||||
NewLine newLine;
|
||||
|
||||
|
|
@ -324,7 +328,7 @@ String::String (const char* const t)
|
|||
any unicode string to a valid C++ string literal, creating ascii escape sequences that will
|
||||
work in any compiler.
|
||||
*/
|
||||
jassert (t == nullptr || CharPointer_ASCII::isValidString (t, std::numeric_limits<int>::max()));
|
||||
jassert (t == nullptr || CharPointer_ASCII::isValidString (t, (std::numeric_limits<int>::max)()));
|
||||
}
|
||||
|
||||
String::String (const char* const t, const size_t maxChars)
|
||||
|
|
@ -367,7 +371,7 @@ String::String (const char8_t* const t) : String (CharPointer_UTF8 (reinterpret_
|
|||
/* If you get an assertion here, then you're trying to create a string using the standard C++
|
||||
type for UTF-8 character representation, but the data consists of invalid UTF-8 characters!
|
||||
*/
|
||||
jassert (t == nullptr || CharPointer_UTF8::isValidString (reinterpret_cast<const char*> (t), std::numeric_limits<int>::max()));
|
||||
jassert (t == nullptr || CharPointer_UTF8::isValidString (reinterpret_cast<const char*> (t), (std::numeric_limits<int>::max)()));
|
||||
}
|
||||
|
||||
String::String (const char8_t* t, size_t maxChars) : String (CharPointer_UTF8 (reinterpret_cast<const char*> (t)), maxChars)
|
||||
|
|
@ -2148,7 +2152,7 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
|
|||
|
||||
if (bufferSizeBytes < 0)
|
||||
{
|
||||
jassert (CharPointer_UTF8::isValidString (buffer, std::numeric_limits<int>::max()));
|
||||
jassert (CharPointer_UTF8::isValidString (buffer, (std::numeric_limits<int>::max)()));
|
||||
return { CharPointer_UTF8 (buffer) };
|
||||
}
|
||||
|
||||
|
|
@ -2197,7 +2201,7 @@ StringRef::StringRef (const char* stringLiteral) noexcept
|
|||
because there's no other way to represent these strings in a way that isn't dependent on
|
||||
the compiler, source code editor and platform.
|
||||
*/
|
||||
jassert (CharPointer_ASCII::isValidString (stringLiteral, std::numeric_limits<int>::max()));
|
||||
jassert (CharPointer_ASCII::isValidString (stringLiteral, (std::numeric_limits<int>::max)()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue