summaryrefslogtreecommitdiff
path: root/ld/ldlex.l
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-10-20 13:49:00 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-10-20 13:49:00 +0000
commitc377c93bc762f8cbd46c8e6bb13313b5a2dc4ae4 (patch)
tree8791ad68978a07e7d8d8bc5a33ab536409648209 /ld/ldlex.l
parentc4b74e94bf6ecadf739c64007f119f853caabccd (diff)
downloadbinutils-redhat-c377c93bc762f8cbd46c8e6bb13313b5a2dc4ae4.tar.gz
* 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 b43cfa3187..95a31f5a64 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,