summaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/gen/gl_marshal.py
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2017-06-22 15:12:29 -0700
committerChad Versace <[email protected]>2017-06-26 10:26:23 -0700
commit31c3c440b5361299fc0529bcf049e9b271d4fab9 (patch)
treeea4010ef39afe3c16aca058d33db2f1f455ff248 /src/mapi/glapi/gen/gl_marshal.py
parent2b237ff64cd4146e51bf6579293b1e803b1adfb4 (diff)
glapi: Fix -Wduplicate-decl-specifier due to double-const
Fix all lines in src/mesa/main/marshal_generated.c that declare double-const variables. Below is all such lines, with duplicates removed: $ grep 'const const' marshal_generated.c | sort -u const const GLboolean * pointer = cmd->pointer; const const GLvoid * indices = cmd->indices; const const GLvoid * pointer = cmd->pointer; Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen/gl_marshal.py')
-rw-r--r--src/mapi/glapi/gen/gl_marshal.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index 062afe566fd..efa4d9e6f90 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -173,11 +173,19 @@ class PrintCode(gl_XML.gl_print_base):
with indent():
for p in func.fixed_params:
if p.count:
- out('const {0} * {1} = cmd->{1};'.format(
- p.get_base_type_string(), p.name))
+ p_decl = '{0} * {1} = cmd->{1};'.format(
+ p.get_base_type_string(), p.name)
else:
- out('const {0} {1} = cmd->{1};'.format(
- p.type_string(), p.name))
+ p_decl = '{0} {1} = cmd->{1};'.format(
+ p.type_string(), p.name)
+
+ if not p_decl.startswith('const '):
+ # Declare all local function variables as const, even if
+ # the original parameter is not const.
+ p_decl = 'const ' + p_decl
+
+ out(p_decl)
+
if func.variable_params:
for p in func.variable_params:
out('const {0} * {1};'.format(