Skip to content

Commit

Permalink
remove nullptr error code from params with mbz trait (#52)
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Yates <brandon.yates@intel.com>
  • Loading branch information
bmyates authored Dec 19, 2022
1 parent 1ba14bb commit 38379a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/parse_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def _append(lst, key, val):
if not param_traits.is_optional(item):
typename = type_traits.base(item['type'])

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

elif type_traits.is_handle(item['type']) and not type_traits.is_ipc_handle(item['type']):
Expand Down
8 changes: 8 additions & 0 deletions scripts/templates/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,21 @@ def find_enum_name(cls, name, meta):
Extracts traits from a parameter object
"""
class param_traits:
RE_MBZ = r".*\[mbz\].*"
RE_IN = r"^\[in\].*"
RE_OUT = r"^\[out\].*"
RE_INOUT = r"^\[in,out\].*"
RE_OPTIONAL = r".*\[optional\].*"
RE_RANGE = r".*\[range\((.+),\s*(.+)\)\][\S\s]*"
RE_RELEASE = r".*\[release\].*"

@classmethod
def is_mbz(cls, item):
try:
return True if re.match(cls.RE_MBZ, item['desc']) else False
except:
return False

@classmethod
def is_input(cls, item):
try:
Expand Down

0 comments on commit 38379a6

Please sign in to comment.