Is there any easy way to enable extra warning on Windows for only my application code and have the warnings disabled for the juce library code?
1 Like
You can add a “Compiler Flag Scheme”:
then specify the warning flags in the
Compiler Flags for "<scheme>" field of the exporter.
The only downside of this method is that the warnings will also be enabled for JUCE code that is included in your source files.
If you want to enable warnings in a more restricted way, you can use something like
#if defined(_MSC_VER)
#pragma warning(default:4700)
#endif
See https://docs.microsoft.com/en-us/cpp/preprocessor/warning for more details.
I ended up disabling 4242 with a pragma, maybe this could get done in main branch as well?
diff --git a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
index f138d8c89..6e6239112 100644
--- a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
+++ b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp
@@ -38,7 +38,7 @@ namespace OggVorbisNamespace
#if JUCE_INCLUDE_OGGVORBIS_CODE || ! defined (JUCE_INCLUDE_OGGVORBIS_CODE)
#if JUCE_MSVC
#pragma warning (push)
- #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4305 4189 4706 4995 4365 4456 4457 4459)
+ #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4305 4189 4706 4995 4365 4456 4457 4459 4242)
#elif JUCE_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
diff --git a/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp b/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp
index 624c4b1a7..e41eae87a 100644
--- a/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp
+++ b/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp
@@ -25,7 +25,7 @@ namespace juce
#if JUCE_MSVC
#pragma warning (push)
- #pragma warning (disable: 4309 4305 4365)
+ #pragma warning (disable: 4309 4305 4365 4242)
#endif
namespace zlibNamespace
diff --git a/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp b/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
index 413e519e3..5d6fffcba 100644
--- a/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
+++ b/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp
@@ -29,7 +29,7 @@ namespace juce
#if JUCE_MSVC
#pragma warning (push)
- #pragma warning (disable: 4365)
+ #pragma warning (disable: 4365 4242)
#endif
namespace jpeglibNamespace

