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:
parent
e24313f349
commit
1bb64668d0
10 changed files with 58 additions and 34 deletions
|
@ -32,7 +32,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
|||
struct if_stack
|
||||
{
|
||||
struct if_stack *next;
|
||||
unsigned int line; /* Line where condition started. */
|
||||
linenum_type line; /* Line where condition started. */
|
||||
const cpp_hashnode *mi_cmacro;/* macro name for #ifndef around entire file */
|
||||
bool skip_elses; /* Can future #else / #elif be skipped? */
|
||||
bool was_skipping; /* If were skipping on entry. */
|
||||
|
@ -102,7 +102,7 @@ static char *glue_header_name (cpp_reader *);
|
|||
static const char *parse_include (cpp_reader *, int *, const cpp_token ***);
|
||||
static void push_conditional (cpp_reader *, int, int, const cpp_hashnode *);
|
||||
static unsigned int read_flag (cpp_reader *, unsigned int);
|
||||
static int strtoul_for_line (const uchar *, unsigned int, unsigned long *);
|
||||
static int strtolinenum (const uchar *, unsigned int, linenum_type *);
|
||||
static void do_diagnostic (cpp_reader *, int, int);
|
||||
static cpp_hashnode *lex_macro_node (cpp_reader *, bool);
|
||||
static int undefine_macros (cpp_reader *, cpp_hashnode *, void *);
|
||||
|
@ -840,9 +840,9 @@ read_flag (cpp_reader *pfile, unsigned int last)
|
|||
of length LEN, to binary; store it in NUMP, and return 0 if the
|
||||
number was well-formed, 1 if not. Temporary, hopefully. */
|
||||
static int
|
||||
strtoul_for_line (const uchar *str, unsigned int len, long unsigned int *nump)
|
||||
strtolinenum (const uchar *str, unsigned int len, linenum_type *nump)
|
||||
{
|
||||
unsigned long reg = 0;
|
||||
linenum_type reg = 0;
|
||||
uchar c;
|
||||
while (len--)
|
||||
{
|
||||
|
@ -871,16 +871,16 @@ do_line (cpp_reader *pfile)
|
|||
unsigned char map_sysp = map->sysp;
|
||||
const cpp_token *token;
|
||||
const char *new_file = map->to_file;
|
||||
unsigned long new_lineno;
|
||||
linenum_type new_lineno;
|
||||
|
||||
/* C99 raised the minimum limit on #line numbers. */
|
||||
unsigned int cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
|
||||
linenum_type cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
|
||||
|
||||
/* #line commands expand macros. */
|
||||
token = cpp_get_token (pfile);
|
||||
if (token->type != CPP_NUMBER
|
||||
|| strtoul_for_line (token->val.str.text, token->val.str.len,
|
||||
&new_lineno))
|
||||
|| strtolinenum (token->val.str.text, token->val.str.len,
|
||||
&new_lineno))
|
||||
{
|
||||
if (token->type == CPP_EOF)
|
||||
cpp_error (pfile, CPP_DL_ERROR, "unexpected end of file after #line");
|
||||
|
@ -925,7 +925,7 @@ do_linemarker (cpp_reader *pfile)
|
|||
const struct line_map *map = &line_table->maps[line_table->used - 1];
|
||||
const cpp_token *token;
|
||||
const char *new_file = map->to_file;
|
||||
unsigned long new_lineno;
|
||||
linenum_type new_lineno;
|
||||
unsigned int new_sysp = map->sysp;
|
||||
enum lc_reason reason = LC_RENAME;
|
||||
int flag;
|
||||
|
@ -938,8 +938,8 @@ do_linemarker (cpp_reader *pfile)
|
|||
/* #line commands expand macros. */
|
||||
token = cpp_get_token (pfile);
|
||||
if (token->type != CPP_NUMBER
|
||||
|| strtoul_for_line (token->val.str.text, token->val.str.len,
|
||||
&new_lineno))
|
||||
|| strtolinenum (token->val.str.text, token->val.str.len,
|
||||
&new_lineno))
|
||||
{
|
||||
/* Unlike #line, there does not seem to be a way to get an EOF
|
||||
here. So, it should be safe to always spell the token. */
|
||||
|
@ -999,7 +999,7 @@ do_linemarker (cpp_reader *pfile)
|
|||
and zero otherwise. */
|
||||
void
|
||||
_cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason,
|
||||
const char *to_file, unsigned int file_line,
|
||||
const char *to_file, linenum_type file_line,
|
||||
unsigned int sysp)
|
||||
{
|
||||
const struct line_map *map = linemap_add (pfile->line_table, reason, sysp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue