[llvm] r307686 - [LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.
Dan Liew via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 11:27:48 PDT 2017
Author: delcypher
Date: Tue Jul 11 11:27:48 2017
New Revision: 307686
URL: http://llvm.org/viewvc/llvm-project?rev=307686&view=rev
Log:
[LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.
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
Modified:
llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp?rev=307686&r1=307685&r2=307686&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp Tue Jul 11 11:27:48 2017
@@ -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<void *>(reinterpret_cast<uintptr_t>(::NAME)), \
+ #NAME, WARN);
#include "FuzzerExtFunctions.def"
More information about the llvm-commits
mailing list