Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl

Issue 2392713002: mojo: Mark DataView readers as WARN_UNUSED_RESULT. (Closed)
Patch Set: Fix attribute placement to appease gcc Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
index 2fe260576484d0229728ce5720a3f2813e146908..96e0d614d8ef59f635fb44f478bca29586b0dab5 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_declaration.tmpl
@@ -21,12 +21,12 @@ class {{struct.name}}DataView {
{{kind|cpp_data_view_type}}* output);
template <typename UserType>
- bool Read{{name|under_to_camel}}(UserType* output) {
+ WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) {
{%- if pf.min_version != 0 %}
- auto pointer = data_->header_.version >= {{pf.min_version}}
- ? &data_->{{name}} : nullptr;
+ auto* pointer = data_->header_.version >= {{pf.min_version}}
+ ? &data_->{{name}} : nullptr;
{%- else %}
- auto pointer = &data_->{{name}};
+ auto* pointer = &data_->{{name}};
{%- endif %}
return mojo::internal::Deserialize<{{kind|unmapped_type_for_serializer}}>(
pointer, output, context_);
@@ -37,12 +37,12 @@ class {{struct.name}}DataView {
{{kind|cpp_data_view_type}}* output);
template <typename UserType>
- bool Read{{name|under_to_camel}}(UserType* output) {
+ WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) {
{%- if pf.min_version != 0 %}
- auto pointer = data_->header_.version >= {{pf.min_version}}
- ? data_->{{name}}.Get() : nullptr;
+ auto* pointer = data_->header_.version >= {{pf.min_version}}
+ ? data_->{{name}}.Get() : nullptr;
{%- else %}
- auto pointer = data_->{{name}}.Get();
+ auto* pointer = data_->{{name}}.Get();
{%- endif %}
return mojo::internal::Deserialize<{{kind|unmapped_type_for_serializer}}>(
pointer, output, context_);
@@ -50,7 +50,7 @@ class {{struct.name}}DataView {
{%- elif kind|is_enum_kind %}
template <typename UserType>
- bool Read{{name|under_to_camel}}(UserType* output) const {
+ WARN_UNUSED_RESULT bool Read{{name|under_to_camel}}(UserType* output) const {
{%- if pf.min_version != 0 %}
auto data_value = data_->header_.version >= {{pf.min_version}}
? data_->{{name}} : 0;

Powered by Google App Engine
This is Rietveld 408576698