scripts: utils: migrate_sys_init: handle empty line after ARG_UNUSED
The script left empty lines below ARG_UNUSED. After this patch, ```c static int f(const struct device *dev) { ARG_UNUSED(dev); /* code */ ... } ``` will become: ```c static int f(void) { /* code */ ... } ``` instead of: ```c static int f(void) { /* code */ ... } ``` Fixes #56954 Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
2dbbfaec6b
commit
a01d40f604
1 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,7 @@ def update_sys_init(project, dry_run):
|
|||
arg = None
|
||||
content = ""
|
||||
update = False
|
||||
unused = False
|
||||
for line in lines:
|
||||
m = re.match(
|
||||
r"(.*)int ("
|
||||
|
@ -60,8 +61,14 @@ def update_sys_init(project, dry_run):
|
|||
m = re.match(r"^\s?ARG_UNUSED\(" + arg + r"\);.*$", line)
|
||||
if m:
|
||||
arg = None
|
||||
unused = True
|
||||
else:
|
||||
content += line
|
||||
elif unused:
|
||||
m = re.match(r"^\s?\n$", line)
|
||||
if not m:
|
||||
content += line
|
||||
unused = False
|
||||
else:
|
||||
content += line
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue