Commit bf048bea by Tom Tromey Committed by Tom Tromey

re PR preprocessor/34866 (valgrind error indication in testsuite from…

re PR preprocessor/34866 (valgrind error indication in testsuite from errors.c:156:cpp_error with gcc.dg/cpp/Wmissingdirs.c)

	PR libcpp/34866:
	* errors.c (cpp_error): Don't reference a token before the start
	of the current run.

From-SVN: r134421
parent 723424c8
2008-04-17 Tom Tromey <tromey@redhat.com>
PR libcpp/34866:
* errors.c (cpp_error): Don't reference a token before the start
of the current run.
2008-04-16 Tom Tromey <tromey@redhat.com> 2008-04-16 Tom Tromey <tromey@redhat.com>
* Makefile.in (TAGS_SOURCES): New variable. * Makefile.in (TAGS_SOURCES): New variable.
......
/* Default error handlers for CPP Library. /* Default error handlers for CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000, Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
2001, 2002, 2004 Free Software Foundation, Inc. 2001, 2002, 2004, 2008 Free Software Foundation, Inc.
Written by Per Bothner, 1994. Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -151,6 +151,15 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) ...@@ -151,6 +151,15 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
else else
src_loc = pfile->line_table->highest_line; src_loc = pfile->line_table->highest_line;
} }
/* We don't want to refer to a token before the beginning of the
current run -- that is invalid. */
else if (pfile->cur_token == pfile->cur_run->base)
{
if (pfile->cur_run->prev != NULL)
src_loc = pfile->cur_run->prev->limit->src_loc;
else
src_loc = 0;
}
else else
{ {
src_loc = pfile->cur_token[-1].src_loc; src_loc = pfile->cur_token[-1].src_loc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment