From 81ff90b3fc4f38abea2ab9472924dcdf0d1f10fe Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Mon, 27 Mar 2023 15:21:51 +0100 Subject: Support disabling compiler warnings; Use with external headers --- include/klee/Expr/Expr.h | 5 +++++ include/klee/Module/KCallable.h | 4 ++++ include/klee/Solver/SolverCmdLine.h | 4 ++++ include/klee/Support/CompilerWarning.h | 33 +++++++++++++++++++++++++++++++++ include/klee/Support/FileHandling.h | 5 +++++ include/klee/Support/ModuleUtil.h | 4 ++++ include/klee/Support/OptionCategories.h | 4 ++++ include/klee/Support/PrintVersion.h | 4 ++++ include/klee/System/Time.h | 4 ++++ 9 files changed, 67 insertions(+) create mode 100644 include/klee/Support/CompilerWarning.h (limited to 'include') diff --git a/include/klee/Expr/Expr.h b/include/klee/Expr/Expr.h index ae2760a2..15075eb8 100644 --- a/include/klee/Expr/Expr.h +++ b/include/klee/Expr/Expr.h @@ -12,12 +12,17 @@ #include "klee/ADT/Bits.h" #include "klee/ADT/Ref.h" + +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include #include diff --git a/include/klee/Module/KCallable.h b/include/klee/Module/KCallable.h index 6fe8419d..ade28cfc 100644 --- a/include/klee/Module/KCallable.h +++ b/include/klee/Module/KCallable.h @@ -12,10 +12,14 @@ #include +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/Twine.h" #include "llvm/IR/Function.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/LLVMContext.h" +DISABLE_WARNING_POP namespace klee { /// Wrapper for callable objects passed in callExternalFunction diff --git a/include/klee/Solver/SolverCmdLine.h b/include/klee/Solver/SolverCmdLine.h index b453d058..90c162ee 100644 --- a/include/klee/Solver/SolverCmdLine.h +++ b/include/klee/Solver/SolverCmdLine.h @@ -16,9 +16,13 @@ #define KLEE_SOLVERCMDLINE_H #include "klee/Config/config.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/CommandLine.h" +DISABLE_WARNING_POP namespace klee { diff --git a/include/klee/Support/CompilerWarning.h b/include/klee/Support/CompilerWarning.h new file mode 100644 index 00000000..ce192292 --- /dev/null +++ b/include/klee/Support/CompilerWarning.h @@ -0,0 +1,33 @@ +//===-- CompilerWarning.h ---------------------------------------*- C++ -*-===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef KLEE_INCLUDE_KLEE_SUPPORT_COMPILERWARNING_H +#define KLEE_INCLUDE_KLEE_SUPPORT_COMPILERWARNING_H + +// Disables different warnings +#if defined(__GNUC__) || defined(__clang__) +#define ENABLE_PRAGMA(X) _Pragma(#X) +#define DISABLE_WARNING_PUSH ENABLE_PRAGMA(GCC diagnostic push) +#define DISABLE_WARNING_POP ENABLE_PRAGMA(GCC diagnostic pop) +#define DISABLE_WARNING(warningName) \ + ENABLE_PRAGMA(GCC diagnostic ignored #warningName) + +#define DISABLE_WARNING_DEPRECATED_DECLARATIONS \ + DISABLE_WARNING(-Wdeprecated-declarations) + +#else + +#define DISABLE_WARNING_PUSH +#define DISABLE_WARNING_POP +#define DISABLE_WARNING(warningName) + +#define DISABLE_WARNING_DEPRECATED_DECLARATIONS +#endif + +#endif // KLEE_INCLUDE_KLEE_SUPPORT_COMPILERWARNING_H diff --git a/include/klee/Support/FileHandling.h b/include/klee/Support/FileHandling.h index 90ce20b3..a0dd0e95 100644 --- a/include/klee/Support/FileHandling.h +++ b/include/klee/Support/FileHandling.h @@ -10,7 +10,12 @@ #ifndef KLEE_FILEHANDLING_H #define KLEE_FILEHANDLING_H +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP + #include #include diff --git a/include/klee/Support/ModuleUtil.h b/include/klee/Support/ModuleUtil.h index 328b9aeb..f1c4c407 100644 --- a/include/klee/Support/ModuleUtil.h +++ b/include/klee/Support/ModuleUtil.h @@ -12,8 +12,12 @@ #include "klee/Config/Version.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/InstrTypes.h" #include "llvm/IR/Module.h" +DISABLE_WARNING_POP #include #include diff --git a/include/klee/Support/OptionCategories.h b/include/klee/Support/OptionCategories.h index 40f3deb8..bde9a4eb 100644 --- a/include/klee/Support/OptionCategories.h +++ b/include/klee/Support/OptionCategories.h @@ -14,7 +14,11 @@ #ifndef KLEE_OPTIONCATEGORIES_H #define KLEE_OPTIONCATEGORIES_H +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Support/CommandLine.h" +DISABLE_WARNING_POP namespace klee { extern llvm::cl::OptionCategory DebugCat; diff --git a/include/klee/Support/PrintVersion.h b/include/klee/Support/PrintVersion.h index 1c952451..f4999deb 100644 --- a/include/klee/Support/PrintVersion.h +++ b/include/klee/Support/PrintVersion.h @@ -10,7 +10,11 @@ #ifndef KLEE_PRINTVERSION_H #define KLEE_PRINTVERSION_H +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include "klee/Config/Version.h" diff --git a/include/klee/System/Time.h b/include/klee/System/Time.h index 2ebebdfd..14d9ab4b 100644 --- a/include/klee/System/Time.h +++ b/include/klee/System/Time.h @@ -10,7 +10,11 @@ #ifndef KLEE_TIME_H #define KLEE_TIME_H +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include #include -- cgit 1.4.1