From 3c9b3611633ceb0144c9ed49f3309ffcacbd5b49 Mon Sep 17 00:00:00 2001 From: Gary Miguel Date: Thu, 29 Jul 2021 22:43:13 -0700 Subject: [PATCH] Fix compilation warnings. (#3616) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warnings fixed: * `onnx/version_converter/convert.cc:93:63: error: implicitly-declared ‘onnx::generic_graph_node_list_iterator& onnx::generic_graph_node_list_iterator::operator=(const onnx::generic_graph_node_list_iterator&)’ is deprecated [-Werror=deprec ated-copy]` * `onnx/defs/parser.cc:395:11: error: this statement may fall through [-Werror=implicit-fallthrough=]` Before this, building with `ONNX_WERROR=ON` failed for me on Linux. After this, it succeeds. Signed-off-by: Gary Miguel --- onnx/common/graph_node_list.h | 2 ++ onnx/defs/parser.cc | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/onnx/common/graph_node_list.h b/onnx/common/graph_node_list.h index bdd54391cce..ead527b9a45 100644 --- a/onnx/common/graph_node_list.h +++ b/onnx/common/graph_node_list.h @@ -54,6 +54,8 @@ struct generic_graph_node_list_iterator final { : cur(cur), d(d) {} generic_graph_node_list_iterator(const generic_graph_node_list_iterator & rhs) : cur(rhs.cur), d(rhs.d) {} + generic_graph_node_list_iterator & operator=( + const generic_graph_node_list_iterator&) = default; T * operator*() const { return cur; } T * operator->() const { return cur; } generic_graph_node_list_iterator & operator++() { diff --git a/onnx/defs/parser.cc b/onnx/defs/parser.cc index 0b1c9bb56d4..f38577c9755 100644 --- a/onnx/defs/parser.cc +++ b/onnx/defs/parser.cc @@ -116,7 +116,7 @@ Status OnnxParser::ParseInput(ValueInfoList& inputs, TensorList& initializers) { // default value for input TensorProto& tp = *initializers.Add(); tp.set_name(vi.name()); - CHECK_PARSER_STATUS (Parse(tp, vi.type())); + CHECK_PARSER_STATUS(Parse(tp, vi.type())); } } while (Matches(',')); MATCH(')'); @@ -139,7 +139,7 @@ Status OnnxParser::ParseValueInfo(ValueInfoList& value_infos, TensorList& initia // initializer TensorProto& tp = *initializers.Add(); tp.set_name(vi.name()); - CHECK_PARSER_STATUS (Parse(tp, vi.type())); + CHECK_PARSER_STATUS(Parse(tp, vi.type())); } else { // valueinfo *value_infos.Add() = vi; @@ -391,8 +391,8 @@ Status OnnxParser::Parse(ModelProto& model) { import->set_version(intval); } while (Matches(',')); MATCH(']'); - break; } + break; } case KeyWordMap::KeyWord::PRODUCER_NAME: PARSE_TOKEN(strval);