From 2d06d7e512b6f1d28145154afeabc074e36d24f2 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 11 Jul 2017 18:27:48 +0000 Subject: [LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The warning is reproducible with GCC 4.8. Thanks to David Blaikie for the suggested fix. The reported warning was ``` /usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctions.def:29:10: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Wpedantic] EXT_FUNC(__lsan_enable, void, (), false); ^ /usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp:44:24: note: in definition of macro ‘EXT_FUNC’ CheckFnPtr((void *)::NAME, #NAME, WARN); ^ ``` Differential Revision: https://reviews.llvm.org/D35243 llvm-svn: 307686 --- llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Fuzzer') diff --git a/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp b/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp index 7b02b6f0b70..503f0395cf8 100644 --- a/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp +++ b/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp @@ -41,7 +41,8 @@ namespace fuzzer { ExternalFunctions::ExternalFunctions() { #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ this->NAME = ::NAME; \ - CheckFnPtr((void *)::NAME, #NAME, WARN); + CheckFnPtr(reinterpret_cast(reinterpret_cast(::NAME)), \ + #NAME, WARN); #include "FuzzerExtFunctions.def" -- cgit v1.2.3