Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit c7ba4af

Browse files
Tweak out warning flags when compiling
Linux and Android have unused parameter warnings turned off. Apple platforms have many more warnings enabled. Some refinement is probably required still.
1 parent 9eb2841 commit c7ba4af

4 files changed

Lines changed: 158 additions & 4 deletions

File tree

config/android.gypi

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
'ext_suffix': '',
3535
'exe_suffix': '',
3636
'debug_info_suffix': '.dbg',
37+
38+
'silence_warnings': 0,
3739
},
3840

3941
'cflags':
4042
[
41-
'-Wall',
42-
'-Wextra',
4343
'-fstrict-aliasing',
4444
],
4545

@@ -56,6 +56,33 @@
5656
'-fno-rtti',
5757
],
5858

59+
'target_conditions':
60+
[
61+
[
62+
'silence_warnings == 0',
63+
{
64+
'cflags':
65+
[
66+
'-Wall',
67+
'-Wextra',
68+
'-Wno-unused-parameter', # Just contributes build noise
69+
],
70+
71+
'cflags_c':
72+
[
73+
'-Werror=declaration-after-statement', # Ensure compliance with C89
74+
],
75+
},
76+
{
77+
'cflags':
78+
[
79+
'-w', # Disable warnings
80+
'-fpermissive', # Be more lax with old code
81+
],
82+
},
83+
],
84+
],
85+
5986
'configurations':
6087
{
6188
'Debug':

config/ios.gypi

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
'lib_suffix': '.dylib',
5353
'ext_suffix': '.so',
5454
'debug_info_suffix': '.dSYM',
55+
56+
'silence_warnings': 0,
5557
},
5658

5759
'defines':
@@ -125,6 +127,56 @@
125127
],
126128
},
127129
],
130+
[
131+
'silence_warnings == 0',
132+
{
133+
'xcode_settings':
134+
{
135+
'GCC_WARN_CHECK_SWITCH_STATEMENTS': 'YES',
136+
'CLANG_WARN_EMPTY_BODY': 'YES',
137+
'GCC_WARN_SHADOW': 'YES',
138+
'CLANG_WARN_BOOL_CONVERSION': 'YES',
139+
'CLANG_WARN_CONSTANT_CONVERSION': 'YES',
140+
'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
141+
'CLANG_WARN_ENUM_CONVERSION': 'YES',
142+
'CLANG_WARN_INT_CONVERSION': 'YES',
143+
'CLANG_WARN_IMPLICIT_SIGN_CONVERSION': 'YES',
144+
'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
145+
'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
146+
'GCC_WARN_MISSING_PARENTHESES': 'YES',
147+
'GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS': 'YES',
148+
'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
149+
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
150+
'CLANG_WARN_ASSIGN_ENUM': 'YES',
151+
'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
152+
'GCC_WARN_SIGN_COMPARE': 'YES',
153+
'CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION': 'YES',
154+
'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
155+
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES',
156+
'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
157+
'CLANG_WARN_UNREACHABLE_CODE': 'YES',
158+
'GCC_WARN_UNUSED_FUNCTION': 'YES',
159+
'GCC_WARN_UNUSED_LABEL': 'YES',
160+
'GCC_WARN_UNUSED_PARAMETER': 'NO',
161+
'GCC_WARN_UNUSED_VALUE': 'YES',
162+
'GCC_WARN_UNUSED_VARIABLE': 'YES',
163+
164+
'WARNING_CFLAGS':
165+
[
166+
'-Wall',
167+
'-Wextra',
168+
'-Werror=declaration-after-statement',
169+
'-Wno-unused-parameter',
170+
],
171+
},
172+
},
173+
{
174+
'xcode_settings':
175+
{
176+
'GCC_INHIBIT_ALL_WARNINGS': 'YES',
177+
},
178+
},
179+
],
128180
],
129181
},
130182

config/linux.gypi

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
'debug_info_suffix': '.dbg',
1717

1818
'c++_std': '<!(echo ${CXX_STD:-gnu++03})',
19+
20+
'silence_warnings': 0,
1921
},
2022

2123
'defines':
@@ -73,12 +75,33 @@
7375
],
7476
},
7577
],
78+
[
79+
'silence_warnings == 0',
80+
{
81+
'cflags':
82+
[
83+
'-Wall',
84+
'-Wextra',
85+
'-Wno-unused-parameter', # Just contributes build noise
86+
],
87+
},
88+
{
89+
'cflags':
90+
[
91+
'-w', # Disable warnings
92+
'-fpermissive', # Be more lax with old code
93+
],
94+
95+
'cflags_c':
96+
[
97+
'-Werror=declaration-after-statement', # Ensure compliance with C89
98+
],
99+
},
100+
],
76101
],
77102

78103
'cflags':
79104
[
80-
'-Wall',
81-
'-Wextra',
82105
'-fstrict-aliasing',
83106
],
84107

config/mac.gypi

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
'lib_suffix': '.dylib',
4343
'ext_suffix': '.so',
4444
'debug_info_suffix': '.dSYM',
45+
46+
'silence_warnings': 0,
4547
},
4648

4749
'target_conditions':
@@ -77,6 +79,56 @@
7779
},
7880
},
7981
],
82+
[
83+
'silence_warnings == 0',
84+
{
85+
'xcode_settings':
86+
{
87+
'GCC_WARN_CHECK_SWITCH_STATEMENTS': 'YES',
88+
'CLANG_WARN_EMPTY_BODY': 'YES',
89+
'GCC_WARN_SHADOW': 'YES',
90+
'CLANG_WARN_BOOL_CONVERSION': 'YES',
91+
'CLANG_WARN_CONSTANT_CONVERSION': 'YES',
92+
'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
93+
'CLANG_WARN_ENUM_CONVERSION': 'YES',
94+
'CLANG_WARN_INT_CONVERSION': 'YES',
95+
'CLANG_WARN_IMPLICIT_SIGN_CONVERSION': 'YES',
96+
'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
97+
'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
98+
'GCC_WARN_MISSING_PARENTHESES': 'YES',
99+
'GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS': 'YES',
100+
'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
101+
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
102+
'CLANG_WARN_ASSIGN_ENUM': 'YES',
103+
'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
104+
'GCC_WARN_SIGN_COMPARE': 'YES',
105+
'CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION': 'YES',
106+
'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
107+
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES',
108+
'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
109+
'CLANG_WARN_UNREACHABLE_CODE': 'YES',
110+
'GCC_WARN_UNUSED_FUNCTION': 'YES',
111+
'GCC_WARN_UNUSED_LABEL': 'YES',
112+
'GCC_WARN_UNUSED_PARAMETER': 'NO',
113+
'GCC_WARN_UNUSED_VALUE': 'YES',
114+
'GCC_WARN_UNUSED_VARIABLE': 'YES',
115+
116+
'WARNING_CFLAGS':
117+
[
118+
'-Wall',
119+
'-Wextra',
120+
'-Werror=declaration-after-statement',
121+
'-Wno-unused-parameter',
122+
],
123+
},
124+
},
125+
{
126+
'xcode_settings':
127+
{
128+
'GCC_INHIBIT_ALL_WARNINGS': 'YES',
129+
},
130+
},
131+
],
80132
],
81133

82134
'configurations':

0 commit comments

Comments
 (0)