Skip to content

Commit 7b6cdcb

Browse files
Abramo-Bagnaranashif
authored andcommitted
coding guidelines: comply with MISRA C:2012 Rule 8.3
- fixed the code generator so to use "more" parameter name consistently Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
1 parent 878d433 commit 7b6cdcb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

scripts/gen_syscalls.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@
113113

114114
handler_template = """
115115
extern uintptr_t z_hdlr_%s(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3,
116-
uintptr_t arg4, uintptr_t arg5, uintptr_t arg6, void *ssf);
116+
uintptr_t arg4, uintptr_t arg5, uintptr_t %s, void *ssf);
117117
"""
118118

119119
weak_template = """
120120
__weak ALIAS_OF(handler_no_syscall)
121121
uintptr_t %s(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3,
122-
uintptr_t arg4, uintptr_t arg5, uintptr_t arg6, void *ssf);
122+
uintptr_t arg4, uintptr_t arg5, uintptr_t %s, void *ssf);
123123
"""
124124

125125

@@ -316,7 +316,7 @@ def marshall_defs(func_name, func_type, args):
316316

317317
mrsh += "}\n"
318318

319-
return mrsh, mrsh_name
319+
return mrsh, mrsh_name, nmrsh
320320

321321
def analyze_fn(match_group):
322322
func, args = match_group
@@ -335,13 +335,13 @@ def analyze_fn(match_group):
335335
sys_id = "K_SYSCALL_" + func_name.upper()
336336

337337
marshaller = None
338-
marshaller, handler = marshall_defs(func_name, func_type, args)
338+
marshaller, handler, nmrsh = marshall_defs(func_name, func_type, args)
339339
invocation = wrapper_defs(func_name, func_type, args)
340340

341341
# Entry in _k_syscall_table
342342
table_entry = "[%s] = %s" % (sys_id, handler)
343343

344-
return (handler, invocation, marshaller, sys_id, table_entry)
344+
return (handler, invocation, marshaller, sys_id, table_entry, nmrsh)
345345

346346
def parse_args():
347347
global args
@@ -380,9 +380,10 @@ def main():
380380
ids = []
381381
table_entries = []
382382
handlers = []
383+
arg_numbers = []
383384

384385
for match_group, fn in syscalls:
385-
handler, inv, mrsh, sys_id, entry = analyze_fn(match_group)
386+
handler, inv, mrsh, sys_id, entry, nmrsh = analyze_fn(match_group)
386387

387388
if fn not in invocations:
388389
invocations[fn] = []
@@ -391,6 +392,7 @@ def main():
391392
ids.append(sys_id)
392393
table_entries.append(entry)
393394
handlers.append(handler)
395+
arg_numbers.append(nmrsh)
394396

395397
if mrsh:
396398
syscall = typename_split(match_group[0])[1]
@@ -400,8 +402,9 @@ def main():
400402
with open(args.syscall_dispatch, "w") as fp:
401403
table_entries.append("[K_SYSCALL_BAD] = handler_bad_syscall")
402404

403-
weak_defines = "".join([weak_template % name
404-
for name in handlers
405+
weak_defines = "".join([weak_template % (name,
406+
"arg6" if nmrsh <= 6 else "more")
407+
for (name, nmrsh) in zip(handlers, arg_numbers)
405408
if not name in noweak])
406409

407410
# The "noweak" ones just get a regular declaration

0 commit comments

Comments
 (0)