From 5f3d0e485ca40359db28249e1fa5ecefced25fc3 Mon Sep 17 00:00:00 2001 From: Soren Lassen Date: Sun, 25 Sep 2022 08:33:53 -0700 Subject: [PATCH 1/2] fix sprintf-is-deprecated clang warning warning from Apple clang version 14.0.0 (clang-1400.0.29.201): ``` .../src/Conversion/ONNXToKrnl/PerfectHash.cpp:47:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(str, "%lld", (long long)val); /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ``` Signed-off-by: Soren Lassen --- src/Conversion/ONNXToKrnl/PerfectHash.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Conversion/ONNXToKrnl/PerfectHash.cpp b/src/Conversion/ONNXToKrnl/PerfectHash.cpp index a2e317d18f..be8ba0fc70 100644 --- a/src/Conversion/ONNXToKrnl/PerfectHash.cpp +++ b/src/Conversion/ONNXToKrnl/PerfectHash.cpp @@ -43,10 +43,7 @@ class Utilities { // Adaptation of 32-bit FNV for int64_t values. static inline uint32_t hash(uint32_t hval, int64_t val) { - char str[20]; - sprintf(str, "%lld", (long long)val); - - return hash(hval, std::string(str)); + return hash(hval, std::to_string(val)); } // Extracts the keys of the given map. From c2cf922ff3ec8709e303c3a18ac4f96a5a17f5c0 Mon Sep 17 00:00:00 2001 From: Soren Lassen Date: Sun, 25 Sep 2022 09:00:05 -0700 Subject: [PATCH 2/2] fix copy constructor warning copied solution from InstrumentONNXPass.cpp fixes compiler warning in Linux CI pipelines: ``` .../src/Transform/ONNX/ConvOpt.cpp: In copy constructor '{anonymous}::ConvOptONNXToONNXPass::ConvOptONNXToONNXPass(const {anonymous}::ConvOptONNXToONNXPass&)': .../src/Transform/ONNX/ConvOpt.cpp:211:3: warning: base class 'class mlir::PassWrapper<{anonymous}::ConvOptONNXToONNXPass, mlir::OperationPass >' should be explicitly initialized in the copy constructor [-Wextra] ConvOptONNXToONNXPass(const ConvOptONNXToONNXPass &pass) {} ``` Signed-off-by: Soren Lassen --- src/Transform/ONNX/ConvOpt.cpp | 4 +++- src/Transform/ONNX/Decompose.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Transform/ONNX/ConvOpt.cpp b/src/Transform/ONNX/ConvOpt.cpp index d5cb3f9759..ea535444d7 100644 --- a/src/Transform/ONNX/ConvOpt.cpp +++ b/src/Transform/ONNX/ConvOpt.cpp @@ -208,7 +208,9 @@ struct ConvOptONNXToONNXPass MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvOptONNXToONNXPass) ConvOptONNXToONNXPass() = default; - ConvOptONNXToONNXPass(const ConvOptONNXToONNXPass &pass) {} + ConvOptONNXToONNXPass(const ConvOptONNXToONNXPass &pass) + : mlir::PassWrapper>() {} StringRef getArgument() const override { return "convopt-onnx"; } diff --git a/src/Transform/ONNX/Decompose.cpp b/src/Transform/ONNX/Decompose.cpp index f67f456502..8e8e29d797 100644 --- a/src/Transform/ONNX/Decompose.cpp +++ b/src/Transform/ONNX/Decompose.cpp @@ -204,7 +204,9 @@ struct DecomposeONNXToONNXPass MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeONNXToONNXPass) DecomposeONNXToONNXPass() = default; - DecomposeONNXToONNXPass(const DecomposeONNXToONNXPass &pass) {} + DecomposeONNXToONNXPass(const DecomposeONNXToONNXPass &pass) + : mlir::PassWrapper>() {} StringRef getArgument() const override { return "decompose-onnx"; }