Commits


Malik Shahzad Muzaffar authored and GitHub committed fdde2e25e13
Fix for gcc 13.3.1: Avoid creating a copy (#23500) ### Description This change avoids creating loop variable copy. GCC 13.3 suggests to use reference type to prevent copying. ### Motivation and Context While building onnxruntime 1.20.1 with latest changes from gcc 13.3, I get build error like ``` onnxruntime-1.20.1/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc: In function 'onnxruntime::common::Status onnxruntime::MatchAndProcess(Graph&, const GraphViewer&, Node&, bool&, const logging::Logger&, const std::string&, const SelectorActionRegistry&, const SatRuntimeOptimizationSaveContext*)': onnxruntime-1.20.1/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc:150:23: error: loop variable 'op_schema' creates a copy from type 'const gsl::not_null<const onnx::OpSchema*>' [-Werror=range-loop-construct] 150 | for (const auto op_schema : action_saved_state.produced_node_op_schemas) { | ^~~~~~~~~ onnxruntime-1.20.1/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc:150:23: note: use reference type to prevent copying 150 | for (const auto op_schema : action_saved_state.produced_node_op_schemas) { | ^~~~~~~~~ | & ```