summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-02 14:05:55 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-02 14:10:05 +0100
commitccf799f5a7ec3a044c36b37d6ffcaee22f630910 (patch)
treec89a070d50b3bb71b2177e61f929b7281f0ea0e1
parentinterface: Add directive constraints (diff)
downloadrtems-central-ccf799f5a7ec3a044c36b37d6ffcaee22f630910.tar.bz2
interface*: Document only params with description
-rw-r--r--rtemsspec/content.py6
-rw-r--r--rtemsspec/interfacedoc.py10
-rw-r--r--rtemsspec/tests/spec-interface/func.yml4
-rw-r--r--rtemsspec/tests/test_interface.py8
-rw-r--r--rtemsspec/tests/test_interfacedoc.py8
5 files changed, 28 insertions, 8 deletions
diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 9e4049c0..7f65949a 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -950,8 +950,10 @@ class CContent(Content):
substitute: Callable[[Optional[str]], str] = _make_str) -> None:
""" Adds a list of parameter descriptions. """
for param in params:
- self.wrap(param["name"] + " " + substitute(param["description"]),
- initial_indent=_PARAM[param["dir"]])
+ description = param["description"]
+ if description:
+ self.wrap(param["name"] + " " + substitute(description),
+ initial_indent=_PARAM[param["dir"]])
def add_description_block(self, brief: Optional[str],
description: Optional[str]) -> None:
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py
index 05f24b77..e45fd934 100644
--- a/rtemsspec/interfacedoc.py
+++ b/rtemsspec/interfacedoc.py
@@ -175,10 +175,12 @@ def _generate_directive(content: SphinxContent, mapper: _Mapper,
if item["params"]:
content.add(".. rubric:: PARAMETERS:")
for param in item["params"]:
- content.add_definition_item(
- f"``{_sanitize_name(param['name'])}``",
- mapper.substitute(f"This parameter {param['description']}"),
- wrap=True)
+ description = param["description"]
+ if description:
+ content.add_definition_item(
+ f"``{_sanitize_name(param['name'])}``",
+ mapper.substitute(f"This parameter {description}"),
+ wrap=True)
if item["description"]:
content.add(".. rubric:: DESCRIPTION:")
content.wrap(mapper.substitute(item["description"]))
diff --git a/rtemsspec/tests/spec-interface/func.yml b/rtemsspec/tests/spec-interface/func.yml
index 75d9a5c1..f12bbe2d 100644
--- a/rtemsspec/tests/spec-interface/func.yml
+++ b/rtemsspec/tests/spec-interface/func.yml
@@ -11,6 +11,7 @@ definition:
- const int *${.:/params[1]/name}
- int *${.:/params[2]/name}
- int *${.:/params[3]/name}
+ - int *${.:/params[4]/name}
return: void
variants: []
description: |
@@ -48,6 +49,9 @@ params:
- description: is parameter 3.
dir: inout
name: Param3
+- description: null
+ dir: null
+ name: Param4
return:
return: null
return-values: []
diff --git a/rtemsspec/tests/test_interface.py b/rtemsspec/tests/test_interface.py
index 76331ad5..b3bf4d36 100644
--- a/rtemsspec/tests/test_interface.py
+++ b/rtemsspec/tests/test_interface.py
@@ -231,7 +231,13 @@ typedef enum EnumB {
* * Constraint A for Function().
* @endparblock
*/
-void Function( int Param0, const int *Param1, int *Param2, int *Param3 );
+void Function(
+ int Param0,
+ const int *Param1,
+ int *Param2,
+ int *Param3,
+ int *Param4
+);
/* Generated from spec:/macro */
diff --git a/rtemsspec/tests/test_interfacedoc.py b/rtemsspec/tests/test_interfacedoc.py
index 54f9e1ed..d079ef16 100644
--- a/rtemsspec/tests/test_interfacedoc.py
+++ b/rtemsspec/tests/test_interfacedoc.py
@@ -433,7 +433,13 @@ Function brief description.
.. code-block:: c
- void Function( int Param0, const int *Param1, int *Param2, int *Param3 );
+ void Function(
+ int Param0,
+ const int *Param1,
+ int *Param2,
+ int *Param3,
+ int *Param4
+ );
.. rubric:: PARAMETERS: