Skip to content

Commit a3d3bf5

Browse files
committed
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'.
1 parent b0f9659 commit a3d3bf5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

test/fuzz/meson.build

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,22 @@ else
4545
sanitize_auto_features = 'auto'
4646
endif
4747

48+
fuzz_c_args = get_option('c_args')
49+
if cxx_cmd != ''
50+
fuzz_cpp_args = get_option('cpp_args')
51+
else
52+
fuzz_cpp_args = []
53+
endif
54+
4855
sanitize_address_undefined = custom_target(
4956
'sanitize-address-undefined-fuzzers',
5057
output : 'sanitize-address-undefined-fuzzers',
5158
command : [meson_build_sh,
5259
project_source_root,
5360
'@OUTPUT@',
5461
'fuzzers',
55-
' '.join(get_option('c_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
56-
' '.join(get_option('cpp_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
62+
' '.join(fuzz_c_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
63+
' '.join(fuzz_cpp_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
5764
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ --auto-features=@2@'.format(
5865
get_option('optimization'),
5966
get_option('werror') ? '--werror' : '',

tools/meson-build.sh

Lines changed: 1 addition & 1 deletion
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)