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

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

Issue 2637393002: Make mojom-generated C++ string constants really constant. (Closed)
Patch Set: Created 3 years, 11 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/module.h.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
index 68220d8a79490ba507e149de2c6c05261931f1bc..ab5668301cdd0df8e00ed0a7b027cc8e08420942 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -35,6 +35,7 @@ namespace {{variant}} {
#include <stdint.h>
+#include <limits>
#include <type_traits>
#include <utility>
@@ -96,13 +97,7 @@ using {{enum.name}} = {{enum.name}}; // Alias for definition in the parent name
{#--- Constants #}
{%- for constant in module.constants %}
-{#- To be consistent with constants defined inside interfaces, only make
- integral types compile-time constants. #}
-{%- if constant.kind|is_integral_kind %}
-const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|constant_value}};
-{%- else %}
-extern const {{constant.kind|cpp_pod_type}} {{constant.name}};
-{%- endif %}
+{{constant|format_constant_declaration}};
{%- endfor %}
{#--- Interface Forward Declarations -#}

Powered by Google App Engine
This is Rietveld 408576698