├── LICENSE.txt ├── README.md └── XcodeWarnings.xcconfig /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014 Jonathan M. Reid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![XcodeWarnings](https://qualitycoding.org/wp-content/uploads/2021/06/XcodeWarnings-small1.png) 2 | 3 | XcodeWarnings.xcconfig is an Xcode configuration file that lists all warnings and static analyzer 4 | settings present in Xcode 15 and Xcode 16. Comment out any settings that won't help your project. 5 | 6 | Accompanying blog post: [Xcode Warnings: Turn Them Up to Eleven!](https://qualitycoding.org/xcode-warnings/) 7 | 8 | All warnings are enabled, with these exceptions: 9 | 10 | **Commented Out by Default** 11 | 12 | - "Pedantic Warnings" (`GCC_WARN_PEDANTIC`) isn't enabled because ordinary interaction with Apple's 13 | libraries makes it unhappy. 14 | - "Treat Warnings as Errors" (`GCC_TREAT_WARNINGS_AS_ERRORS` and `SWIFT_TREAT_WARNINGS_AS_ERRORS`) aren't enabled because when 15 | experimenting with code, I sometimes temporarily comment out a line which uses a variable — which 16 | triggers the "Unused Variables" warning. 17 | - "Unused Parameters" (`GCC_WARN_UNUSED_PARAMETER`) isn't enabled because it's not unusual to 18 | provide a method required by Apple's frameworks that ignores a parameter. 19 | 20 | **Not Even Included** 21 | 22 | - "Implicit Synthesized Properties" (`CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS`) isn't included 23 | because in all likelihood, you don't need to be backwards compatible with non-modern Objective-C. 24 | - "Disable Safety Checks" (`SWIFT_DISABLE_SAFETY_CHECKS`) isn't included in order to keep runtime safety checks when optimizing. 25 | - "Inhibit All Warnings" (Apple Clang) and "Suppress Warnings" (Swift) aren't included because they're the opposite of our goals for this configuration. 26 | 27 | ## Static Analyzer 28 | 29 | The Static Analyzer is also completely enabled, including "Deep" analysis during the Build action. 30 | If that's too slow, comment out `CLANG_STATIC_ANALYZER_MODE` to restore faster "Shallow" analysis. 31 | 32 | ## Author 33 | 34 | Jon Reid is the author of _[iOS Unit Testing by Example](https://iosunittestingbyexample.com)._ His website is [Quality Coding](https://qualitycoding.org). 35 | 36 | [![Mastodon Follow](https://img.shields.io/mastodon/follow/109765011064804734?domain=https%3A%2F%2Fiosdev.space 37 | )](https://iosdev.space/@qcoding) 38 | -------------------------------------------------------------------------------- /XcodeWarnings.xcconfig: -------------------------------------------------------------------------------- 1 | // XcodeWarnings by Jon Reid, https://qualitycoding.org 2 | // Copyright 2014 Jonathan M. Reid. https://github.com/jonreid/XcodeWarnings/blob/main/LICENSE.txt 3 | // SPDX-License-Identifier: MIT 4 | 5 | // Apple Clang - Address Sanitizer 6 | CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = YES 7 | 8 | // Apple Clang - Code Generation 9 | GCC_STRICT_ALIASING = YES 10 | GCC_REUSE_STRINGS = YES 11 | GCC_NO_COMMON_BLOCKS = YES 12 | GCC_THREADSAFE_STATICS = YES 13 | 14 | // Apple Clang - Language 15 | GCC_ENABLE_TRIGRAPHS = NO 16 | 17 | // Apple Clang - Preprocessing 18 | ENABLE_STRICT_OBJC_MSGSEND = YES 19 | 20 | // Apple Clang - Undefined Behavior Sanitizer 21 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES 22 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 23 | 24 | // Apple Clang - Warning Policies 25 | //GCC_WARN_PEDANTIC = YES 26 | //GCC_TREAT_WARNINGS_AS_ERRORS = YES 27 | 28 | // Apple Clang - Warnings - All languages 29 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES 30 | GCC_WARN_CHECK_SWITCH_STATEMENTS = YES 31 | CLANG_WARN_COMPLETION_HANDLER_MISUSE = YES 32 | GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES 33 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES 34 | CLANG_WARN_EMPTY_BODY = YES 35 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES 36 | GCC_WARN_SHADOW = YES 37 | CLANG_WARN_BOOL_CONVERSION = YES 38 | CLANG_WARN_CONSTANT_CONVERSION = YES 39 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES 40 | CLANG_WARN_ENUM_CONVERSION = YES 41 | CLANG_WARN_IMPLICIT_FALLTHROUGH = YES 42 | CLANG_WARN_FLOAT_CONVERSION = YES 43 | CLANG_WARN_INT_CONVERSION = YES 44 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES 45 | CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES 46 | CLANG_WARN_INFINITE_RECURSION = YES 47 | GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES 48 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR 49 | GCC_WARN_MISSING_PARENTHESES = YES 50 | GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES 51 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES 52 | GCC_WARN_ABOUT_MISSING_NEWLINE = YES 53 | CLANG_WARN_ASSIGN_ENUM = YES 54 | CLANG_WARN_PRIVATE_MODULE = YES 55 | GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES 56 | CLANG_WARN_FRAMEWORK_INCLUDE_PRIVATE_FROM_PUBLIC = YES 57 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES 58 | CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES 59 | GCC_WARN_SIGN_COMPARE = YES 60 | CLANG_WARN_STRICT_PROTOTYPES = YES 61 | CLANG_WARN_COMMA = YES 62 | CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES 63 | CLANG_WARN_PRAGMA_PACK = YES 64 | GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES 65 | GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES 66 | GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES 67 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 68 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE 69 | GCC_WARN_UNKNOWN_PRAGMAS = YES 70 | CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE 71 | GCC_WARN_UNUSED_FUNCTION = YES 72 | GCC_WARN_UNUSED_LABEL = YES 73 | //GCC_WARN_UNUSED_PARAMETER = YES 74 | GCC_WARN_UNUSED_VALUE = YES 75 | GCC_WARN_UNUSED_VARIABLE = YES 76 | 77 | // Apple Clang - Warnings - C++ 78 | CLANG_WARN_VEXING_PARSE = YES 79 | CLANG_WARN_DELETE_NON_VIRTUAL_DTOR = YES 80 | CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES 81 | GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES 82 | GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES 83 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES 84 | CLANG_WARN_SUSPICIOUS_MOVE = YES 85 | GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES 86 | CLANG_WARN_ATOMIC_IMPLICIT_SEQ_CST = YES 87 | CLANG_WARN_CXX0X_EXTENSIONS = YES 88 | 89 | // Apple Clang - Warnings - Objective-C 90 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR 91 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 92 | CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES 93 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES 94 | GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES 95 | CLANG_WARN_OBJC_INTERFACE_IVARS = YES 96 | CLANG_WARN_MISSING_NOESCAPE = YES 97 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES 98 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 99 | GCC_WARN_UNDECLARED_SELECTOR = YES 100 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR 101 | 102 | // Apple Clang - Warnings - Objective-C and ARC 103 | CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES 104 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 105 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES_AGGRESSIVE 106 | CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES 107 | 108 | // Static Analysis - Analysis Policy 109 | RUN_CLANG_STATIC_ANALYZER = YES 110 | CLANG_STATIC_ANALYZER_MODE_ON_ANALYZE_ACTION = Deep 111 | CLANG_STATIC_ANALYZER_MODE = Deep 112 | 113 | // Static Analysis - Generic Issues 114 | CLANG_ANALYZER_NULL_DEREFERENCE = YES 115 | CLANG_ANALYZER_DIVIDE_BY_ZERO = YES 116 | CLANG_ANALYZER_MEMORY_MANAGEMENT = YES 117 | CLANG_TIDY_BUGPRONE_INFINITE_LOOP = YES 118 | CLANG_ANALYZER_NONNULL = YES 119 | CLANG_TIDY_BUGPRONE_ASSERT_SIDE_EFFECT = YES 120 | 121 | // Static Analysis - Issues - Apple APIs 122 | CLANG_ANALYZER_OSOBJECT_C_STYLE_CAST = YES 123 | CLANG_ANALYZER_OBJC_NSCFERROR = YES 124 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES 125 | CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = YES 126 | CLANG_ANALYZER_OBJC_COLLECTIONS = YES 127 | CLANG_ANALYZER_GCD = YES 128 | CLANG_ANALYZER_GCD_PERFORMANCE = YES 129 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE 130 | CLANG_ANALYZER_LIBKERN_RETAIN_COUNT = YES 131 | CLANG_ANALYZER_MIG_CONVENTIONS = YES 132 | 133 | // Static Analysis - Issues - C++ 134 | CLANG_TIDY_BUGPRONE_MOVE_FORWARDING_REFERENCE = YES 135 | CLANG_ANALYZER_USE_AFTER_MOVE = YES_AGGRESSIVE 136 | 137 | // Static Analysis - Issues - Objective-C 138 | CLANG_ANALYZER_OBJC_ATSYNC = YES 139 | CLANG_ANALYZER_OBJC_DEALLOC = YES 140 | CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES = YES 141 | CLANG_ANALYZER_OBJC_GENERICS = YES 142 | CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES 143 | CLANG_ANALYZER_OBJC_SELF_INIT = YES 144 | CLANG_ANALYZER_OBJC_RETAIN_COUNT = YES 145 | 146 | // Static Analysis - Issues - Security 147 | CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES 148 | CLANG_ANALYZER_SECURITY_KEYCHAIN_API = YES 149 | CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN = YES 150 | CLANG_ANALYZER_SECURITY_INSECUREAPI_GETPW_GETS = YES 151 | CLANG_ANALYZER_SECURITY_INSECUREAPI_MKSTEMP = YES 152 | CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES 153 | CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES 154 | CLANG_ANALYZER_SECURITY_INSECUREAPI_VFORK = YES 155 | 156 | // Static Analysis - Issues - Unused Code 157 | CLANG_ANALYZER_DEADCODE_DEADSTORES = YES 158 | CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES 159 | CLANG_TIDY_BUGPRONE_REDUNDANT_BRANCH_CONDITION = YES 160 | 161 | // Swift Compiler - Custom Flags (for Xcode 15) 162 | OTHER_SWIFT_FLAGS = -enable-upcoming-feature DisableOutwardActorInference -enable-upcoming-feature GlobalConcurrency -enable-upcoming-feature InferSendableFromCaptures 163 | 164 | // Swift Compiler - Upcoming Features (for Xcode 16) 165 | SWIFT_ENABLE_BARE_SLASH_REGEX = YES 166 | SWIFT_UPCOMING_FEATURE_CONCISE_MAGIC_FILE = YES 167 | SWIFT_UPCOMING_FEATURE_INTERNAL_IMPORTS_BY_DEFAULT = YES 168 | SWIFT_UPCOMING_FEATURE_DEPRECATE_APPLICATION_MAIN = YES 169 | SWIFT_UPCOMING_FEATURE_DISABLE_OUTWARD_ACTOR_ISOLATION = YES 170 | SWIFT_UPCOMING_FEATURE_FORWARD_TRAILING_CLOSURES = YES 171 | SWIFT_UPCOMING_FEATURE_IMPLICIT_OPEN_EXISTENTIALS = YES 172 | SWIFT_UPCOMING_FEATURE_IMPORT_OBJC_FORWARD_DECLS = YES 173 | SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES 174 | SWIFT_UPCOMING_FEATURE_ISOLATED_DEFAULT_VALUES = YES 175 | SWIFT_UPCOMING_FEATURE_GLOBAL_CONCURRENCY = YES 176 | SWIFT_UPCOMING_FEATURE_REGION_BASED_ISOLATION = YES 177 | SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY = YES 178 | SWIFT_STRICT_CONCURRENCY = complete 179 | 180 | // Swift Compiler - Warning Policies 181 | //SWIFT_TREAT_WARNINGS_AS_ERRORS = YES 182 | --------------------------------------------------------------------------------