DARWIN: Use -Werror=objc-method-access for objc

The default Xcode compiler options are insufficient to fail the build if
a method is not found. For example, a typo in the name of method
'componentsJoinedByString' results in the following build warning:

/TaskUtil.m:70:62: warning: instance method '-componentsJoinedBySting:'
          not found (return type defaults to 'id') [-Wobjc-method-access]
          NSLog(@"Task failed: %@ %@ status:%d.", taskName,
                [args componentsJoinedBySting:@", "], status);

Because this is only flagged as a warning, the build completes
successfully.  When this code runs, the AFSBackgrounder merely logs a
runtime exception every time it passes through the erroneous code.  This
is a silent failure, unless you happen to know how to check for
AFSBackgrounder log messages:

  $ log show --predicate 'process=="AFSBackgrounder"'

Add compiler flag '-Werror=objc-method-access' to all of our xcode-built
project files to treat this case as an error instead of a warning, so
the build will fail.

[adeason@sinenomine.net: Update all xcode project files.]

Change-Id: I69a9f45deb6710a50590bd79daf07466332a6ad1
Reviewed-on: https://gerrit.openafs.org/14586
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Mark Vitale 2021-04-07 22:50:13 -04:00 committed by Andrew Deason
parent d6a2b4b44d
commit 13ef511544
3 changed files with 18 additions and 0 deletions

View File

@ -847,6 +847,7 @@
GCC_PREFIX_HEADER = AFSCommander_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/PreferencePanes";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PRODUCT_NAME = OpenAFS;
WRAPPER_EXTENSION = prefPane;
ZERO_LINK = YES;
@ -865,6 +866,7 @@
GCC_PREFIX_HEADER = AFSCommander_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PRODUCT_NAME = OpenAFS;
WRAPPER_EXTENSION = prefPane;
};
@ -884,6 +886,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = "";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
SKIP_INSTALL = NO;
@ -904,6 +907,7 @@
GCC_ENABLE_OBJC_GC = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
VALID_ARCHS = "i386 ppc x86_64 armv6 arm64";
@ -923,6 +927,7 @@
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
INFOPLIST_FILE = AFSBackgrounder/resource/Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
OTHER_LDFLAGS = (
"-framework",
Foundation,
@ -946,6 +951,7 @@
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
INFOPLIST_FILE = AFSBackgrounder/resource/Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
OTHER_LDFLAGS = (
"-framework",
Foundation,
@ -970,6 +976,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
INSTALL_PATH = "$(HOME)/bin";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
OTHER_LDFLAGS = (
"-framework",
Foundation,
@ -992,6 +999,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
INSTALL_PATH = "$(HOME)/bin";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
OTHER_LDFLAGS = (
"-framework",
Foundation,
@ -1016,6 +1024,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
INSTALL_PATH = "$(HOME)/bin";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
OTHER_LDFLAGS = (
"-framework",
Foundation,
@ -1038,6 +1047,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
INSTALL_PATH = "$(HOME)/bin";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
OTHER_LDFLAGS = (
"-framework",
Foundation,

View File

@ -124,6 +124,7 @@
GCC_PREFIX_HEADER = AklogAuthPlugin_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PRODUCT_NAME = aklog;
WRAPPER_EXTENSION = bundle;
};
@ -143,6 +144,7 @@
GCC_PREFIX_HEADER = AklogAuthPlugin_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PRODUCT_NAME = aklog;
WRAPPER_EXTENSION = bundle;
};
@ -159,6 +161,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
SDKROOT = macosx10.6;
@ -175,6 +178,7 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
SDKROOT = macosx10.6;

View File

@ -224,6 +224,7 @@
GCC_PREFIX_HEADER = afscell_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PRODUCT_NAME = afscell;
WRAPPER_EXTENSION = bundle;
ZERO_LINK = YES;
@ -241,6 +242,7 @@
GCC_PREFIX_HEADER = afscell_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PRODUCT_NAME = afscell;
WRAPPER_EXTENSION = bundle;
};
@ -251,6 +253,7 @@
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PREBINDING = NO;
};
name = Debug;
@ -261,6 +264,7 @@
GCC_ENABLE_OBJC_GC = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
"OTHER_CFLAGS[arch=*]" = "-Werror=objc-method-access";
PREBINDING = NO;
};
name = Release;