Browse Source

UB Sanitizer: Avoid warnings in third party code, with clang

v6.1.6
reuk 3 years ago
parent
commit
afa6465098
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
5 changed files with 38 additions and 1 deletions
  1. +2
    -0
      modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
  2. +4
    -0
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  3. +4
    -0
      modules/juce_audio_processors/format_types/juce_VST3Common.h
  4. +6
    -0
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  5. +22
    -1
      modules/juce_core/system/juce_CompilerWarnings.h

+ 2
- 0
modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp View File

@@ -50,6 +50,7 @@ namespace OggVorbisNamespace
"-Wmisleading-indentation",
"-Wmissing-prototypes",
"-Wcast-align")
JUCE_BEGIN_NO_SANITIZE ("undefined")
#include "oggvorbis/vorbisenc.h"
#include "oggvorbis/codec.h"
@@ -79,6 +80,7 @@ namespace OggVorbisNamespace
#include "oggvorbis/libvorbis-1.3.7/lib/vorbisfile.c"
#include "oggvorbis/libvorbis-1.3.7/lib/window.c"
JUCE_END_NO_SANITIZE
JUCE_END_IGNORE_WARNINGS_MSVC
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#else


+ 4
- 0
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -29,6 +29,8 @@
//==============================================================================
#if JucePlugin_Build_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD)
JUCE_BEGIN_NO_SANITIZE ("vptr")
#if JUCE_PLUGINHOST_VST3
#if JUCE_MAC
#include <CoreFoundation/CoreFoundation.h>
@@ -3989,4 +3991,6 @@ extern "C" SMTG_EXPORT_SYMBOL IPluginFactory* PLUGIN_API GetPluginFactory()
extern "C" BOOL WINAPI DllMain (HINSTANCE instance, DWORD reason, LPVOID) { if (reason == DLL_PROCESS_ATTACH) Process::setCurrentModuleInstanceHandle (instance); return true; }
#endif
JUCE_END_NO_SANITIZE
#endif //JucePlugin_Build_VST3

+ 4
- 0
modules/juce_audio_processors/format_types/juce_VST3Common.h View File

@@ -28,6 +28,8 @@
namespace juce
{
JUCE_BEGIN_NO_SANITIZE ("vptr")
//==============================================================================
#define JUCE_DECLARE_VST3_COM_REF_METHODS \
Steinberg::uint32 PLUGIN_API addRef() override { return (Steinberg::uint32) ++refCount; } \
@@ -1219,6 +1221,8 @@ private:
std::atomic<int32> flags { 0 };
};
JUCE_END_NO_SANITIZE
} // namespace juce
#endif // ! DOXYGEN

+ 6
- 0
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -31,6 +31,10 @@
namespace juce
{
// UB Sanitizer doesn't necessarily have instrumentation for loaded plugins, so
// it won't recognize the dynamic types of pointers to the plugin's interfaces.
JUCE_BEGIN_NO_SANITIZE ("vptr")
using namespace Steinberg;
//==============================================================================
@@ -3767,6 +3771,8 @@ FileSearchPath VST3PluginFormat::getDefaultLocationsToSearch()
#endif
}
JUCE_END_NO_SANITIZE
} // namespace juce
#endif // JUCE_PLUGINHOST_VST3

+ 22
- 1
modules/juce_core/system/juce_CompilerWarnings.h View File

@@ -189,7 +189,7 @@
#define JUCE_IGNORE_MSVC(warnings) __pragma(warning(disable:warnings))
#define JUCE_BEGIN_IGNORE_WARNINGS_LEVEL_MSVC(level, warnings) \
__pragma(warning(push, level)) JUCE_IGNORE_MSVC(warnings)
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings) \
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings) \
__pragma(warning(push)) JUCE_IGNORE_MSVC(warnings)
#define JUCE_END_IGNORE_WARNINGS_MSVC __pragma(warning(pop))
#else
@@ -198,3 +198,24 @@
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings)
#define JUCE_END_IGNORE_WARNINGS_MSVC
#endif
#if JUCE_MAC || JUCE_IOS
#define JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION 10
#else
#define JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION 5
#endif
/** Disable sanitizers for a range of functions.
This functionality doesn't seem to exist on GCC yet, so at the moment this only works for clang.
*/
#if JUCE_CLANG && __clang_major__ >= JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION
#define JUCE_BEGIN_NO_SANITIZE(warnings) \
_Pragma(JUCE_TO_STRING(clang attribute push(__attribute__((no_sanitize(warnings))), apply_to=function)))
#define JUCE_END_NO_SANITIZE _Pragma(JUCE_TO_STRING(clang attribute pop))
#else
#define JUCE_BEGIN_NO_SANITIZE(warnings)
#define JUCE_END_NO_SANITIZE
#endif
#undef JUCE_SANITIZER_ATTRIBUTE_MINIMUM_CLANG_VERSION

Loading…
Cancel
Save