]> xenbits.xensource.com Git - libvirt.git/commitdiff
scripts: apibuild: fix parsing block comments from typedef enum
authorVictor Toso <victortoso@redhat.com>
Fri, 22 Apr 2022 19:23:39 +0000 (21:23 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 26 Apr 2022 15:54:22 +0000 (17:54 +0200)
Removed the TODO as we can rely to the serialize_typedef() the job to
report missing comments.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
scripts/apibuild.py

index 0bda493dd27771230612cfe494a69684eb0324b7..dd82974c122d4a014c8b77d1e96fe14288bf223e 100755 (executable)
@@ -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)