aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2005-03-12 06:37:46 +0000
committerPer Bothner <per@bothner.com>2005-03-12 06:37:46 +0000
commit911f612bfeaa9af93ebfcc4ee2af37d6b92f5837 (patch)
tree65b4a8dab5e3ade6d18469d0c871b15a2a066e5a /gcc/c-lex.c
parent624429b871171f7f4bab9f7959ff7669801cbb7d (diff)
* c-tree.h (struct c_declarator): New id_loc field.
* c-pragma.h (c_lex_with_flags): Take position reference. * c-lex.c (c_lex_with_flags): Set passed-in location from cpp token, iff USE_MAPPED_LOCATION. (Type doesn't match otherwise.) (c_lex): Pass dummy location to c_lex_with_flags. * c-parser.c (c_lex_one_token): Set c_token's location using c_lex_with_flags, instead of input_location, which might be "ahead". (c_parser_direct_declarator): Set declarator's id_loc from c_token's id_loc. * c-decl.c (grokdeclarator): Set DECL_SOURCE_LOCATION from declarator's id_loc, rather than probably-imprecise input_location. (build_id_declarator): Initialize c_declarator's id_loc field. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@96329 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index f5425ce49e9..fdc1ff6e311 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -332,7 +332,7 @@ cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
non-NULL. */
enum cpp_ttype
-c_lex_with_flags (tree *value, unsigned char *cpp_flags)
+c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
{
static bool no_more_pch;
const cpp_token *tok;
@@ -344,6 +344,11 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
type = tok->type;
retry_after_at:
+#ifdef USE_MAPPED_LOCATION
+ *loc = tok->src_loc;
+#else
+ *loc = input_location;
+#endif
switch (type)
{
case CPP_PADDING:
@@ -487,7 +492,8 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
enum cpp_ttype
c_lex (tree *value)
{
- return c_lex_with_flags (value, NULL);
+ location_t loc;
+ return c_lex_with_flags (value, &loc, NULL);
}
/* Returns the narrowest C-visible unsigned type, starting with the