Skip to content

Commit b7d7775

Browse files
mrc0mmandbluca
authored andcommitted
fuzz: don't panic without a C++ compiler
meson's `cpp_args` option is defined only if it detects a C++ compiler, otherwise we get an error: ../test/fuzz/meson.build:56:28: ERROR: Tried to access unknown option 'cpp_args'. (cherry picked from commit a3d3bf5)
1 parent 55b7c56 commit b7d7775

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

test/fuzz/meson.build

+9-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,22 @@ endforeach
3030

3131
############################################################
3232

33+
fuzz_c_args = get_option('c_args')
34+
if cxx_cmd != ''
35+
fuzz_cpp_args = get_option('cpp_args')
36+
else
37+
fuzz_cpp_args = []
38+
endif
39+
3340
sanitize_address_undefined = custom_target(
3441
'sanitize-address-undefined-fuzzers',
3542
output : 'sanitize-address-undefined-fuzzers',
3643
command : [meson_build_sh,
3744
project_source_root,
3845
'@OUTPUT@',
3946
'fuzzers',
40-
' '.join(get_option('c_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
41-
' '.join(get_option('cpp_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
47+
' '.join(fuzz_c_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
48+
' '.join(fuzz_cpp_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
4249
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ -Dskip-deps=@2@'.format(
4350
get_option('optimization'),
4451
get_option('werror') ? '--werror' : '',

tools/meson-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ c_args="${4:?}"
99
cpp_args="${5:?}"
1010
options="${6:?}"
1111
CC="${7:?}"
12-
CXX="${8:?}"
12+
CXX="$8"
1313

1414
if [ ! -f "$builddir/build.ninja" ]; then
1515
# shellcheck disable=SC2086

0 commit comments

Comments
 (0)