From db65c042a8c913724c6e8f583cf91db0d5f54aa6 Mon Sep 17 00:00:00 2001 From: Julien LE PAGE Date: Thu, 30 Nov 2023 16:26:37 +0100 Subject: [PATCH] Fix ewp_parser to work with CppCheck and Clangd --- ewp_parser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ewp_parser.py b/ewp_parser.py index 289a2be..0876f2e 100644 --- a/ewp_parser.py +++ b/ewp_parser.py @@ -142,15 +142,21 @@ def generate_compile_commands(output_file, root_path, options, files): :param options: a list of the compilation options :param files: a list of files """ + + #Compile command implementations seem to have issues ready properly the first + #argument, so we add a dummy one as a workaround. Seen with CppCheck and + #Clangd + fixed_options = [""] + fixed_options += options + with open(output_file, "w") as output: commands = [] for file in files: commands.append( - {"directory": root_path, "arguments": options, "file": file}) + {"directory": root_path, "arguments": fixed_options, "file": file}) json.dump(commands, output, indent=True) - def normalize_path(path): """ Normalizes the given path. Handles mixed-convention paths (dos/unix), which