blob: 4431e09da40a692040ace02b9d28a1135b92a643 (
plain)
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
|
#
# Under compilers with WERRORFLAG, MakeMakefile.try_compile treats warnings as errors, so we can
# use append_cflags to test whether the public header files emit warnings with certain flags turned
# on.
#
def check_append_cflags(flag, msg = nil)
msg ||= "flag #{flag} is not acceptable"
if $CFLAGS.include?(flag)
raise("flag #{flag} already present in $CFLAGS")
end
append_cflags(flag)
unless $CFLAGS.include?(flag)
system("cat mkmf.log")
raise(msg)
end
end
if %w[gcc clang].include?(RbConfig::CONFIG['CC'])
config_string("WERRORFLAG") or raise("expected WERRORFLAG to be defined")
# should be acceptable on all modern C compilers
check_append_cflags("-D_TEST_OK", "baseline compiler warning test failed")
# Feature #20507: Allow compilation of C extensions with -Wconversion
check_append_cflags("-Wconversion", "-Wconversion raising warnings in public headers")
end
create_makefile("-test-/public_header_warnings")
|