From 538c30a713a1ee2a3d654c3e1cdf9cc20b7d8c72 Mon Sep 17 00:00:00 2001 From: Pierluigi Taddei Date: Fri, 27 Aug 2021 10:36:08 -0700 Subject: [PATCH] [caffe2] fixes to allow stricter compilation flag (#64016) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64016 In order to increase the strictness of the compilation for some target depending on caffe2 we need to fix some errors uncovered when rising such flags. This change introduces the required override tokens for virtual destructors Test Plan: CI. Moreover targets depending on caffe2 using clang strict warnings now compile Reviewed By: kalman5 Differential Revision: D30541714 fbshipit-source-id: 564af31b4a9df3536d7d6f43ad29e1d0c7040551 --- aten/src/ATen/CPUGeneratorImpl.h | 2 +- aten/src/ATen/core/builtin_function.h | 2 +- c10/core/StorageImpl.h | 2 +- caffe2/serialize/istream_adapter.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aten/src/ATen/CPUGeneratorImpl.h b/aten/src/ATen/CPUGeneratorImpl.h index f8b43a0..69dbb8b 100644 --- a/aten/src/ATen/CPUGeneratorImpl.h +++ b/aten/src/ATen/CPUGeneratorImpl.h @@ -10,7 +10,7 @@ namespace at { struct TORCH_API CPUGeneratorImpl : public c10::GeneratorImpl { // Constructors CPUGeneratorImpl(uint64_t seed_in = default_rng_seed_val); - ~CPUGeneratorImpl() = default; + ~CPUGeneratorImpl() override = default; // CPUGeneratorImpl methods std::shared_ptr clone() const; diff --git a/aten/src/ATen/core/builtin_function.h b/aten/src/ATen/core/builtin_function.h index de30f9b..600c16b 100644 --- a/aten/src/ATen/core/builtin_function.h +++ b/aten/src/ATen/core/builtin_function.h @@ -123,7 +123,7 @@ struct BuiltinOpFunction : public Function { return *this; } - ~BuiltinOpFunction() {} + ~BuiltinOpFunction() override {} private: c10::QualifiedName name_; diff --git a/c10/core/StorageImpl.h b/c10/core/StorageImpl.h index ff29b68..bea717d 100644 --- a/c10/core/StorageImpl.h +++ b/c10/core/StorageImpl.h @@ -68,7 +68,7 @@ struct C10_API StorageImpl final : public c10::intrusive_ptr_target { StorageImpl() = delete; StorageImpl(StorageImpl&& other) = default; StorageImpl(const StorageImpl&) = delete; - ~StorageImpl() = default; + ~StorageImpl() override = default; void reset() { data_ptr_.clear(); diff --git a/caffe2/serialize/istream_adapter.h b/caffe2/serialize/istream_adapter.h index 8960d55..680c288 100644 --- a/caffe2/serialize/istream_adapter.h +++ b/caffe2/serialize/istream_adapter.h @@ -16,7 +16,7 @@ class TORCH_API IStreamAdapter final : public ReadAdapterInterface { size_t size() const override; size_t read(uint64_t pos, void* buf, size_t n, const char* what = "") const override; - ~IStreamAdapter(); + ~IStreamAdapter() override; private: std::istream* istream_; -- 2.7.4