Commit 60f60d0
Add [[nodiscard]] to
This covers logically constant APIs (similar to the guidance in
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3122r1.html) where
ignoring the return value likely indicates an omission on the part of the
caller or a call that can be cleaned up.
For example:
my_message.mutable_child()->grandchild()
Creates a child instance but grandchild() is a no-op. mutable_grandchild() may
have been intended.
PiperOrigin-RevId: 836249595const message field accessors.1 parent 244e1ea commit 60f60d0
File tree
3 files changed
+128
-94
lines changed- src/google/protobuf
- compiler
- cpp/field_generators
3 files changed
+128
-94
lines changedLines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
| 776 | + | |
777 | 777 | | |
778 | | - | |
| 778 | + | |
| 779 | + | |
779 | 780 | | |
780 | 781 | | |
781 | 782 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments