Chromium Code Reviews

Unified Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 817023003: replace COMPILE_ASSERT with static_assert in gpu/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | gpu/command_buffer/client/cmd_buffer_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/build_gles2_cmd_buffer.py
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 418612a580d6748709213133dd36c43c814e5f05..4acf8e3731ad1746fc68a99a4ccdef9fd588a96d 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -3174,15 +3174,17 @@ class TypeHandler(object):
file.Write("\n")
size = len(args) * _SIZE_OF_UINT32 + _SIZE_OF_COMMAND_HEADER
- file.Write("COMPILE_ASSERT(sizeof(%s) == %d,\n" % (func.name, size))
- file.Write(" Sizeof_%s_is_not_%d);\n" % (func.name, size))
- file.Write("COMPILE_ASSERT(offsetof(%s, header) == 0,\n" % func.name)
- file.Write(" OffsetOf_%s_header_not_0);\n" % func.name)
+ file.Write("static_assert(sizeof(%s) == %d,\n" % (func.name, size))
+ file.Write(" \"size of %s should be %d\");\n" %
+ (func.name, size))
+ file.Write("static_assert(offsetof(%s, header) == 0,\n" % func.name)
+ file.Write(" \"offset of %s header should be 0\");\n" %
+ func.name)
offset = _SIZE_OF_COMMAND_HEADER
for arg in args:
- file.Write("COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" %
+ file.Write("static_assert(offsetof(%s, %s) == %d,\n" %
(func.name, arg.name, offset))
- file.Write(" OffsetOf_%s_%s_not_%d);\n" %
+ file.Write(" \"offset of %s %s should be %d\");\n" %
(func.name, arg.name, offset))
offset += _SIZE_OF_UINT32
if not result == None and len(result) > 1:
@@ -3191,8 +3193,9 @@ class TypeHandler(object):
parts = line.split()
name = parts[-1]
check = """
-COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
- OffsetOf_%(cmd_name)s_Result_%(field_name)s_not_%(offset)d);
+static_assert(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
+ "offset of %(cmd_name)s Result %(field_name)s should be "
+ "%(offset)d");
"""
file.Write((check.strip() + "\n") % {
'cmd_name': func.name,
« no previous file with comments | « no previous file | gpu/command_buffer/client/cmd_buffer_helper.h » ('j') | no next file with comments »

Powered by Google App Engine