aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlex.l
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-10-20 13:49:00 +0000
committerAlan Modra <amodra@gmail.com>2001-10-20 13:49:00 +0000
commitb47c42085628603e890a783b8d2a612d19f66396 (patch)
tree8ce3bd00189f2d2b7172db7735c5f7587b9e1fb9 /ld/ldlex.l
parentfd521b4750cb0df1c841700637de89a7b25cccf3 (diff)
downloadfsf-binutils-gdb-b47c42085628603e890a783b8d2a612d19f66396.zip
fsf-binutils-gdb-b47c42085628603e890a783b8d2a612d19f66396.tar.gz
fsf-binutils-gdb-b47c42085628603e890a783b8d2a612d19f66396.tar.bz2
* ldgram.y (mri_script_command): Surround processing of INCLUDE
with ldlex_script, ldlex_popstate. (ifile_p1): Likewise. * ldlex.l (EOF): Don't BEGIN(SCRIPT). Restore lineno from the correct slot. (lex_push_file): Save current lineno to lineno_stack. Set lineno to 1. Don't BEGIN(SCRIPT). (lex_redirect): Similarly. * ldmain.c (main): Set yydebug non-zero if YYDEBUG.
Diffstat (limited to 'ld/ldlex.l')
-rw-r--r--ld/ldlex.l13
1 files changed, 6 insertions, 7 deletions
diff --git a/ld/ldlex.l b/ld/ldlex.l
index b43cfa3..95a31f5 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -418,11 +418,10 @@ V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
else
{
yy_switch_to_buffer(include_stack[include_stack_ptr]);
-
}
- BEGIN(SCRIPT);
+
ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
- lineno = lineno_stack[include_stack_ptr - 1];
+ lineno = lineno_stack[include_stack_ptr];
return END;
}
@@ -446,13 +445,13 @@ lex_push_file (file, name)
einfo("%F:includes nested too deeply\n");
}
file_name_stack[include_stack_ptr] = name;
- lineno_stack[include_stack_ptr] = 1;
+ lineno_stack[include_stack_ptr] = lineno;
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
include_stack_ptr++;
+ lineno = 1;
yyin = file;
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- BEGIN (SCRIPT);
}
/* Return a newly created flex input buffer containing STRING,
@@ -512,12 +511,12 @@ lex_redirect (string)
einfo("%F: macros nested too deeply\n");
}
file_name_stack[include_stack_ptr] = "redirect";
- lineno_stack[include_stack_ptr] = 0;
+ lineno_stack[include_stack_ptr] = lineno;
include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
include_stack_ptr++;
+ lineno = 1;
tmp = yy_create_string_buffer (string, strlen (string));
yy_switch_to_buffer (tmp);
- BEGIN (SCRIPT);
}
/* Functions to switch to a different flex start condition,