From 2f1c01e67223a05a43ea107d7c73eca9ffc0e2d9 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Fri, 22 Apr 2022 21:23:39 +0200 Subject: [PATCH] scripts: apibuild: fix parsing block comments from typedef enum Removed the TODO as we can rely to the serialize_typedef() the job to report missing comments. Signed-off-by: Victor Toso Reviewed-by: Andrea Bolognani --- scripts/apibuild.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 0bda493dd2..dd82974c12 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)