Skip to content

Commit eb039c2

Browse files
committed
Document limitation on output struct member handles and add check for it
1 parent 67cb641 commit eb039c2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

scripts/core/CONTRIB.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ following:
226226
``[optional]`` tag if that struct (or any of its members, recursively) has
227227
an object handle member in its definition.
228228

229+
* A struct member which is an object handle must not have the ``[out]`` tag.
230+
229231
Forks and Pull Requests
230232
=======================
231233

scripts/parse_specs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ def __validate_members(d, tags, meta):
327327
__validate_struct_range_members(item['name'], member_members,
328328
meta)
329329

330+
if type_traits.is_handle(item['type']) and param_traits.is_output(item):
331+
raise Exception(prefix + f"struct member {item['name']} is an object handle, so it must not be have the [out] tag")
332+
330333
ver = __validate_version(item, prefix=prefix, base_version=d_ver)
331334
if ver < max_ver:
332335
raise Exception(prefix+"'version' must be increasing: %s"%item['version'])

scripts/templates/ldrddi.cpp.mako

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ namespace ur_loader
175175
size_t sizeret = 0;
176176
if (pPropSizeRet == NULL)
177177
pPropSizeRet = &sizeret;
178-
178+
%endif
179+
179180
## Here we deal with handles buried inside struct type parameters. First
180181
## we create a local copy of the struct, then we convert all the handles
181182
## in that local copy and set the parameter to point to it before forwarding

0 commit comments

Comments
 (0)