diff options
author | Matthew D Fleming <mdf@FreeBSD.org> | 2013-11-26 17:11:43 +0000 |
---|---|---|
committer | Matthew D Fleming <mdf@FreeBSD.org> | 2013-11-26 17:11:43 +0000 |
commit | 9b76499a0bc60bf13a808177b628d9ce91489048 (patch) | |
tree | 39a591f6aa1c4d6b1d7d6d72fde0823963e7c463 /contrib/gcclibs/libcpp/errors.c | |
parent | da162ca88f59290f1ca0644217abc56868c89948 (diff) |
Notes
Diffstat (limited to 'contrib/gcclibs/libcpp/errors.c')
-rw-r--r-- | contrib/gcclibs/libcpp/errors.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/contrib/gcclibs/libcpp/errors.c b/contrib/gcclibs/libcpp/errors.c index 97de4900001b..c8efd5387963 100644 --- a/contrib/gcclibs/libcpp/errors.c +++ b/contrib/gcclibs/libcpp/errors.c @@ -153,7 +153,20 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) } else { - src_loc = pfile->cur_token[-1].src_loc; + /* Find actual previous token. */ + cpp_token *t; + + if (pfile->cur_token != pfile->cur_run->base) + t = pfile->cur_token - 1; + else + { + if (pfile->cur_run->prev != NULL) + t = pfile->cur_run->prev->limit; + else + t = NULL; + } + /* Retrieve corresponding source location, unless we failed. */ + src_loc = t ? t->src_loc : 0; } if (_cpp_begin_message (pfile, level, src_loc, 0)) |