Problem: our cmake compilation system produces A LOT of text output, which can make finding warnings and errors hard
Goal: run this text output through a filtering script to extract the important info
There are 3 outputs we care about: compiler warnings, compiler errors, linker errors
Compiler warnings and errors follow this format
/root/code/Common/Libs/Src/CanInterface.cpp:12:87: warning: declaration of 'network' shadows a member of 'CanInterface' [-Wshadow]
12 | CanInterface::CanInterface(Pin tx, Pin rx, Pin standby, uint32_t baudrate, CanNetwork network)
| ~~~~~~~~~~~^~~~~~~
Linker errors are formatted more inconsistently, example
/root/code/MotorBoard/Src/main.cpp:62:(.text._Z8app_mainv+0x168): undefined reference to 'cat'
What you need to do
Create these functions
process_compilation_output(output: str) -> str: This function is the main function that will 'run' the parsing process. It will accept the compilation output wall of text and return the processed output wall of text. It will follow this process:
- For each line, check if it fits the compilation warning, compilation error, or linker error format, if so add it to a list for that type
a. also check that its not a duplicate
- reformat all compilation warnings and errors with the next function
- combine all of this into a single string, with some other formatting (a 'Compilation Warnings' header, color the text, ...)
reformat_compilation_warning_error(text: str) -> str): This will reformat a singular compilation warning or error (they follow the same format so it can be the same function) into an easier to read version. Example below
Common/Libs/Src/CanInterface.cpp Line 12: declaration of 'network' shadows a member of 'CanInterface'
12 | CanInterface::CanInterface(Pin tx, Pin rx, Pin standby, uint32_t baudrate, CanNetwork network)
|
Note that some warnings (I will provide a list) should discard the second and third line, to remove redundant info
Other Notes:
- use regex (regular expressions) for finding and parsing compiler warnings and errors
- since linker errors are formatted inconsistently, parse the line for certain key phrases instead
See attached files for examples. c#.log files have compilation warnings and compilation errors. l#.log files have compilation warnings and linker errors.
l2.log
l1.log
c4.log
c3.log
c2.log
c1.log
Problem: our cmake compilation system produces A LOT of text output, which can make finding warnings and errors hard
Goal: run this text output through a filtering script to extract the important info
There are 3 outputs we care about: compiler warnings, compiler errors, linker errors
Compiler warnings and errors follow this format
Linker errors are formatted more inconsistently, example
/root/code/MotorBoard/Src/main.cpp:62:(.text._Z8app_mainv+0x168): undefined reference to 'cat'What you need to do
Create these functions
process_compilation_output(output: str) -> str: This function is the main function that will 'run' the parsing process. It will accept the compilation output wall of text and return the processed output wall of text. It will follow this process:a. also check that its not a duplicate
reformat_compilation_warning_error(text: str) -> str): This will reformat a singular compilation warning or error (they follow the same format so it can be the same function) into an easier to read version. Example belowNote that some warnings (I will provide a list) should discard the second and third line, to remove redundant info
Other Notes:
See attached files for examples.
c#.logfiles have compilation warnings and compilation errors.l#.logfiles have compilation warnings and linker errors.l2.log
l1.log
c4.log
c3.log
c2.log
c1.log