line-map.h (linenum_type): New typedef.

2008-07-21  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	* include/line-map.h (linenum_type): New typedef.
	(struct line_map): Use it.
	(SOURCE_LINE): Second arguments is a LOCATION not a LINE.
	(SOURCE_COLUMN): Likewise.
	* macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store
	source_location values in a variable of type linenum_type.
	* directives.c (struct if_stack): Use linenum_type.
	(strtoul_for_line): Rename as strtolinenum.
	(do_line): Use linenum_type.
	(do_linemarker): Use linenum_type and strtolinenum.
	(_cpp_do_file_change): Use linenum_t.
	* line-map.c (linemap_add): Likewise.
	(linemap_line_start): Likewise.
	* traditional.c (struct fun_macro): 'line' is a source_location.
	* errors.c (print_location): Use linenum_type.
	* directives-only.c (_cpp_preprocess_dir_only): Likewise.
	* internal.h (CPP_INCREMENT_LINE): Likewise.
	* lex.c (_cpp_skip_block_comment): Use source_location.

From-SVN: r138026
This commit is contained in:
Manuel López-Ibáñez 2008-07-21 09:33:38 +00:00
parent e24313f349
commit 1bb64668d0
10 changed files with 58 additions and 34 deletions

View file

@ -118,7 +118,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
{
const struct line_map *map;
const uchar *result = NULL;
unsigned int number = 1;
linenum_type number = 1;
switch (node->value.builtin)
{
@ -200,11 +200,10 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
/* If __LINE__ is embedded in a macro, it must expand to the
line of the macro's invocation, not its definition.
Otherwise things like assert() will not work properly. */
if (CPP_OPTION (pfile, traditional))
number = pfile->line_table->highest_line;
else
number = pfile->cur_token[-1].src_loc;
number = SOURCE_LINE (map, number);
number = SOURCE_LINE (map,
CPP_OPTION (pfile, traditional)
? pfile->line_table->highest_line
: pfile->cur_token[-1].src_loc);
break;
/* __STDC__ has the value 1 under normal circumstances.