From f02981a8d7b1b928136ba43cc9009052e409afd6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 30 Nov 2014 15:04:12 +0100 Subject: fix order of "included from here"-notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/process-includes.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mds-kbdc') diff --git a/src/mds-kbdc/process-includes.c b/src/mds-kbdc/process-includes.c index 64dd7eb..cfd0fe3 100644 --- a/src/mds-kbdc/process-includes.c +++ b/src/mds-kbdc/process-includes.c @@ -86,7 +86,7 @@ static int transfer_errors(mds_kbdc_parsed_t* restrict subresult, mds_kbdc_tree_ mds_kbdc_parse_error_t** errors = NULL; mds_kbdc_parse_error_t* suberror; size_t errors_ptr = 0; - int saved_errno; + int saved_errno, annotated = 0; /* Allocate temporary list for errors. */ if (subresult->errors_ptr == 0) @@ -99,16 +99,21 @@ static int transfer_errors(mds_kbdc_parsed_t* restrict subresult, mds_kbdc_tree_ suberror = subresult->errors[subresult->errors_ptr]; /* If it is more severe than a note, we want to say there it was included. */ - if (suberror->severity > MDS_KBDC_PARSE_ERROR_NOTE) + if (annotated == 0) { NEW_ERROR(tree, NOTE, "included from here"); errors[errors_ptr++] = error; result->errors[--(result->errors_ptr)] = NULL; + annotated = 1; } /* Include error. */ errors[errors_ptr++] = suberror; subresult->errors[subresult->errors_ptr] = NULL; + + /* Make sure when there are nested inclusions that the outermost inclusion * is annotated last. */ + if (suberror->severity > MDS_KBDC_PARSE_ERROR_NOTE) + annotated = 0; } /* Append errors. */ -- cgit v1.2.3-70-g09d2