@@ -193,20 +193,22 @@ endif()
193
193
194
194
include (TryAppendCFlags )
195
195
if (MSVC )
196
- try_append_c_flags (/W2 )
197
- try_append_c_flags (/wd4146 )
196
+ # Keep the following commands ordered lexicographically.
197
+ try_append_c_flags (/W2 ) # Moderate warning level.
198
+ try_append_c_flags (/wd4146 ) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".
198
199
else ()
200
+ # Keep the following commands ordered lexicographically.
199
201
try_append_c_flags (-pedantic )
200
- try_append_c_flags (-Wall )
201
- try_append_c_flags (-Wcast-align )
202
- try_append_c_flags (-Wcast-align=strict )
203
- try_append_c_flags (-Wconditional-uninitialized )
204
- try_append_c_flags (-Wextra )
202
+ try_append_c_flags (-Wall ) # GCC >= 2.95 and probably many other compilers.
203
+ try_append_c_flags (-Wcast-align ) # GCC >= 2.95.
204
+ try_append_c_flags (-Wcast-align=strict ) # GCC >= 8.0.
205
+ try_append_c_flags (-Wconditional-uninitialized ) # Clang >= 3.0 only.
206
+ try_append_c_flags (-Wextra ) # GCC >= 3.4, this is the newer name of -W, which we don't use because older GCCs will warn about unused functions.
205
207
try_append_c_flags (-Wnested-externs )
206
- try_append_c_flags (-Wno-long-long )
207
- try_append_c_flags (-Wno-overlength-strings )
208
- try_append_c_flags (-Wno-unused-function )
209
- try_append_c_flags (-Wreserved-identifier )
208
+ try_append_c_flags (-Wno-long-long ) # GCC >= 3.0, -Wlong-long is implied by -pedantic.
209
+ try_append_c_flags (-Wno-overlength-strings ) # GCC >= 4.2, -Woverlength-strings is implied by -pedantic.
210
+ try_append_c_flags (-Wno-unused-function ) # GCC >= 3.0, -Wunused-function is implied by -Wall.
211
+ try_append_c_flags (-Wreserved-identifier ) # Clang >= 13.0 only.
210
212
try_append_c_flags (-Wshadow )
211
213
try_append_c_flags (-Wstrict-prototypes )
212
214
try_append_c_flags (-Wundef )
0 commit comments