From: bothner Date: Thu, 15 Jul 2004 00:02:30 +0000 (+0000) Subject: * input.h: If USE_MAPPED_LOCATION, define separate expanded_location X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=a59d74d6d29d5e999fe3c5ecda89593a88bbcd79 * input.h: If USE_MAPPED_LOCATION, define separate expanded_location structure with extra column field. * tree.c (expand_location): Also fill in column field. * gengtype-lex.l: Ignore expanded_location typedef, sinze gengtype gets confused by the two conditionally-compiled definitions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84721 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f4c6c040b0..cb26f13af36 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-07-14 Per Bothner + + * input.h: If USE_MAPPED_LOCATION, define separate expanded_location + structure with extra column field. + * tree.c (expand_location): Also fill in column field. + * gengtype-lex.l: Ignore expanded_location typedef, sinze gengtype + gets confused by the two conditionally-compiled definitions. + 2004-07-14 Eric Christopher * calls.c (expand_call): Fix typo in comment. diff --git a/gcc/gengtype-lex.l b/gcc/gengtype-lex.l index 22a5cd8ee0f..60b738eadce 100644 --- a/gcc/gengtype-lex.l +++ b/gcc/gengtype-lex.l @@ -91,7 +91,8 @@ ITYPE {IWORD}({WS}{IWORD})* namestart = xmemdup (namestart, namelen, namelen+1); #ifdef USE_MAPPED_LOCATION /* temporary kludge - gentype doesn't handle cpp conditionals */ - if (strcmp (namestart, "location_t") != 0) + if (strcmp (namestart, "location_t") != 0 + && strcmp (namestart, "expanded_location") != 0) #endif do_typedef (namestart, t, &lexer_line); update_lineno (yytext, yyleng); diff --git a/gcc/input.h b/gcc/input.h index f34c74e908a..f15ce6688bf 100644 --- a/gcc/input.h +++ b/gcc/input.h @@ -28,7 +28,9 @@ extern struct line_maps line_table; /* The location for declarations in "" */ #define BUILTINS_LOCATION ((source_location) 2) -typedef struct location_s GTY(()) +#ifdef USE_MAPPED_LOCATION + +typedef struct { /* The name of the source file involved. */ const char *file; @@ -36,11 +38,9 @@ typedef struct location_s GTY(()) /* The line-location in the source file. */ int line; - /* FUTURE (but confuses gentype): int column. */ + int column; } expanded_location; -#ifdef USE_MAPPED_LOCATION - extern expanded_location expand_location (source_location); #define UNKNOWN_LOCATION ((source_location) 0) @@ -49,6 +49,16 @@ typedef source_location source_locus; /* to be removed */ #else /* ! USE_MAPPED_LOCATION */ +struct location_s GTY(()) +{ + /* The name of the source file involved. */ + const char *file; + + /* The line-location in the source file. */ + int line; +}; + +typedef struct location_s expanded_location; typedef struct location_s location_t; typedef location_t *source_locus; diff --git a/gcc/tree.c b/gcc/tree.c index 09a96330463..8066cd100ff 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2760,12 +2760,13 @@ expanded_location expand_location (source_location loc) { expanded_location xloc; - if (loc == 0) { xloc.file = NULL; xloc.line = 0; } + if (loc == 0) { xloc.file = NULL; xloc.line = 0; xloc.column = 0; } else { const struct line_map *map = linemap_lookup (&line_table, loc); xloc.file = map->to_file; xloc.line = SOURCE_LINE (map, loc); + xloc.column = SOURCE_COLUMN (map, loc); }; return xloc; }