diff --git a/mindspore/ccsrc/gvar/logging_level.cc b/mindspore/ccsrc/gvar/logging_level.cc index 158c5c8ce0..688e6ddcb8 100644 --- a/mindspore/ccsrc/gvar/logging_level.cc +++ b/mindspore/ccsrc/gvar/logging_level.cc @@ -17,8 +17,6 @@ #include "utils/log_adapter.h" namespace mindspore { - // set default log level to WARNING for all sub modules int g_ms_submodule_log_levels[NUM_SUBMODUES] = {WARNING}; - } // namespace mindspore diff --git a/mindspore/ccsrc/ir/anf_extends.cc b/mindspore/ccsrc/ir/anf_extends.cc index 2dd1a6e2f4..51b4ed28e6 100644 --- a/mindspore/ccsrc/ir/anf_extends.cc +++ b/mindspore/ccsrc/ir/anf_extends.cc @@ -99,5 +99,4 @@ std::string CNode::fullname_with_scope() { void CNode::accept(AnfVisitor *v) { v->Visit(shared_from_base()); } void ValueNode::accept(AnfVisitor *v) { v->Visit(shared_from_base()); } void Parameter::accept(AnfVisitor *v) { v->Visit(shared_from_base()); } - } // namespace mindspore diff --git a/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h b/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h index a12ba9128c..b33b4c613d 100644 --- a/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h +++ b/mindspore/ccsrc/optimizer/irpass/arithmetic_simplify.h @@ -275,7 +275,6 @@ class AdjustAllReduceMulAdd : public AnfVisitor { // If has dynamic loss scale. auto &users_map = fg->manager()->node_users(); auto it = users_map.find(mul_cnode_); - if (it != users_map.end()) { auto users = it->second; for (auto &user_pair : users) { diff --git a/mindspore/ccsrc/optimizer/opt.cc b/mindspore/ccsrc/optimizer/opt.cc index 069c9d8ddd..96b9d28f9b 100644 --- a/mindspore/ccsrc/optimizer/opt.cc +++ b/mindspore/ccsrc/optimizer/opt.cc @@ -92,15 +92,12 @@ inline bool isTraversable(const AnfNodePtr &node) { if (node == nullptr) { return false; } - if (node->isa() || node->isa()) { return true; } - if (IsValueNode(node) || IsValueNode(node)) { return true; } - return false; } diff --git a/mindspore/ccsrc/pipeline/action.cc b/mindspore/ccsrc/pipeline/action.cc index 59a10afad4..75f9f76db4 100644 --- a/mindspore/ccsrc/pipeline/action.cc +++ b/mindspore/ccsrc/pipeline/action.cc @@ -287,7 +287,7 @@ static bool IsCtrlSink() { return false; } - char *enable_ctrl_sink = std::getenv("ENABLE_CTRL_SINK"); + const char *enable_ctrl_sink = std::getenv("ENABLE_CTRL_SINK"); if (enable_ctrl_sink == nullptr) { return false; } diff --git a/mindspore/ccsrc/utils/contract.h b/mindspore/ccsrc/utils/contract.h index bffcb06e89..2b0a93abec 100644 --- a/mindspore/ccsrc/utils/contract.h +++ b/mindspore/ccsrc/utils/contract.h @@ -63,12 +63,11 @@ class Ensures : public EnsuresAccess { Ensures(const Ensures &other) : value_(other.get()) {} ~Ensures() = default; - T get() const { return value_; } + const T get() const { return value_; } T &get() { return value_; } - operator T() const { return value_; } + operator const T() const { return value_; } - private: T value_; }; diff --git a/mindspore/ccsrc/utils/tensorprint_utils.cc b/mindspore/ccsrc/utils/tensorprint_utils.cc index 215f8f49ae..b34944cf21 100644 --- a/mindspore/ccsrc/utils/tensorprint_utils.cc +++ b/mindspore/ccsrc/utils/tensorprint_utils.cc @@ -86,7 +86,7 @@ bool PrintTensorToString(const char *str_data_ptr, mindspore::tensor::Tensor *co } template -void PrintScalarToString(const char *str_data_ptr, const string &tensor_type, std::ostringstream *buf) { +void PrintScalarToString(const char *str_data_ptr, const string &tensor_type, std::ostringstream *const buf) { MS_EXCEPTION_IF_NULL(str_data_ptr); MS_EXCEPTION_IF_NULL(buf); const T *data_ptr = reinterpret_cast(str_data_ptr); @@ -95,7 +95,7 @@ void PrintScalarToString(const char *str_data_ptr, const string &tensor_type, st *buf << *data_ptr << "\n"; } -void PrintScalarToBoolString(const char *str_data_ptr, const string &tensor_type, std::ostringstream *buf) { +void PrintScalarToBoolString(const char *str_data_ptr, const string &tensor_type, std::ostringstream *const buf) { MS_EXCEPTION_IF_NULL(str_data_ptr); MS_EXCEPTION_IF_NULL(buf); const bool *data_ptr = reinterpret_cast(str_data_ptr); @@ -108,7 +108,7 @@ void PrintScalarToBoolString(const char *str_data_ptr, const string &tensor_type } } -void convertDataItem2Scalar(const char *str_data_ptr, const string &tensor_type, std::ostringstream *buf) { +void convertDataItem2Scalar(const char *str_data_ptr, const string &tensor_type, std::ostringstream *const buf) { MS_EXCEPTION_IF_NULL(str_data_ptr); MS_EXCEPTION_IF_NULL(buf); auto type_iter = print_type_map.find(tensor_type);