From 4ff2ff123ca02beef62e53c5df4ef240f4cf7bbf Mon Sep 17 00:00:00 2001 From: zhangzhaoju Date: Tue, 1 Jun 2021 11:02:36 +0800 Subject: [PATCH] codex clean --- mindspore/ccsrc/debug/debugger/debugger.cc | 3 +-- mindspore/core/ir/dtype/type.cc | 24 +++++++++++----------- mindspore/core/utils/log_adapter.cc | 7 ++++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mindspore/ccsrc/debug/debugger/debugger.cc b/mindspore/ccsrc/debug/debugger/debugger.cc index a64dba25655..e53ab27e1bc 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.cc +++ b/mindspore/ccsrc/debug/debugger/debugger.cc @@ -47,10 +47,9 @@ using debugger::WatchCondition_Parameter; using debugger::WatchNode; using debugger::WatchpointHit; -static constexpr auto g_chunk_size = 1024 * 1024 * 3; - namespace mindspore { +static constexpr auto g_chunk_size = 1024 * 1024 * 3; DebuggerPtr Debugger::debugger_ = nullptr; std::mutex Debugger::instance_lock_; diff --git a/mindspore/core/ir/dtype/type.cc b/mindspore/core/ir/dtype/type.cc index 8b0a3176030..c4569aeb6b8 100644 --- a/mindspore/core/ir/dtype/type.cc +++ b/mindspore/core/ir/dtype/type.cc @@ -82,7 +82,7 @@ static std::unordered_map g_type_2_lable{ {kObjectTypeIOMonad, MS_TYPE2LABLE(kObjectTypeIOMonad)}, {kMonadTypeEnd, MS_TYPE2LABLE(kMonadTypeEnd)}}; -enum BitsNum : int { +enum class BitsNum : int { eBits8 = 8, eBits16 = 16, eBits32 = 32, @@ -90,13 +90,13 @@ enum BitsNum : int { }; TypeId IntBitsToTypeId(const int nbits) { switch (nbits) { - case eBits8: + case static_cast(BitsNum::eBits8): return kNumberTypeInt8; - case eBits16: + case static_cast(BitsNum::eBits16): return kNumberTypeInt16; - case eBits32: + case static_cast(BitsNum::eBits32): return kNumberTypeInt32; - case eBits64: + case static_cast(BitsNum::eBits64): return kNumberTypeInt64; default: MS_LOG(EXCEPTION) << "Wrong number of bits:" << nbits; @@ -105,13 +105,13 @@ TypeId IntBitsToTypeId(const int nbits) { TypeId UIntBitsToTypeId(const int nbits) { switch (nbits) { - case eBits8: + case static_cast(BitsNum::eBits8): return kNumberTypeUInt8; - case eBits16: + case static_cast(BitsNum::eBits16): return kNumberTypeUInt16; - case eBits32: + case static_cast(BitsNum::eBits32): return kNumberTypeUInt32; - case eBits64: + case static_cast(BitsNum::eBits64): return kNumberTypeUInt64; default: MS_LOG(EXCEPTION) << "Wrong number of bits:" << nbits; @@ -120,11 +120,11 @@ TypeId UIntBitsToTypeId(const int nbits) { TypeId FloatBitsToTypeId(const int nbits) { switch (nbits) { - case eBits16: + case static_cast(BitsNum::eBits16): return kNumberTypeFloat16; - case eBits32: + case static_cast(BitsNum::eBits32): return kNumberTypeFloat32; - case eBits64: + case static_cast(BitsNum::eBits64): return kNumberTypeFloat64; default: MS_LOG(EXCEPTION) << "Wrong number of bits:" << nbits; diff --git a/mindspore/core/utils/log_adapter.cc b/mindspore/core/utils/log_adapter.cc index e7673a833d3..11cf5c7f5a9 100644 --- a/mindspore/core/utils/log_adapter.cc +++ b/mindspore/core/utils/log_adapter.cc @@ -178,7 +178,7 @@ enum class LogConfigToken : size_t { NUM_LOG_CFG_TOKENS }; -static const char *g_tok_names[(size_t)LogConfigToken::NUM_LOG_CFG_TOKENS] = { +static const char *g_tok_names[static_cast(LogConfigToken::NUM_LOG_CFG_TOKENS)] = { "invalid", // indicate invalid token "{", // '{' "}", // '}' @@ -278,8 +278,9 @@ class LogConfigParser { bool Expect(LogConfigToken expected, LogConfigToken tok) const { if (expected != tok) { - MS_LOG(WARNING) << "Parse submodule log configuration text error, expect `" << g_tok_names[(size_t)expected] - << "`, but got `" << g_tok_names[(size_t)tok] << "`. The whole configuration will be ignored."; + MS_LOG(WARNING) << "Parse submodule log configuration text error, expect `" + << g_tok_names[static_cast(expected)] << "`, but got `" + << g_tok_names[static_cast(tok)] << "`. The whole configuration will be ignored."; return false; } return true;