[rtems-central commit] content: Strip function parameters
Sebastian Huber
sebh at rtems.org
Thu Aug 20 14:13:13 UTC 2020
Module: rtems-central
Branch: master
Commit: 4e31483f9c7be725d045f77cae076598ba574bb3
Changeset: http://git.rtems.org/rtems-central/commit/?id=4e31483f9c7be725d045f77cae076598ba574bb3
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Aug 19 11:25:30 2020 +0200
content: Strip function parameters
---
rtemsspec/content.py | 5 ++++-
rtemsspec/tests/spec-validation/action2.yml | 3 ++-
rtemsspec/validation.py | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 7b99928..74b2b43 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -747,6 +747,7 @@ class CContent(Content):
ret = ""
space = ""
if params:
+ params = [param.strip() for param in params]
param_line = "( " + ", ".join(params) + " )"
else:
param_line = "()"
@@ -771,7 +772,9 @@ class CContent(Content):
align: bool = True) -> None:
# pylint: disable=too-many-arguments
""" Adds a function declaration. """
- if not params:
+ if params:
+ params = [param.strip() for param in params]
+ else:
params = ["void"]
param_line = f"( {', '.join(params)} )"
space = "" if not ret or ret.endswith("*") else " "
diff --git a/rtemsspec/tests/spec-validation/action2.yml b/rtemsspec/tests/spec-validation/action2.yml
index a2b852e..605f736 100644
--- a/rtemsspec/tests/spec-validation/action2.yml
+++ b/rtemsspec/tests/spec-validation/action2.yml
@@ -104,7 +104,8 @@ test-header:
Parameter A description.
dir: in
name: a
- specifier: int *${.:name}
+ specifier: |
+ int *${.:name}
- description: |
Parameter B description.
dir: null
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index f795205..a6e6172 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -314,7 +314,7 @@ class _TestDirectiveItem(_TestItem):
content.add_description_block(
"This member contains a copy of the corresponding "
f"{self.ident}_Run() parameter.", None)
- content.add(f"{param};")
+ content.add(f"{param.strip()};")
content.add_description_block(
"This member defines the pre-condition states "
"for the next action.", None)
More information about the vc
mailing list