r338551 - [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.
Andrei Elovikov via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 1 06:34:19 PDT 2018
Author: a.elovikov
Date: Wed Aug 1 06:34:18 2018
New Revision: 338551
URL: http://llvm.org/viewvc/llvm-project?rev=338551&view=rev
Log:
[NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.
Summary:
I don't have the whole list of GCC binaries available so I determined the exact
version where the warning disappeared via:
https://github.com/gcc-mirror/gcc/blob/gcc-4_9_0-release/gcc/cp/typeck.c#L6863
https://github.com/gcc-mirror/gcc/blob/gcc-4_8_5-release/gcc/cp/typeck.c#L6652
Reviewers: emmettneyman, erichkeane
Reviewed By: emmettneyman, erichkeane
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50056
Modified:
cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
Modified: cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp?rev=338551&r1=338550&r2=338551&view=diff
==============================================================================
--- cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp (original)
+++ cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp Wed Aug 1 06:34:18 2018
@@ -149,7 +149,23 @@ void CreateAndRunJITFun(const std::strin
EE->runStaticConstructorsDestructors(false);
typedef void (*func)(int*, int*, int*, int);
- func f = reinterpret_cast<func>(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) && \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+// Silence
+//
+// warning: ISO C++ forbids casting between pointer-to-function and
+// pointer-to-object [-Wpedantic]
+//
+// Since C++11 this casting is conditionally supported and GCC versions
+// starting from 4.9.0 don't warn about the cast.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+ func f = reinterpret_cast<func>(EE->getPointerToFunction(EntryFunc));
+#if defined(__GNUC__) && !defined(__clang) && \
+ ((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
+#pragma GCC diagnostic pop
+#endif
// Define some dummy arrays to use an input for now
int a[] = {1};
More information about the cfe-commits
mailing list