diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-30 15:04:12 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-30 15:04:12 +0100 |
commit | f02981a8d7b1b928136ba43cc9009052e409afd6 (patch) | |
tree | b6423311638138663855e86e8832f01b9710143c /src | |
parent | mds-kbdc: detect resursive inclusion (diff) | |
download | mds-f02981a8d7b1b928136ba43cc9009052e409afd6.tar.gz mds-f02981a8d7b1b928136ba43cc9009052e409afd6.tar.bz2 mds-f02981a8d7b1b928136ba43cc9009052e409afd6.tar.xz |
fix order of "included from here"-notes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-kbdc/process-includes.c | 9 |
1 files changed, 7 insertions, 2 deletions
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. */ |