GCC error formatter
This script parses the output from GCC's -fdiagnostics-format=sarif-stderr flag and outputs easy-to-read error messages.
For use as a Linux shell command, make sure that the shebang path at the top of the script points to your Python interpreter's location.
#!/usr/bin/python3Then just copy the script to your PATH.
$ cp gccf.py ~/.local/bin/gccf
$ gccf -Wall -Wextra -o my_app main.cSee the build_test_files_gccf script for an example of how to import the core function into your own Python script.
As of this time, the GCC flag -fmax-errors=n does not work properly when using -fdiagnostics-format (bug report) so for now set the result_count_max variable at the top of the script if needed.
$ ./build_test_files_gccf
$ ./build_test_files_gcc