Skip to content

Commit 38379a6

Browse files
authored
remove nullptr error code from params with mbz trait (#52)
Signed-off-by: Brandon Yates <[email protected]>
1 parent 1ba14bb commit 38379a6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

scripts/parse_specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def _append(lst, key, val):
684684
if not param_traits.is_optional(item):
685685
typename = type_traits.base(item['type'])
686686

687-
if type_traits.is_pointer(item['type']):
687+
if type_traits.is_pointer(item['type']) and not param_traits.is_mbz(item):
688688
_append(rets, "$X_RESULT_ERROR_INVALID_NULL_POINTER", "`nullptr == %s`"%item['name'])
689689

690690
elif type_traits.is_handle(item['type']) and not type_traits.is_ipc_handle(item['type']):

scripts/templates/helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,21 @@ def find_enum_name(cls, name, meta):
294294
Extracts traits from a parameter object
295295
"""
296296
class param_traits:
297+
RE_MBZ = r".*\[mbz\].*"
297298
RE_IN = r"^\[in\].*"
298299
RE_OUT = r"^\[out\].*"
299300
RE_INOUT = r"^\[in,out\].*"
300301
RE_OPTIONAL = r".*\[optional\].*"
301302
RE_RANGE = r".*\[range\((.+),\s*(.+)\)\][\S\s]*"
302303
RE_RELEASE = r".*\[release\].*"
303304

305+
@classmethod
306+
def is_mbz(cls, item):
307+
try:
308+
return True if re.match(cls.RE_MBZ, item['desc']) else False
309+
except:
310+
return False
311+
304312
@classmethod
305313
def is_input(cls, item):
306314
try:

0 commit comments

Comments
 (0)