summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-fuzzer
diff options
context:
space:
mode:
authorAndrei Elovikov <andrei.elovikov@intel.com>2018-08-01 13:34:18 +0000
committerAndrei Elovikov <andrei.elovikov@intel.com>2018-08-01 13:34:18 +0000
commitad56ebaf060b0ad143b0eb9e6823c78fdf54c44e (patch)
tree12bba481ec0cbdb913498ce30c865f3068b2ad6d /clang/tools/clang-fuzzer
parent5f41ab79c051e620074e87d90fb817d233e206bb (diff)
downloadbcm5719-llvm-ad56ebaf060b0ad143b0eb9e6823c78fdf54c44e.tar.gz
bcm5719-llvm-ad56ebaf060b0ad143b0eb9e6823c78fdf54c44e.zip
[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 llvm-svn: 338551
Diffstat (limited to 'clang/tools/clang-fuzzer')
-rw-r--r--clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
index ef544ae711a..860ffa00b8e 100644
--- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -149,7 +149,23 @@ void CreateAndRunJITFun(const std::string &IR, CodeGenOpt::Level OLvl) {
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};
OpenPOWER on IntegriCloud