-
Notifications
You must be signed in to change notification settings - Fork 3
/
strict_warnings_objc_library.bzl
53 lines (51 loc) · 2.28 KB
/
strict_warnings_objc_library.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Macros for building Objective-C libraries with strict warnings."""
# This list is derived from
# http://programmers.stackexchange.com/questions/122608/clang-warning-flags-for-objective-c-development
# with a few turned off because the warning code is widely present in Material
# Components and seems innocuous.
COMMON_COPTS = [
"-Wall", # Standard known-to-be-bugs warnings.
"-Wcast-align", # Casting a pointer such that alignment is broken.
"-Wconversion", # Numeric conversion warnings.
"-Wdocumentation", # Documentation checks.
"-Werror", # All warnings as errors.
"-Wextra", # Many useful extra warnings.
"-Wdocumentation", # Warn when documentation is out of date.
"-Wimplicit-atomic-properties", # Dynamic properties should be non-atomic.
"-Wmissing-prototypes", # Global function is defined without a previous prototype.
"-Wnewline-eof", # No newline at the end of the file.
"-Wno-error=deprecated", # Deprecation warnings are never errors.
"-Wno-error=deprecated-implementations", # Deprecation warnings are never errors.
"-Wno-partial-availability",
"-Wno-sign-conversion", # Do not warn on sign conversions.
"-Wno-unused-parameter", # Do not warn on unused parameters.
"-Woverlength-strings", # Strings longer than the C maximum.
"-Wshadow", # Local variable shadows another variable, parameter, etc.
"-Wstrict-selector-match", # Compiler can't figure out the right selector.
"-Wstrict-prototypes",
"-Wundeclared-selector", # Compiler doesn't see a selector.
"-Wunreachable-code", # Code will never be reached.
"-Wunused-comparison",
"-Wunused-const-variable",
"-Wunused-exception-parameter",
"-Wunused-function",
"-Wunused-label",
"-Wunused-member-function",
"-Wunused-private-field",
"-Wunused-property-ivar",
"-Wunused-result",
"-Wunused-value",
"-Wunused-variable",
"-Wunused-volatile-lvalue",
"-Wused-but-marked-unused",
"-Wno-unused-parameter", # Enabled by -Wall via -Wunused, problems with params used in asserts.
]
def strict_warnings_objc_library(
name,
copts = [],
**kwargs):
"""Declare an Objective-C library with strict warning flags."""
native.objc_library(
name = name,
copts = copts + COMMON_COPTS,
**kwargs)