Skip to content

Commit

Permalink
Avoid UB in test selection macro. (python#3407)
Browse files Browse the repository at this point in the history
This fixes the gcc "warning: this use of "defined" may not be portable [-Wexpansion-to-defined]"

See discussion in http://bugs.python.org/issue29505
  • Loading branch information
ssbr authored and gpshead committed Sep 7, 2017
1 parent 738b7d9 commit 78ebc73
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Modules/_xxtestfuzz/fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {

int rv = 0;

#define _Py_FUZZ_YES(test_name) (defined(_Py_FUZZ_##test_name) || !defined(_Py_FUZZ_ONE))
#if _Py_FUZZ_YES(fuzz_builtin_float)
#if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_builtin_float)
rv |= _run_fuzz(data, size, fuzz_builtin_float);
#endif
#if _Py_FUZZ_YES(fuzz_builtin_int)
#if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_builtin_int)
rv |= _run_fuzz(data, size, fuzz_builtin_int);
#endif
#if _Py_FUZZ_YES(fuzz_builtin_unicode)
#if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_builtin_unicode)
rv |= _run_fuzz(data, size, fuzz_builtin_unicode);
#endif
#undef _Py_FUZZ_YES
return rv;
}

0 comments on commit 78ebc73

Please sign in to comment.