Compiler warnings with Xcode 13.3

Hello, I updated to the latest Xcode 13.3 version and started getting a lot of warnings when compiling Projucer, such as:

JUCE/modules/juce_core/network/juce_URL.h:56:5: warning: definition of implicit copy assignment operator for 'URL' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-with-dtor]
    ~URL() = default;

JUCE/modules/juce_core/containers/juce_ElementComparator.h:44:28: warning: definition of implicit copy constructor for 'SortFunctionConverter<ResourceSorter>' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
    SortFunctionConverter& operator= (const SortFunctionConverter&) = delete;

Hello, any news on this? The same warnings happen all over the juce modules when building my app as well.

We’ll fix these.

We’re also running into something that’s consistently crashing the compiler when using Xcode 13.3, and investigating that has slowed us down.


We recently ran into this issue as well. A colleague found “the root cause of this is newly added compiler warning option Wdeprecated-copy, which triggers when dev overrides copy ctor/operator= and doesn’t override companion function.”

This issue can be resolved by adding the following line after SortFunctionConvertor constructor:

SortFunctionConverter(const SortFunctionConverter&) = default;
1 Like

Thank you for the fixes! There are still 6 warnings remaining in pngrutil.c (l.3556, 3557, 3564, 3565, 4624, 4628):

JUCE/modules/juce_graphics/image_formats/pnglib/pngrutil.c:3556:20: warning: performing pointer subtraction with a null pointer may have undefined behavior [-Wnull-pointer-subtraction]
                   png_isaligned(dp, png_uint_16) &&

Please can you provide more details? Are you using any custom compiler flags or preprocessor definitions? Are you building in Release or Debug mode? Are you building for macOS or iOS, and for what architecture?

Yes, sorry. It seems related to the use of -Wextra so it’s on my side. It happens in Debug and Release, for macOS x86_64 and Silicon. It was not the case before XCode 13.3, so I guess the -Wnull-pointer-subtraction was introduced with the -Wextra compile definition with this version. Is there any chance it could be fixed on Juce side (because the -Wextra compile definition can be useful)?

1 Like

@reuk It’s just a matter of adding "-Wnull-pointer-subtraction" to the list of ignored warnings in juce_graphics/image_formats/juce_PNGLoader.cpp line 66

Perhaps it might be necessary to check the compiler version to avoid unknown warning option '-Wno-null-pointer-subtraction' with earlier Xcode versions.

Indeed, both clang and gcc warn if you #pragma diagnostic ignore something they don’t know about.
GCC does not know this warning at all…

Edit: clang has a __has_warning macro so we could use that:

Edit2: looking at juce warning management macros, JUCE already uses __has_warning (and if that is not the case, -Wpragmas is ignored first to not trigger a warning due to ignoring an unknown warning…).

so all is good, this one warning just needs to be added to the list and everything will be fine :slight_smile: