diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-06-24 09:58:07 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-03 10:22:45 +0200 |
commit | 4c52537bf30039500192a59a66972f7a6bc4ae6e (patch) | |
tree | f88e08cb6842f446fc50424396f582cd3a729b9a | |
parent | interface: Support automatic Doxygen links (diff) | |
download | rtems-central-4c52537bf30039500192a59a66972f7a6bc4ae6e.tar.bz2 |
interface: Fix format of macros
-rw-r--r-- | rtemsqual/interface.py | 5 | ||||
-rw-r--r-- | rtemsqual/tests/spec-interface/macro3.yml | 22 | ||||
-rw-r--r-- | rtemsqual/tests/test_interface.py | 4 |
3 files changed, 28 insertions, 3 deletions
diff --git a/rtemsqual/interface.py b/rtemsqual/interface.py index 76092f1a..7bc76076 100644 --- a/rtemsqual/interface.py +++ b/rtemsqual/interface.py @@ -356,7 +356,10 @@ class Node: def _get_macro_definition(self, item: Item, definition: Any) -> Lines: name = item["name"] params = [param["name"] for param in item["params"]] - param_line = ", ".join(params) + if params: + param_line = " " + ", ".join(params) + " " + else: + param_line = "" line = f"#define {name}({param_line})" if len(line) > 79: param_block = ", \\\n ".join(params) diff --git a/rtemsqual/tests/spec-interface/macro3.yml b/rtemsqual/tests/spec-interface/macro3.yml new file mode 100644 index 00000000..d99179c5 --- /dev/null +++ b/rtemsqual/tests/spec-interface/macro3.yml @@ -0,0 +1,22 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +brief: Macro without parameters. +definition: + default: '0' + variants: [] +description: null +name: MACRO +notes: null +params: [] +return: + return: null + return-values: [] +interface-type: macro +links: +- role: interface-placement + uid: h2 +- role: interface-ingroup + uid: gb +type: interface diff --git a/rtemsqual/tests/test_interface.py b/rtemsqual/tests/test_interface.py index 966c9ddc..387377d2 100644 --- a/rtemsqual/tests/test_interface.py +++ b/rtemsqual/tests/test_interface.py @@ -261,9 +261,9 @@ static inline int VeryLongFunction( * @return Sometimes some value. */ #if 0 - #define MACRO(Param0) + #define MACRO( Param0 ) #else - #define MACRO(Param0) ( ( Param0 ) + 1 ) + #define MACRO( Param0 ) ( ( Param0 ) + 1 ) #endif /** |