[rtems-central commit] content: Discard empty C comment blocks

Sebastian Huber sebh at rtems.org
Thu Feb 4 13:26:58 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    6859d21329e0911d33705ce2c6f785bebffb60c5
Changeset: http://git.rtems.org/rtems-central/commit/?id=6859d21329e0911d33705ce2c6f785bebffb60c5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Feb  4 13:34:03 2021 +0100

content: Discard empty C comment blocks

---

 rtemsspec/content.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 19f0bbb..954d459 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -732,8 +732,12 @@ class CContent(Content):
     def close_comment_block(self) -> None:
         """ Closes a comment block. """
         self.pop_indent()
-        self.append(" */")
-        self.gap = True
+        if self._lines[-1].lstrip().startswith("/*"):
+            # Discard empty comment blocks
+            self._lines = self._lines[:-2]
+        else:
+            self.append(" */")
+            self.gap = True
 
     @contextmanager
     def doxygen_block(self) -> Iterator[None]:
@@ -742,10 +746,6 @@ class CContent(Content):
         yield
         self.close_comment_block()
 
-        # Discard empty Doxygen blocks
-        if self._lines[-2] == "/**":
-            self._lines = self._lines[:-3]
-
     @contextmanager
     def file_block(self) -> Iterator[None]:
         """ Opens a Doxygen @file comment block context. """



More information about the vc mailing list