Skip to content

Commit 2c5434a

Browse files
committed
meson: fix detection of "-Wno-" options
1 parent 9f0e9c0 commit 2c5434a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

meson.build

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,6 @@ foreach arg : ['-Wundef',
246246
'-Wendif-labels',
247247
'-Wstrict-aliasing=2',
248248
'-Wwrite-strings',
249-
'-Wno-unused-parameter',
250-
'-Wno-missing-field-initializers',
251-
'-Wno-unused-result',
252-
'-Wno-format-signedness',
253249
'-Werror=overflow',
254250
'-Wdate-time',
255251
'-Wnested-externs',
@@ -268,6 +264,17 @@ foreach arg : ['-Wundef',
268264
endif
269265
endforeach
270266

267+
# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
268+
# arguments, just emits a warnings. So test for the "positive" version instead.
269+
foreach arg : ['unused-parameter',
270+
'missing-field-initializers',
271+
'unused-result',
272+
'format-signedness']
273+
if cc.has_argument('-W' + arg)
274+
add_project_arguments('-Wno-' + arg, language : 'c')
275+
endif
276+
endforeach
277+
271278
if cc.compiles('
272279
#include <time.h>
273280
#include <inttypes.h>

0 commit comments

Comments
 (0)