From 52ca756c3a4f28c7ef961545ac8e1289fd747b63 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Tue, 6 Mar 2018 17:45:32 +0100 Subject: [PATCH] VAPI: Ensure type definitions are generated in same order as .api file. The previous use of a dictionary instead of a list led to typedefs being generated in wrong order. Change-Id: Iee6ff73f920883ce6e599180c1b47fe997c1702e Signed-off-by: Ole Troan --- src/vpp-api/vapi/vapi_c_gen.py | 4 ++-- src/vpp-api/vapi/vapi_json_parser.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vpp-api/vapi/vapi_c_gen.py b/src/vpp-api/vapi/vapi_c_gen.py index 60c54e4f031..eaa22c5bc03 100755 --- a/src/vpp-api/vapi/vapi_c_gen.py +++ b/src/vpp-api/vapi/vapi_c_gen.py @@ -586,7 +586,7 @@ def gen_json_unified_header(parser, logger, j, io, name): ])) print("") print("") - for t in parser.types_by_json[j].values(): + for t in parser.types_by_json[j]: try: print("%s" % t.get_c_def()) print("") @@ -598,7 +598,7 @@ def gen_json_unified_header(parser, logger, j, io, name): print("") function_attrs = "static inline " - for t in parser.types_by_json[j].values(): + for t in parser.types_by_json[j]: print("#ifndef defined_inline_%s" % t.get_c_name()) print("#define defined_inline_%s" % t.get_c_name()) print("%s%s" % (function_attrs, t.get_swap_to_be_func_def())) diff --git a/src/vpp-api/vapi/vapi_json_parser.py b/src/vpp-api/vapi/vapi_json_parser.py index 3c9bff10824..b52b95be6dc 100644 --- a/src/vpp-api/vapi/vapi_json_parser.py +++ b/src/vpp-api/vapi/vapi_json_parser.py @@ -276,7 +276,7 @@ class JsonParser(object): def parse_json_file(self, path): self.logger.info("Parsing json api file: `%s'" % path) self.json_files.append(path) - self.types_by_json[path] = {} + self.types_by_json[path] = [] self.messages_by_json[path] = {} with open(path) as f: j = json.load(f) @@ -290,7 +290,7 @@ class JsonParser(object): self.exceptions.append(e) continue self.types[type_.name] = type_ - self.types_by_json[path][type_.name] = type_ + self.types_by_json[path].append(type_) self.logger.debug("Parsed type: %s" % type_) for m in j['messages']: try: -- 2.16.6