Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warning in generator.cc #403

Merged
merged 1 commit into from
Oct 28, 2023
Merged

Conversation

arjo129
Copy link
Contributor

@arjo129 arjo129 commented Oct 28, 2023

🦟 Bug fix

This PR fixes the following warning I'm getting from my compiler:

--- stderr: gz-msgs9
/home/arjoc/ws/gz/garden/src/gz-msgs/src/Generator.cc: In member function ‘virtual bool google::protobuf::compiler::cpp::Generator::Generate(const google::protobuf::FileDescriptor*, const string&, google::protobuf::compiler::OutputDirectory*, std::string*) const’:
/home/arjoc/ws/gz/garden/src/gz-msgs/src/Generator.cc:152:21: warning: loop variable ‘name’ creates a copy from type ‘const std::__cxx11::basic_string<char>’ [-Wrange-loop-construct]
  152 |     for (const auto name : ns)
      |                     ^~~~
/home/arjoc/ws/gz/garden/src/gz-msgs/src/Generator.cc:152:21: note: use reference type to prevent copying
  152 |     for (const auto name : ns)
      |                     ^~~~
      |                     &
---

This PR fixes the following warning I'm getting from my compiler:
```
--- stderr: gz-msgs9
/home/arjoc/ws/gz/garden/src/gz-msgs/src/Generator.cc: In member function ‘virtual bool google::protobuf::compiler::cpp::Generator::Generate(const google::protobuf::FileDescriptor*, const string&, google::protobuf::compiler::OutputDirectory*, std::string*) const’:
/home/arjoc/ws/gz/garden/src/gz-msgs/src/Generator.cc:152:21: warning: loop variable ‘name’ creates a copy from type ‘const std::__cxx11::basic_string<char>’ [-Wrange-loop-construct]
  152 |     for (const auto name : ns)
      |                     ^~~~
/home/arjoc/ws/gz/garden/src/gz-msgs/src/Generator.cc:152:21: note: use reference type to prevent copying
  152 |     for (const auto name : ns)
      |                     ^~~~
      |                     &
---

```

Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 requested a review from caguero as a code owner October 28, 2023 02:47
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Oct 28, 2023
@mjcarroll mjcarroll enabled auto-merge (squash) October 28, 2023 02:48
@codecov
Copy link

codecov bot commented Oct 28, 2023

We're currently processing your upload. This comment will be updated when the results are available.

@mjcarroll mjcarroll merged commit 1b0b0f8 into gz-msgs9 Oct 28, 2023
7 checks passed
@mjcarroll mjcarroll deleted the arjo/fix/compiler_warning branch October 28, 2023 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants