diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2023-03-27 15:21:51 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2023-04-06 16:03:03 +0300 |
commit | 81ff90b3fc4f38abea2ab9472924dcdf0d1f10fe (patch) | |
tree | 233c37c1339142a86089fc7ef2bedd2bd95456b3 | |
parent | 2769f1f4dc3515a8b5fc22ccf3e30b906faef75d (diff) | |
download | klee-81ff90b3fc4f38abea2ab9472924dcdf0d1f10fe.tar.gz |
Support disabling compiler warnings; Use with external headers
30 files changed, 153 insertions, 5 deletions
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 <sstream> #include <set> 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 <string> +#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 <memory> #include <string> 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 <memory> #include <string> 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 <chrono> #include <string> diff --git a/lib/Core/CallPathManager.cpp b/lib/Core/CallPathManager.cpp index 2c0e4ae3..34040dc6 100644 --- a/lib/Core/CallPathManager.cpp +++ b/lib/Core/CallPathManager.cpp @@ -11,8 +11,12 @@ #include "klee/Statistics/Statistics.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Function.h" #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include <map> #include <vector> diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp index 1050ba23..09f58fd3 100644 --- a/lib/Core/ExecutorUtil.cpp +++ b/lib/Core/ExecutorUtil.cpp @@ -17,6 +17,9 @@ #include "klee/Solver/Solver.h" #include "klee/Support/ErrorHandling.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Function.h" @@ -25,6 +28,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include <cassert> diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp index d155798e..718b1c31 100644 --- a/lib/Core/ExternalDispatcher.cpp +++ b/lib/Core/ExternalDispatcher.cpp @@ -14,6 +14,9 @@ #include "klee/Module/KCallable.h" #include "klee/Module/KModule.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/IRBuilder.h" @@ -26,6 +29,7 @@ #include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/TargetSelect.h" +DISABLE_WARNING_POP #include <csetjmp> #include <csignal> diff --git a/lib/Core/GetElementPtrTypeIterator.h b/lib/Core/GetElementPtrTypeIterator.h index 23bda1f0..c24ff74b 100644 --- a/lib/Core/GetElementPtrTypeIterator.h +++ b/lib/Core/GetElementPtrTypeIterator.h @@ -18,10 +18,14 @@ #ifndef KLEE_GETELEMENTPTRTYPEITERATOR_H #define KLEE_GETELEMENTPTRTYPEITERATOR_H +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/User.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Constants.h" +DISABLE_WARNING_POP #include "klee/Config/Version.h" diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index efc23612..1e3c8922 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -20,11 +20,15 @@ #include "klee/Solver/Solver.h" #include "klee/Support/ErrorHandling.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Value.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include <cassert> #include <sstream> diff --git a/lib/Core/MemoryManager.cpp b/lib/Core/MemoryManager.cpp index 0e47500a..ffd08886 100644 --- a/lib/Core/MemoryManager.cpp +++ b/lib/Core/MemoryManager.cpp @@ -16,6 +16,9 @@ #include "klee/Expr/Expr.h" #include "klee/Support/ErrorHandling.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/GlobalVariable.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/MathExtras.h" @@ -24,6 +27,7 @@ #else #include "llvm/Support/MathExtras.h" #endif +DISABLE_WARNING_POP #include <cinttypes> #include <algorithm> diff --git a/lib/Core/MergeHandler.h b/lib/Core/MergeHandler.h index f7380415..cc65a546 100644 --- a/lib/Core/MergeHandler.h +++ b/lib/Core/MergeHandler.h @@ -71,7 +71,11 @@ #include "klee/ADT/Ref.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Support/CommandLine.h" +DISABLE_WARNING_POP #include <map> #include <stdint.h> diff --git a/lib/Core/Searcher.cpp b/lib/Core/Searcher.cpp index 047a1e4f..080c31aa 100644 --- a/lib/Core/Searcher.cpp +++ b/lib/Core/Searcher.cpp @@ -25,10 +25,14 @@ #include "klee/Support/ErrorHandling.h" #include "klee/System/Time.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Constants.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" #include "llvm/Support/CommandLine.h" +DISABLE_WARNING_POP #include <cassert> #include <cmath> diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp index 7996499c..332e4b56 100644 --- a/lib/Core/SpecialFunctionHandler.cpp +++ b/lib/Core/SpecialFunctionHandler.cpp @@ -27,10 +27,14 @@ #include "klee/Support/ErrorHandling.h" #include "klee/Support/OptionCategories.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/Twine.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" +DISABLE_WARNING_POP #include <cerrno> #include <sstream> diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 9f92a127..305c6da2 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -28,6 +28,9 @@ #include "MemoryManager.h" #include "UserSearcher.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/SmallBitVector.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" @@ -41,6 +44,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" +DISABLE_WARNING_POP #include <fstream> #include <unistd.h> diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 1107c2ca..f2a933e4 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -13,6 +13,9 @@ #include "KLEEIRMetaData.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DerivedTypes.h" @@ -28,6 +31,7 @@ #include "llvm/Pass.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +DISABLE_WARNING_POP using namespace llvm; using namespace klee; diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp index 3c972edc..9b00db81 100644 --- a/lib/Module/InstructionInfoTable.cpp +++ b/lib/Module/InstructionInfoTable.cpp @@ -10,6 +10,9 @@ #include "klee/Module/InstructionInfoTable.h" #include "klee/Config/Version.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/AssemblyAnnotationWriter.h" #include "llvm/IR/DebugInfo.h" @@ -25,6 +28,7 @@ #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" +DISABLE_WARNING_POP #include <cstdint> #include <map> diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 8658f611..ad7c0631 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -11,6 +11,10 @@ #include "klee/Config/Version.h" #include "klee/Support/ErrorHandling.h" + +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/IR/Constants.h" @@ -29,7 +33,7 @@ #include "llvm/Pass.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" - +DISABLE_WARNING_POP using namespace llvm; namespace klee { diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 2e96c68a..eed922f8 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -22,6 +22,9 @@ #include "klee/Support/ErrorHandling.h" #include "klee/Support/ModuleUtil.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Bitcode/BitcodeWriter.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/IRBuilder.h" @@ -40,6 +43,7 @@ #include "llvm/Transforms/Scalar/Scalarizer.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils.h" +DISABLE_WARNING_POP #include <sstream> diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp index b23278f7..84b04b24 100644 --- a/lib/Module/LowerSwitch.cpp +++ b/lib/Module/LowerSwitch.cpp @@ -16,8 +16,13 @@ #include "Passes.h" #include "klee/Config/Version.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/IR/IRBuilder.h" #include "llvm/IR/LLVMContext.h" +DISABLE_WARNING_POP + #include <algorithm> using namespace llvm; diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp index 155b117f..76e580c5 100644 --- a/lib/Module/ModuleUtil.cpp +++ b/lib/Module/ModuleUtil.cpp @@ -13,6 +13,9 @@ #include "klee/Support/Debug.h" #include "klee/Support/ErrorHandling.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Analysis/ValueTracking.h" #include "llvm/BinaryFormat/Magic.h" #include "llvm/Bitcode/BitcodeReader.h" @@ -35,7 +38,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/SourceMgr.h" - +DISABLE_WARNING_POP #include <algorithm> #include <fstream> diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index c982b73d..35b9805a 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -18,6 +18,9 @@ #include "klee/Config/Version.h" #include "klee/Support/OptionCategories.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/LoopPass.h" @@ -35,7 +38,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar/GVN.h" #include "llvm/Transforms/Utils.h" - +DISABLE_WARNING_POP using namespace llvm; diff --git a/lib/Module/Passes.h b/lib/Module/Passes.h index 3eb43ec3..c8570b34 100644 --- a/lib/Module/Passes.h +++ b/lib/Module/Passes.h @@ -12,12 +12,16 @@ #include "klee/Config/Version.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/Triple.h" #include "llvm/CodeGen/IntrinsicLowering.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" #include "llvm/Pass.h" +DISABLE_WARNING_POP namespace llvm { class Function; diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp index 457927f9..ec447bc4 100644 --- a/lib/Module/RaiseAsm.cpp +++ b/lib/Module/RaiseAsm.cpp @@ -11,6 +11,9 @@ #include "klee/Config/Version.h" #include "klee/Support/ErrorHandling.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/CodeGen/TargetLowering.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/Function.h" @@ -25,7 +28,7 @@ #include "llvm/Support/TargetRegistry.h" #endif #include "llvm/Target/TargetMachine.h" - +DISABLE_WARNING_POP using namespace llvm; using namespace klee; diff --git a/lib/Support/ErrorHandling.cpp b/lib/Support/ErrorHandling.cpp index 2f4bc5cc..8c1580a6 100644 --- a/lib/Support/ErrorHandling.cpp +++ b/lib/Support/ErrorHandling.cpp @@ -8,9 +8,13 @@ //===----------------------------------------------------------------------===// #include "klee/Support/ErrorHandling.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/ADT/StringRef.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/CommandLine.h" +DISABLE_WARNING_POP #include <stdlib.h> #include <stdio.h> diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index ddb1faec..c35d9561 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -24,6 +24,9 @@ #include "klee/Support/PrintVersion.h" #include "klee/System/Time.h" +#include "klee/Support/CompilerWarning.h" +DISABLE_WARNING_PUSH +DISABLE_WARNING_DEPRECATED_DECLARATIONS #include "llvm/Bitcode/BitcodeReader.h" #include "llvm/IR/Constants.h" #include "llvm/IR/IRBuilder.h" @@ -43,7 +46,7 @@ #include "llvm/Support/TargetSelect.h" #include "llvm/Support/Signals.h" - +DISABLE_WARNING_POP #include <dirent.h> #include <signal.h> |