From 5d091e09622eda04542bf5972331b8e9e2d5d86f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Jul 2018 02:26:45 +0200 Subject: [PATCH] Avoid harmless warning about using nil in wxMac wxNotebook code At least with 10.12 SDK, NSTabViewItem initWithIdentifier: parameter isn't annotated as being nullable, so passing "nil" to it triggers a compiler warning. This warning is apparently harmless and the header was fixed in 10.13 SDK, so just suppress it. --- src/osx/cocoa/notebook.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/osx/cocoa/notebook.mm b/src/osx/cocoa/notebook.mm index 0a3862ac24..396136ff32 100644 --- a/src/osx/cocoa/notebook.mm +++ b/src/osx/cocoa/notebook.mm @@ -112,10 +112,18 @@ @implementation WXCTabViewImageItem : NSTabViewItem - (id)init { + // With 10.12 SDK initWithIdentifier: is declared as taking a non-nil value + // and while this was fixed in 10.13 by adding the missing "nullable", + // avoid the annoying warning with 10.12 by explicitly disabling it. + wxCLANG_WARNING_SUPPRESS(nonnull) + if (self = [super initWithIdentifier:nil]) { m_image = nil; } + + wxCLANG_WARNING_RESTORE(nonnull) + return self; } - (void)dealloc