Commit aa3c6dc1 by Per Bothner Committed by Per Bothner

input.h: If USE_MAPPED_LOCATION...


	* 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.

From-SVN: r84721
parent 368b7a30
2004-07-14 Per Bothner <per@bothner.com>
* 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 <echristo@redhat.com> 2004-07-14 Eric Christopher <echristo@redhat.com>
* calls.c (expand_call): Fix typo in comment. * calls.c (expand_call): Fix typo in comment.
......
...@@ -91,7 +91,8 @@ ITYPE {IWORD}({WS}{IWORD})* ...@@ -91,7 +91,8 @@ ITYPE {IWORD}({WS}{IWORD})*
namestart = xmemdup (namestart, namelen, namelen+1); namestart = xmemdup (namestart, namelen, namelen+1);
#ifdef USE_MAPPED_LOCATION #ifdef USE_MAPPED_LOCATION
/* temporary kludge - gentype doesn't handle cpp conditionals */ /* 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 #endif
do_typedef (namestart, t, &lexer_line); do_typedef (namestart, t, &lexer_line);
update_lineno (yytext, yyleng); update_lineno (yytext, yyleng);
......
...@@ -28,7 +28,9 @@ extern struct line_maps line_table; ...@@ -28,7 +28,9 @@ extern struct line_maps line_table;
/* The location for declarations in "<built-in>" */ /* The location for declarations in "<built-in>" */
#define BUILTINS_LOCATION ((source_location) 2) #define BUILTINS_LOCATION ((source_location) 2)
typedef struct location_s GTY(()) #ifdef USE_MAPPED_LOCATION
typedef struct
{ {
/* The name of the source file involved. */ /* The name of the source file involved. */
const char *file; const char *file;
...@@ -36,11 +38,9 @@ typedef struct location_s GTY(()) ...@@ -36,11 +38,9 @@ typedef struct location_s GTY(())
/* The line-location in the source file. */ /* The line-location in the source file. */
int line; int line;
/* FUTURE (but confuses gentype): int column. */ int column;
} expanded_location; } expanded_location;
#ifdef USE_MAPPED_LOCATION
extern expanded_location expand_location (source_location); extern expanded_location expand_location (source_location);
#define UNKNOWN_LOCATION ((source_location) 0) #define UNKNOWN_LOCATION ((source_location) 0)
...@@ -49,6 +49,16 @@ typedef source_location source_locus; /* to be removed */ ...@@ -49,6 +49,16 @@ typedef source_location source_locus; /* to be removed */
#else /* ! USE_MAPPED_LOCATION */ #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 struct location_s location_t;
typedef location_t *source_locus; typedef location_t *source_locus;
......
...@@ -2760,12 +2760,13 @@ expanded_location ...@@ -2760,12 +2760,13 @@ expanded_location
expand_location (source_location loc) expand_location (source_location loc)
{ {
expanded_location xloc; 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 else
{ {
const struct line_map *map = linemap_lookup (&line_table, loc); const struct line_map *map = linemap_lookup (&line_table, loc);
xloc.file = map->to_file; xloc.file = map->to_file;
xloc.line = SOURCE_LINE (map, loc); xloc.line = SOURCE_LINE (map, loc);
xloc.column = SOURCE_COLUMN (map, loc);
}; };
return xloc; return xloc;
} }
......
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