[PATCH v4 14/19] scripts: apibuild: fix parsing block comments from typedef enum

Victor Toso victortoso at redhat.com
Fri Apr 22 19:23:39 UTC 2022


Removed the TODO as we can rely to the serialize_typedef() the job to
report missing comments.

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 scripts/apibuild.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/apibuild.py b/scripts/apibuild.py
index 19e897b1ba..ddc2fff7af 100755
--- a/scripts/apibuild.py
+++ b/scripts/apibuild.py
@@ -1145,6 +1145,12 @@ class CParser:
     def parseTypedef(self, token):
         if token is None:
             return None
+
+        # With typedef enum types, we can have comments parsed before the
+        # enum themselves. The parsing of enum values does clear the
+        # self.comment variable. So we store it here for later.
+        typedef_comment = self.comment
+
         token = self.parseType(token)
         if token is None:
             self.error("parsing typedef")
@@ -1168,7 +1174,7 @@ class CParser:
                                        "struct", type)
                         base_type = "struct " + name
                     else:
-                        # TODO report missing or misformatted comments
+                        self.comment = typedef_comment
                         info = self.parseTypeComment(name, 1)
                         self.index_add(name, self.filename, not self.is_header,
                                        "typedef", type, info)
-- 
2.35.1



More information about the libvir-list mailing list