layers: Update PV codegen for Windows warning
Code gen declarations of allowed_structs in nested scopes could cause
warnings in Windows. Modified codegen to append the type name to
allowed_structs (eg allowed_structs_VkGraphicsPipelineCreateInfo) to
avoid name collisions.
Change-Id: I40bd57ff34dcd1df01d3606c79dacbe06b00f464
diff --git a/scripts/parameter_validation_generator.py b/scripts/parameter_validation_generator.py
index 49a002c..5a945f7 100644
--- a/scripts/parameter_validation_generator.py
+++ b/scripts/parameter_validation_generator.py
@@ -793,11 +793,11 @@
extStructNames = 'NULL'
vuid = self.GetVuid("VUID-%s-pNext-pNext" % struct_type_name)
if value.extstructs:
+ extStructVar = 'allowed_structs_{}'.format(struct_type_name)
+ extStructCount = 'ARRAY_SIZE({})'.format(extStructVar)
structs = value.extstructs.split(',')
- checkExpr.append('const VkStructureType allowedStructs[] = {' + ', '.join([self.getStructType(s) for s in structs]) + '};\n')
- extStructCount = 'ARRAY_SIZE(allowedStructs)'
- extStructVar = 'allowedStructs'
extStructNames = '"' + ', '.join(structs) + '"'
+ checkExpr.append('const VkStructureType {}[] = {{ {} }};\n'.format(extStructVar, ', '.join([self.getStructType(s) for s in structs])))
checkExpr.append('skipCall |= validate_struct_pnext(layer_data->report_data, "{}", {ppp}"{}"{pps}, {}, {}{}, {}, {}, GeneratedHeaderVersion, {});\n'.format(
funcPrintName, valuePrintName, extStructNames, prefix, value.name, extStructCount, extStructVar, vuid, **postProcSpec))
return checkExpr