Commit dc3786d8 by Per Bothner Committed by Per Bothner

Copy over from cs branch:

	* cpplib.h (struct cpp_token):  Change type of field line to fileline.
	(cpp_error_with_line):  Use fileline for appropriate parameter.
	* cpphash.h (struct cpp_macro):  Change type of field line to fileline.
	(struct cpp_reader):  Likewise for fields line and directive_line.
	(_cpp_begin_message):  Use fileline for appropriate parameter.
	* cpperror.c (print_location, _cpp_begin_message, cpp_error_with_line,
	cpp_error):  Use fileline for appropriate parameters and variables.
	(print_location):  New local lin, since it is not a fileline.

From-SVN: r70826
parent a8599378
2003-08-26 Per Bothner <pbothner@apple.com>
* cpplib.h (struct cpp_token): Change type of field line to fileline.
(cpp_error_with_line): Use fileline for appropriate parameter.
* cpphash.h (struct cpp_macro): Change type of field line to fileline.
(struct cpp_reader): Likewise for fields line and directive_line.
(_cpp_begin_message): Use fileline for appropriate parameter.
* cpperror.c (print_location, _cpp_begin_message, cpp_error_with_line,
cpp_error): Use fileline for appropriate parameters and variables.
(print_location): New local lin, since it is not a fileline.
2003-08-26 Roger Sayle <roger@eyesopen.com>
PR middle-end/12002
......
......@@ -29,34 +29,35 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cpphash.h"
#include "intl.h"
static void print_location (cpp_reader *, unsigned int, unsigned int);
static void print_location (cpp_reader *, fileline, unsigned int);
/* Print the logical file location (LINE, COL) in preparation for a
diagnostic. Outputs the #include chain if it has changed. A line
of zero suppresses the include stack, and outputs the program name
instead. */
static void
print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
print_location (cpp_reader *pfile, fileline line, unsigned int col)
{
if (!pfile->buffer || line == 0)
fprintf (stderr, "%s: ", progname);
else
{
const struct line_map *map;
unsigned int lin;
map = linemap_lookup (&pfile->line_maps, line);
linemap_print_containing_files (&pfile->line_maps, map);
line = SOURCE_LINE (map, line);
lin = SOURCE_LINE (map, line);
if (col == 0)
col = 1;
if (line == 0)
if (lin == 0)
fprintf (stderr, "%s:", map->to_file);
else if (CPP_OPTION (pfile, show_column) == 0)
fprintf (stderr, "%s:%u:", map->to_file, line);
fprintf (stderr, "%s:%u:", map->to_file, lin);
else
fprintf (stderr, "%s:%u:%u:", map->to_file, line, col);
fprintf (stderr, "%s:%u:%u:", map->to_file, lin, col);
fputc (' ', stderr);
}
......@@ -68,7 +69,7 @@ print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
the correct place by default. Returns 0 if the error has been
suppressed. */
int
_cpp_begin_message (cpp_reader *pfile, int code, unsigned int line,
_cpp_begin_message (cpp_reader *pfile, int code, fileline line,
unsigned int column)
{
int level = DL_EXTRACT (code);
......@@ -124,7 +125,8 @@ _cpp_begin_message (cpp_reader *pfile, int code, unsigned int line,
void
cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
{
unsigned int line, column;
fileline line;
unsigned int column;
va_list ap;
va_start (ap, msgid);
......@@ -157,7 +159,7 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
/* Print an error at a specific location. */
void
cpp_error_with_line (cpp_reader *pfile, int level,
unsigned int line, unsigned int column,
fileline line, unsigned int column,
const char *msgid, ...)
{
va_list ap;
......
......@@ -100,7 +100,7 @@ struct cpp_macro
} exp;
/* Definition line number. */
unsigned int line;
fileline line;
/* Number of tokens in expansion, or bytes for traditional macros. */
unsigned int count;
......@@ -337,10 +337,10 @@ struct cpp_reader
/* Source line tracking. */
struct line_maps line_maps;
const struct line_map *map;
unsigned int line;
fileline line;
/* The line of the '#' of the current directive. */
unsigned int directive_line;
fileline directive_line;
/* Memory buffers. */
_cpp_buff *a_buff; /* Aligned permanent storage. */
......@@ -497,7 +497,7 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
#define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, warn_traditional)
/* In cpperror.c */
extern int _cpp_begin_message (cpp_reader *, int, unsigned int, unsigned int);
extern int _cpp_begin_message (cpp_reader *, int, fileline, unsigned int);
/* In cppmacro.c */
extern void _cpp_free_definition (cpp_hashnode *);
......
......@@ -174,7 +174,7 @@ struct cpp_string
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
struct cpp_token
{
unsigned int line; /* Logical line of first char of token. */
fileline line; /* Logical line of first char of token. */
unsigned short col; /* Column of first char of token. */
ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
unsigned char flags; /* flags - see above */
......@@ -680,8 +680,8 @@ extern void cpp_errno (cpp_reader *, int, const char *msgid);
/* Same as cpp_error, except additionally specifies a position as a
(translation unit) physical line and physical column. If the line is
zero, then no location is printed. */
extern void cpp_error_with_line (cpp_reader *, int, unsigned, unsigned, const char *msgid, ...)
ATTRIBUTE_PRINTF_5;
extern void cpp_error_with_line (cpp_reader *, int, fileline, unsigned,
const char *msgid, ...) ATTRIBUTE_PRINTF_5;
/* In cpplex.c */
extern int cpp_ideq (const cpp_token *, const char *);
......
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