Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove nullptr error code from params with mbz trait #52

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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