This patch changes the order of the warnings from a first-seen, first-printed order to a file location based one. Thus, instead of printing directly to stderr, the warnings are stored in a growing table, and sorted and printed at the last moment.
Due to the file names being stored as uniqstr, we can't free them until the warnings have been printed. But the warnings have to be printed whatever happens, so it has to be in the finish part of the main. That's why I moved the uniqstr freeing to this part. Two questions arise : timing measurement, is it still accurate for the free part? And also, are there any cases where we want to exit without freeing the uniqstr (for security/performance reasons)? Valentin Tolmer (1): warnings: sort the messages by location src/complain.c | 200 +++++++++++++++++++++++++++++++++++++++++++-------- src/complain.h | 20 ++++++ src/location.c | 100 ++++++++++++++++++++++++++ src/location.h | 8 +++ src/main.c | 4 +- src/muscle-tab.c | 2 +- src/reader.c | 2 +- src/scan-code.l | 19 ++--- src/symtab.c | 6 +- tests/actions.at | 8 +-- tests/conflicts.at | 46 ++++++------ tests/existing.at | 142 ++++++++++++++++++------------------ tests/input.at | 106 +++++++++++++-------------- tests/reduce.at | 82 ++++++++++----------- tests/regression.at | 4 +- tests/skeletons.at | 8 +-- 16 files changed, 514 insertions(+), 243 deletions(-) -- 1.7.9.5
