Repository: boredzo/Warnings-xcconfig
Branch: master
Commit: 40ffe33f6160
Files: 19
Total size: 29.5 KB
Directory structure:
gitextract_6jlciqel/
├── README.md
├── Warnings.xcconfig
└── WarningsTest/
├── WarningsTest.xcodeproj/
│ ├── project.pbxproj
│ └── project.xcworkspace/
│ └── contents.xcworkspacedata
└── WarningsTestTests/
├── AssortedWarningTests.h
├── AssortedWarningTests.m
├── DeprecationWarningTests.h
├── DeprecationWarningTests.m
├── FunctionWarningTests.h
├── FunctionWarningTests.m
├── InitializerWarningTests.h
├── InitializerWarningTests.m
├── ShadowingWarningTests.h
├── ShadowingWarningTests.m
├── UnusedTokenWarningTests.h
├── UnusedTokenWarningTests.m
├── WarningsTest-Prefix.pch
├── WarningsTestTests-Info.plist
└── en.lproj/
└── InfoPlist.strings
================================================
FILE CONTENTS
================================================
================================================
FILE: README.md
================================================
# Warnings
This is an xcconfig file to make it easy for you to turn on [a large suite of useful warnings](https://github.com/boredzo/Warnings-xcconfig/wiki/Warnings-Explained) in your Xcode project. These warnings catch bugs, so turning them on may identify bugs you can fix now and having them on will prevent bugs later.
If you have an existing project you've developed without these warnings turned on, you probably will have a number of warnings after turning them on. These are bugs in your code, newly revealed—fixing the warnings is fixing bugs.
The file also turns on Treat Warnings as Errors—so you can't just ignore warnings; you must fix them in order to be able to build—and the setting to run the Clang Static Analyzer in every build, which will find even more bugs (mostly leaks and crashers).
If you are new to Objective-C, you may find that you encounter build errors more frequently when using these settings. That is correct, expected, and good—the errors are bugs that would otherwise have gone undetected! Use these settings to identify your bad habits and things you don't fully understand, and take the opportunities to learn. You will learn better and faster with these warnings enabled.
## The xcconfig file
### Usage
1. Copy it to your own project's root directory (the directory containing the .xcodeproj package).
2. Add it to the project. In a modern project, it should be at the top level, either at the top of the list or below all of the per-target groups.
3. Edit the project object (the very topmost item in the Project Navigator).
4. Select the project, not any target.
5. Select the Info tab.
6. Under Configurations, expand both/all of the configurations.
7. For each configuration, set the pop-up menu for the project to “Warnings” (which is the xcconfig file you just added).
### What if you're already using an xcconfig file?
Xcode supports preprocessor directives in xcconfig files, so you can `#include` the Warnings file from your existing xcconfig file.
## The test project
WarningsTest is an Xcode project containing a unit test bundle target. The project uses the xcconfig file, and the tests demonstrate the kinds of bugs that the file tells the compiler to warn about.
### Usage
Open it in Xcode, hold down on the verb button (the one that says Run by default) and choose Test. This will attempt to build the unit test bundle and run the tests.
It will fail, because the tests are all written to demonstrate the warnings, not to test other code. (There is no code under test.) Because of all the warnings and the Treat Warnings as Errors setting, the build will never succeed.
## Credits
- Peter Hosey made [a list of important warnings](http://boredzo.org/blog/archives/2009-11-07/warnings).
- Steven Fisher [made the original xcconfig file of warning settings](http://tewha.net/2010/11/xcode-warnings/).
================================================
FILE: Warnings.xcconfig
================================================
//
// MoreWarnings.xcconfig
//
// Created by Steven Fisher:
// http://tewha.net/2010/11/xcode-warnings/
// See also:
// http://boredzo.org/blog/archives/2009-11-07/warnings
//
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
GCC_WARN_SHADOW = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INT_CONVERSION = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES
GCC_WARN_MISSING_PARENTHESES = YES
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
GCC_WARN_SIGN_COMPARE = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_LABEL = YES
GCC_WARN_UNUSED_VALUE = YES
GCC_WARN_UNUSED_VARIABLE = YES
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
CLANG_WARN_ASSIGN_ENUM = YES
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
OTHER_CFLAGS = -Wextra -Wno-unused-parameter -Wformat=2 -Wunreachable-code
GCC_TREAT_WARNINGS_AS_ERRORS = YES
RUN_CLANG_STATIC_ANALYZER = YES
================================================
FILE: WarningsTest/WarningsTest.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
31043D7014A2ED710049DF02 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31043D6F14A2ED710049DF02 /* SenTestingKit.framework */; };
31043D7114A2ED720049DF02 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31043D5114A2ED710049DF02 /* Cocoa.framework */; };
31043D7914A2ED720049DF02 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 31043D7714A2ED720049DF02 /* InfoPlist.strings */; };
31043D7C14A2ED720049DF02 /* AssortedWarningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 31043D7B14A2ED720049DF02 /* AssortedWarningTests.m */; };
31043D8914A30BD70049DF02 /* FunctionWarningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 31043D8814A30BD70049DF02 /* FunctionWarningTests.m */; };
31043D8C14A30D400049DF02 /* InitializerWarningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 31043D8B14A30D400049DF02 /* InitializerWarningTests.m */; };
31043D8F14A30DA20049DF02 /* UnusedTokenWarningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 31043D8E14A30DA20049DF02 /* UnusedTokenWarningTests.m */; };
31043D9214A30DD20049DF02 /* ShadowingWarningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 31043D9114A30DD20049DF02 /* ShadowingWarningTests.m */; };
31043D9514A325900049DF02 /* DeprecationWarningTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 31043D9414A325900049DF02 /* DeprecationWarningTests.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
31043D5114A2ED710049DF02 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
31043D5414A2ED710049DF02 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
31043D5514A2ED710049DF02 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
31043D5614A2ED710049DF02 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
31043D6E14A2ED710049DF02 /* WarningsTestTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WarningsTestTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
31043D6F14A2ED710049DF02 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
31043D7614A2ED720049DF02 /* WarningsTestTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WarningsTestTests-Info.plist"; sourceTree = "<group>"; };
31043D7814A2ED720049DF02 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
31043D7A14A2ED720049DF02 /* AssortedWarningTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AssortedWarningTests.h; sourceTree = "<group>"; };
31043D7B14A2ED720049DF02 /* AssortedWarningTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AssortedWarningTests.m; sourceTree = "<group>"; };
31043D8514A2ED930049DF02 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Warnings.xcconfig; path = ../Warnings.xcconfig; sourceTree = "<group>"; };
31043D8614A2F7B20049DF02 /* WarningsTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WarningsTest-Prefix.pch"; sourceTree = "<group>"; };
31043D8714A30BD70049DF02 /* FunctionWarningTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionWarningTests.h; sourceTree = "<group>"; };
31043D8814A30BD70049DF02 /* FunctionWarningTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionWarningTests.m; sourceTree = "<group>"; };
31043D8A14A30D400049DF02 /* InitializerWarningTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializerWarningTests.h; sourceTree = "<group>"; };
31043D8B14A30D400049DF02 /* InitializerWarningTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitializerWarningTests.m; sourceTree = "<group>"; };
31043D8D14A30DA20049DF02 /* UnusedTokenWarningTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnusedTokenWarningTests.h; sourceTree = "<group>"; };
31043D8E14A30DA20049DF02 /* UnusedTokenWarningTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnusedTokenWarningTests.m; sourceTree = "<group>"; };
31043D9014A30DD20049DF02 /* ShadowingWarningTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowingWarningTests.h; sourceTree = "<group>"; };
31043D9114A30DD20049DF02 /* ShadowingWarningTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShadowingWarningTests.m; sourceTree = "<group>"; };
31043D9314A325900049DF02 /* DeprecationWarningTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecationWarningTests.h; sourceTree = "<group>"; };
31043D9414A325900049DF02 /* DeprecationWarningTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeprecationWarningTests.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
31043D6A14A2ED710049DF02 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
31043D7014A2ED710049DF02 /* SenTestingKit.framework in Frameworks */,
31043D7114A2ED720049DF02 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
31043D4214A2ED710049DF02 = {
isa = PBXGroup;
children = (
31043D8514A2ED930049DF02 /* Warnings.xcconfig */,
31043D7414A2ED720049DF02 /* WarningsTestTests */,
31043D5014A2ED710049DF02 /* Frameworks */,
31043D4E14A2ED710049DF02 /* Products */,
);
sourceTree = "<group>";
};
31043D4E14A2ED710049DF02 /* Products */ = {
isa = PBXGroup;
children = (
31043D6E14A2ED710049DF02 /* WarningsTestTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
31043D5014A2ED710049DF02 /* Frameworks */ = {
isa = PBXGroup;
children = (
31043D5114A2ED710049DF02 /* Cocoa.framework */,
31043D6F14A2ED710049DF02 /* SenTestingKit.framework */,
31043D5314A2ED710049DF02 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
31043D5314A2ED710049DF02 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
31043D5414A2ED710049DF02 /* AppKit.framework */,
31043D5514A2ED710049DF02 /* CoreData.framework */,
31043D5614A2ED710049DF02 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
31043D7414A2ED720049DF02 /* WarningsTestTests */ = {
isa = PBXGroup;
children = (
31043D7A14A2ED720049DF02 /* AssortedWarningTests.h */,
31043D7B14A2ED720049DF02 /* AssortedWarningTests.m */,
31043D8714A30BD70049DF02 /* FunctionWarningTests.h */,
31043D8814A30BD70049DF02 /* FunctionWarningTests.m */,
31043D8A14A30D400049DF02 /* InitializerWarningTests.h */,
31043D8B14A30D400049DF02 /* InitializerWarningTests.m */,
31043D8D14A30DA20049DF02 /* UnusedTokenWarningTests.h */,
31043D8E14A30DA20049DF02 /* UnusedTokenWarningTests.m */,
31043D9014A30DD20049DF02 /* ShadowingWarningTests.h */,
31043D9114A30DD20049DF02 /* ShadowingWarningTests.m */,
31043D9314A325900049DF02 /* DeprecationWarningTests.h */,
31043D9414A325900049DF02 /* DeprecationWarningTests.m */,
31043D7514A2ED720049DF02 /* Supporting Files */,
);
path = WarningsTestTests;
sourceTree = "<group>";
};
31043D7514A2ED720049DF02 /* Supporting Files */ = {
isa = PBXGroup;
children = (
31043D7614A2ED720049DF02 /* WarningsTestTests-Info.plist */,
31043D7714A2ED720049DF02 /* InfoPlist.strings */,
31043D8614A2F7B20049DF02 /* WarningsTest-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
31043D6D14A2ED710049DF02 /* WarningsTestTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 31043D8214A2ED720049DF02 /* Build configuration list for PBXNativeTarget "WarningsTestTests" */;
buildPhases = (
31043D6914A2ED710049DF02 /* Sources */,
31043D6A14A2ED710049DF02 /* Frameworks */,
31043D6B14A2ED710049DF02 /* Resources */,
31043D6C14A2ED710049DF02 /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = WarningsTestTests;
productName = WarningsTestTests;
productReference = 31043D6E14A2ED710049DF02 /* WarningsTestTests.octest */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
31043D4414A2ED710049DF02 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
ORGANIZATIONNAME = "";
};
buildConfigurationList = 31043D4714A2ED710049DF02 /* Build configuration list for PBXProject "WarningsTest" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 31043D4214A2ED710049DF02;
productRefGroup = 31043D4E14A2ED710049DF02 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
31043D6D14A2ED710049DF02 /* WarningsTestTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
31043D6B14A2ED710049DF02 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
31043D7914A2ED720049DF02 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
31043D6C14A2ED710049DF02 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
31043D6914A2ED710049DF02 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
31043D7C14A2ED720049DF02 /* AssortedWarningTests.m in Sources */,
31043D8914A30BD70049DF02 /* FunctionWarningTests.m in Sources */,
31043D8C14A30D400049DF02 /* InitializerWarningTests.m in Sources */,
31043D8F14A30DA20049DF02 /* UnusedTokenWarningTests.m in Sources */,
31043D9214A30DD20049DF02 /* ShadowingWarningTests.m in Sources */,
31043D9514A325900049DF02 /* DeprecationWarningTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
31043D7714A2ED720049DF02 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
31043D7814A2ED720049DF02 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
31043D7D14A2ED720049DF02 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 31043D8514A2ED930049DF02 /* Warnings.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
31043D7E14A2ED720049DF02 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 31043D8514A2ED930049DF02 /* Warnings.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
31043D8314A2ED720049DF02 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/WarningsTest.app/Contents/MacOS/WarningsTest";
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WarningsTestTests/WarningsTest-Prefix.pch";
INFOPLIST_FILE = "WarningsTestTests/WarningsTestTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
31043D8414A2ED720049DF02 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/WarningsTest.app/Contents/MacOS/WarningsTest";
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WarningsTestTests/WarningsTest-Prefix.pch";
INFOPLIST_FILE = "WarningsTestTests/WarningsTestTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
31043D4714A2ED710049DF02 /* Build configuration list for PBXProject "WarningsTest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
31043D7D14A2ED720049DF02 /* Debug */,
31043D7E14A2ED720049DF02 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
31043D8214A2ED720049DF02 /* Build configuration list for PBXNativeTarget "WarningsTestTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
31043D8314A2ED720049DF02 /* Debug */,
31043D8414A2ED720049DF02 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 31043D4414A2ED710049DF02 /* Project object */;
}
================================================
FILE: WarningsTest/WarningsTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:WarningsTest.xcodeproj">
</FileRef>
</Workspace>
================================================
FILE: WarningsTest/WarningsTestTests/AssortedWarningTests.h
================================================
//
// AssortedWarningTests.h
// WarningsTestTests
//
// Created by Peter Hosey on 2011-12-21.
//
#import <SenTestingKit/SenTestingKit.h>
@interface AssortedWarningTests : SenTestCase
@end
================================================
FILE: WarningsTest/WarningsTestTests/AssortedWarningTests.m
================================================
//
// AssortedWarningTests.m
// WarningsTestTests
//
// Created by Peter Hosey on 2011-12-21.
//
#import "AssortedWarningTests.h"
#include <mach/mach_time.h>
@implementation AssortedWarningTests
- (void) setUp {
srandom((unsigned)time(NULL));
}
- (void) testCheckSwitchStatements {
enum {
kFoo,
kBar,
kBaz,
kQux,
} value = ((int)random()) % 4;
switch (value) {
case kFoo:
NSLog(@"Foo");
break;
case kBar:
NSLog(@"Bar");
break;
case kBaz:
NSLog(@"Baz");
break;
//kQux intentionally omitted (to trigger the warning)
}
}
- (void) test64To32 {
uint64_t absoluteTime = mach_absolute_time();
uint64_t nanoseconds = UnsignedWideToUInt64(AbsoluteToNanoseconds(UInt64ToUnsignedWide(absoluteTime)));
uint32_t fractionOfASecond = (nanoseconds % 1000000000ULL);
STAssertTrue(fractionOfASecond >= 0, @"Strange number of nanoseconds after the whole second in %llu", nanoseconds);
}
- (void) testMissingParentheses {
if (true)
if (true)
STAssertTrue(true, @"True!", true);
if (false)
STAssertFalse(false, @"False is true!", true);
}
- (void) testSignComparison {
signed int temperature = -32;
unsigned int freezingPoint = 0U;
STAssertTrue(temperature > freezingPoint, @"Temperature is below freezing!");
}
- (void) testComparisonOfPointerRelationallyToZero {
STAssertTrue(@"Foo" > 0, @"A string is not greater than zero!");
STAssertTrue(@"Foo" < 0, @"A string is not greater than zero!");
}
- (void) testUndeclaredSelector {
STAssertFalse([self respondsToSelector:@selector(onMyMark:getSet:go:)], @"Test case object responds to a made-up message!");
}
- (void) testFormat {
NSUInteger answer = 42;
//Don't actually run these at test time; just make sure they get compiled.
if (time(NULL) == 0) {
NSLog(@"Signed where we mean unsigned: %ld", answer);
NSLog(@"Int where we mean long: %u", answer);
NSLog(@"C string where we mean NSString: %s", self->fred);
NSLog(@"NSObject where we mean C string: %@", __func__);
NSLog(@"NSObject where we mean int: %@", answer);
}
}
- (void) testUnreachableCode {
bool assertedNonZero = false;
long num = random();
num |= 0b100;
if (num > 0b011)
goto fail;
goto fail;
STAssertEquals(num, 0L, @"num is not equal to 0");
assertedNonZero = true;
fail:
STAssertTrue(assertedNonZero, @"Did not assert non-zero");
NSLog(@"Completed");
}
- (void) testOverloadedVirtualFunctions {
//We can't actually test this in pure Objective-C code. Someone will need to write an Objective-C++ test case class to do it.
}
- (void) testUndefinedUseOfOffsetof {
//We can't actually test this in pure Objective-C code. Someone will need to write an Objective-C++ test case class to do it.
}
- (void) testNonVirtualDestructor {
//We can't actually test this in pure Objective-C code. Someone will need to write an Objective-C++ test case class to do it.
}
@end
================================================
FILE: WarningsTest/WarningsTestTests/DeprecationWarningTests.h
================================================
//
// DeprecationWarningTests.h
// WarningsTest
//
// Created by Peter Hosey on 2011-12-22.
//
#import <SenTestingKit/SenTestingKit.h>
@interface DeprecationWarningTests : SenTestCase
@end
================================================
FILE: WarningsTest/WarningsTestTests/DeprecationWarningTests.m
================================================
//
// DeprecationWarningTests.m
// WarningsTest
//
// Created by Peter Hosey on 2011-12-22.
//
#import "DeprecationWarningTests.h"
@interface Foo : NSObject
- (void) doThing DEPRECATED_ATTRIBUTE;
@end
@interface Bar : Foo
@end
@implementation DeprecationWarningTests
- (void) testDeprecatedFunctions {
NSMutableArray *arrayOfOneThing = [NSMutableArray arrayWithObject:@"Frank"];
enum { numIndices = 1U };
NSUInteger indices[numIndices] = { 0UL };
STAssertNoThrow([arrayOfOneThing removeObjectsFromIndices:indices numIndices:numIndices], @"Removing an object threw an exception!");
NSWindow *window = nil;
if (window || (time(NULL) == 0)) {
NSRunAlertPanelRelativeToWindow(NSLocalizedString(@"OH NO!", /*comment*/ NULL), NSLocalizedString(@"The sky is falling!", /*comment*/ NULL), /*defaultButton*/ NSLocalizedString(@"Run!", /*comment*/ NULL), /*alternateButton*/ nil, /*otherButton*/ nil, window);
}
}
@end
@implementation Foo
- (void) doThing {
NSLog(@"%@", __func__);
}
@end
@implementation Bar : Foo
- (void) doThing {
NSLog(@"This is the override of a deprecated method");
[super doThing];
}
@end
================================================
FILE: WarningsTest/WarningsTestTests/FunctionWarningTests.h
================================================
//
// FunctionWarningTests.h
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import <SenTestingKit/SenTestingKit.h>
@interface FunctionWarningTests : SenTestCase
@end
================================================
FILE: WarningsTest/WarningsTestTests/FunctionWarningTests.m
================================================
//
// FunctionWarningTests.m
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import "FunctionWarningTests.h"
static functionWithoutReturnType(void);
static int functionWithReturnType(void);
static void unusedFunction(void);
@implementation FunctionWarningTests
- (void) testMismatchedReturnType {
STAssertNoThrow(functionWithoutReturnType(), @"functionWithoutReturnType threw an exception!");
STAssertEquals(functionWithReturnType(), 42, @"functionWithReturnType returned something other than 42!");
}
- (void) testMissingPrototypes {
STAssertEquals(functionWithNoPrototype(), M_PI, @"functionWithNoPrototype returned something not equal to pi!");
}
@end
static functionWithoutReturnType(void) {
return 42;
}
static int functionWithReturnType(void) {
return;
}
static void unusedFunction(void) {
enum { HORIZONTAL_ELLIPSIS = 0x2026 };
NSLog(@"I'm so lonely%C", HORIZONTAL_ELLIPSIS);
}
static double functionWithNoPrototype(void) {
return M_PI;
}
================================================
FILE: WarningsTest/WarningsTestTests/InitializerWarningTests.h
================================================
//
// InitializerWarningTests.h
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import <SenTestingKit/SenTestingKit.h>
@interface InitializerWarningTests : SenTestCase
@end
================================================
FILE: WarningsTest/WarningsTestTests/InitializerWarningTests.m
================================================
//
// InitializerWarningTests.m
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import "InitializerWarningTests.h"
@implementation InitializerWarningTests
- (void) testInitializerNotFullyBracketed {
NSRect rect = { 0, 0, 640, 480 };
STAssertEquals(rect.size.width, (CGFloat)640.0, @"Width not equal to 640!");
STAssertEquals(rect.size.height, (CGFloat)480.0, @"Width not equal to 480!");
}
- (void) testMissingFieldInitializers {
NSRect bounds = { { 640, 480 } }; //Note: Missing origin
STAssertEquals(bounds.size.width, (CGFloat)640.0, @"Width not equal to 640!");
STAssertEquals(bounds.size.height, (CGFloat)480.0, @"Width not equal to 480!");
}
@end
================================================
FILE: WarningsTest/WarningsTestTests/ShadowingWarningTests.h
================================================
//
// ShadowingWarningTests.h
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import <SenTestingKit/SenTestingKit.h>
@interface ShadowingWarningTests : SenTestCase
@end
================================================
FILE: WarningsTest/WarningsTestTests/ShadowingWarningTests.m
================================================
//
// ShadowingWarningTests.m
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
// Copyright (c) 2011 Captured Magic, LLC. All rights reserved.
//
#import "ShadowingWarningTests.h"
NSString *fred = @"Fred";
@implementation ShadowingWarningTests
{
NSString *fred, *wilma;
}
- (void) setUp {
self->fred = @"Fred";
self->wilma = @"Wilma";
}
- (void) testLocalShadowsInstanceVariable {
NSString *wilma = @"Wilma";
STAssertEqualObjects(wilma, @"Wilma", @"Local variable wilma was not equal to @\"Wilma\"");
}
- (void) testLocalShadowsGlobal {
NSString *fred = @"Fred";
STAssertEqualObjects(fred, @"Fred", @"Local variable wilma was not equal to @\"Fred\"");
}
- (void) testInstanceVariableShadowsGlobal {
STAssertEqualObjects(fred, @"Fred", @"Instance variable wilma was not equal to @\"Fred\"");
}
@end
================================================
FILE: WarningsTest/WarningsTestTests/UnusedTokenWarningTests.h
================================================
//
// UnusedTokenWarningTests.h
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import <SenTestingKit/SenTestingKit.h>
@interface UnusedTokenWarningTests : SenTestCase
@end
================================================
FILE: WarningsTest/WarningsTestTests/UnusedTokenWarningTests.m
================================================
//
// UnusedTokenWarningTests.m
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#import "UnusedTokenWarningTests.h"
@implementation UnusedTokenWarningTests
- (void) testUnusedLabel {
STAssertTrue(true, @"True is not true!");
testFalse:
STAssertFalse(false, @"False is not false!");
}
- (void) testUnusedValue {
4 + 4;
STAssertTrue(4 + 4, @"4 + 4 is false!");
}
- (void) testUnusedVariable {
NSUInteger answer = 42;
STAssertTrue(true, @"True is not true!");
}
//This *shouldn't* warn (since parameters often do go legitimately unused, especially in delegate methods). It is enabled by -Wextra and disabled explicitly immediately afterward.
- (bool) thing:(NSString *)str totallyIrrelevantParameter:(double)d {
return (str != nil);
}
- (void) testUnusedParameter {
STAssertTrue([self thing:@"foo" totallyIrrelevantParameter:42.0], @"thing:totallyIrrelevantParameter: returned false for a non-nil string!");
STAssertFalse([self thing:nil totallyIrrelevantParameter:42.0], @"thing:totallyIrrelevantParameter: returned true for a nil string!");
}
@end
================================================
FILE: WarningsTest/WarningsTestTests/WarningsTest-Prefix.pch
================================================
//
// WarningsTest-Prefix.pch
// WarningsTest
//
// Created by Peter Hosey on 2011-12-21.
//
#include <stdbool.h>
#if __OBJC__
# import <Cocoa/Cocoa.h>
# import <SenTestingKit/SenTestingKit.h>
#endif
================================================
FILE: WarningsTest/WarningsTestTests/WarningsTestTests-Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.example.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
================================================
FILE: WarningsTest/WarningsTestTests/en.lproj/InfoPlist.strings
================================================
/* Localized versions of Info.plist keys */
gitextract_6jlciqel/
├── README.md
├── Warnings.xcconfig
└── WarningsTest/
├── WarningsTest.xcodeproj/
│ ├── project.pbxproj
│ └── project.xcworkspace/
│ └── contents.xcworkspacedata
└── WarningsTestTests/
├── AssortedWarningTests.h
├── AssortedWarningTests.m
├── DeprecationWarningTests.h
├── DeprecationWarningTests.m
├── FunctionWarningTests.h
├── FunctionWarningTests.m
├── InitializerWarningTests.h
├── InitializerWarningTests.m
├── ShadowingWarningTests.h
├── ShadowingWarningTests.m
├── UnusedTokenWarningTests.h
├── UnusedTokenWarningTests.m
├── WarningsTest-Prefix.pch
├── WarningsTestTests-Info.plist
└── en.lproj/
└── InfoPlist.strings
Condensed preview — 19 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (34K chars).
[
{
"path": "README.md",
"chars": 2869,
"preview": "# Warnings\n\nThis is an xcconfig file to make it easy for you to turn on [a large suite of useful warnings](https://githu"
},
{
"path": "Warnings.xcconfig",
"chars": 1712,
"preview": "//\n// MoreWarnings.xcconfig\n//\n// Created by Steven Fisher:\n// http://tewha.net/2010/11/xcode-warnings/\n// See a"
},
{
"path": "WarningsTest/WarningsTest.xcodeproj/project.pbxproj",
"chars": 15786,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "WarningsTest/WarningsTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
"chars": 157,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n version = \"1.0\">\n <FileRef\n location = \"self:WarningsTest.xc"
},
{
"path": "WarningsTest/WarningsTestTests/AssortedWarningTests.h",
"chars": 194,
"preview": "//\n// AssortedWarningTests.h\n// WarningsTestTests\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import <SenTesting"
},
{
"path": "WarningsTest/WarningsTestTests/AssortedWarningTests.m",
"chars": 2863,
"preview": "//\n// AssortedWarningTests.m\n// WarningsTestTests\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import \"AssortedWa"
},
{
"path": "WarningsTest/WarningsTestTests/DeprecationWarningTests.h",
"chars": 195,
"preview": "//\n// DeprecationWarningTests.h\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-22.\n//\n\n#import <SenTestingKi"
},
{
"path": "WarningsTest/WarningsTestTests/DeprecationWarningTests.m",
"chars": 1131,
"preview": "//\n// DeprecationWarningTests.m\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-22.\n//\n\n#import \"DeprecationW"
},
{
"path": "WarningsTest/WarningsTestTests/FunctionWarningTests.h",
"chars": 189,
"preview": "//\n// FunctionWarningTests.h\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import <SenTestingKit/S"
},
{
"path": "WarningsTest/WarningsTestTests/FunctionWarningTests.m",
"chars": 983,
"preview": "//\n// FunctionWarningTests.m\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import \"FunctionWarning"
},
{
"path": "WarningsTest/WarningsTestTests/InitializerWarningTests.h",
"chars": 195,
"preview": "//\n// InitializerWarningTests.h\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import <SenTestingKi"
},
{
"path": "WarningsTest/WarningsTestTests/InitializerWarningTests.m",
"chars": 683,
"preview": "//\n// InitializerWarningTests.m\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import \"InitializerW"
},
{
"path": "WarningsTest/WarningsTestTests/ShadowingWarningTests.h",
"chars": 191,
"preview": "//\n// ShadowingWarningTests.h\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import <SenTestingKit/"
},
{
"path": "WarningsTest/WarningsTestTests/ShadowingWarningTests.m",
"chars": 827,
"preview": "//\n// ShadowingWarningTests.m\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n// Copyright (c) 2011 Capt"
},
{
"path": "WarningsTest/WarningsTestTests/UnusedTokenWarningTests.h",
"chars": 195,
"preview": "//\n// UnusedTokenWarningTests.h\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import <SenTestingKi"
},
{
"path": "WarningsTest/WarningsTestTests/UnusedTokenWarningTests.m",
"chars": 1081,
"preview": "//\n// UnusedTokenWarningTests.m\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#import \"UnusedTokenW"
},
{
"path": "WarningsTest/WarningsTestTests/WarningsTest-Prefix.pch",
"chars": 204,
"preview": "//\n// WarningsTest-Prefix.pch\n// WarningsTest\n//\n// Created by Peter Hosey on 2011-12-21.\n//\n\n#include <stdbool.h>\n#i"
},
{
"path": "WarningsTest/WarningsTestTests/WarningsTestTests-Info.plist",
"chars": 691,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "WarningsTest/WarningsTestTests/en.lproj/InfoPlist.strings",
"chars": 45,
"preview": "/* Localized versions of Info.plist keys */\n\n"
}
]
About this extraction
This page contains the full source code of the boredzo/Warnings-xcconfig GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 19 files (29.5 KB), approximately 9.5k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.