aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/process-includes.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-11-30 15:04:12 +0100
committerMattias Andrée <maandree@operamail.com>2014-11-30 15:04:12 +0100
commitf02981a8d7b1b928136ba43cc9009052e409afd6 (patch)
treeb6423311638138663855e86e8832f01b9710143c /src/mds-kbdc/process-includes.c
parentmds-kbdc: detect resursive inclusion (diff)
downloadmds-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.c9
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. */