diff options
author | Devin Jeanpierre <jeanpierreda@gmail.com> | 2017-09-07 01:00:47 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2017-09-07 01:00:47 (GMT) |
commit | 78ebc73f9b17373d25eb35e9f9511b2cb63825ff (patch) | |
tree | 5b69851fc6792e3199d6c3df1e33c46c349e5480 | |
parent | 738b7d9766e1a794aaaabfba0d515a467ba833ca (diff) | |
download | cpython-78ebc73f9b17373d25eb35e9f9511b2cb63825ff.zip cpython-78ebc73f9b17373d25eb35e9f9511b2cb63825ff.tar.gz cpython-78ebc73f9b17373d25eb35e9f9511b2cb63825ff.tar.bz2 |
Avoid UB in test selection macro. (#3407)
This fixes the gcc "warning: this use of "defined" may not be portable [-Wexpansion-to-defined]"
See discussion in http://bugs.python.org/issue29505
-rw-r--r-- | Modules/_xxtestfuzz/fuzzer.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index 36f721e..b50eb65 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -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; } |