fixed 2 bugs with line directives
This commit is contained in:
parent
197379a33a
commit
5625842582
2 changed files with 12 additions and 3 deletions
|
@ -183,7 +183,7 @@ static label return_label, return2_label;
|
||||||
static char return_expr_occurred;
|
static char return_expr_occurred;
|
||||||
static arith func_size;
|
static arith func_size;
|
||||||
static label func_res_label;
|
static label func_res_label;
|
||||||
static char *last_fn_given = "";
|
static char *last_fn_given = (char *)0;
|
||||||
static label file_name_label;
|
static label file_name_label;
|
||||||
|
|
||||||
begin_proc(ds, idf) /* to be called when entering a procedure */
|
begin_proc(ds, idf) /* to be called when entering a procedure */
|
||||||
|
@ -244,7 +244,7 @@ begin_proc(ds, idf) /* to be called when entering a procedure */
|
||||||
LocalInit();
|
LocalInit();
|
||||||
prc_entry(name);
|
prc_entry(name);
|
||||||
if (! options['L']) { /* profiling */
|
if (! options['L']) { /* profiling */
|
||||||
if (strcmp(last_fn_given, FileName) != 0) {
|
if (!last_fn_given || strcmp(last_fn_given, FileName) != 0) {
|
||||||
/* previous function came from other file */
|
/* previous function came from other file */
|
||||||
C_df_dlb(file_name_label = data_label());
|
C_df_dlb(file_name_label = data_label());
|
||||||
C_con_scon(last_fn_given = FileName,
|
C_con_scon(last_fn_given = FileName,
|
||||||
|
|
|
@ -762,6 +762,7 @@ do_line(l)
|
||||||
{
|
{
|
||||||
struct token tk;
|
struct token tk;
|
||||||
int t = GetToken(&tk);
|
int t = GetToken(&tk);
|
||||||
|
static char *saved_name = (char *)0;
|
||||||
|
|
||||||
SkipToNewLine();
|
SkipToNewLine();
|
||||||
LineNumber = l; /* the number of the next input line */
|
LineNumber = l; /* the number of the next input line */
|
||||||
|
@ -769,7 +770,15 @@ do_line(l)
|
||||||
extern char *source; /* defined in main.c */
|
extern char *source; /* defined in main.c */
|
||||||
|
|
||||||
if (FileName != source) { /* source points into argv */
|
if (FileName != source) { /* source points into argv */
|
||||||
free(FileName);
|
/* Since we are looking one token ahead, we can't
|
||||||
|
* free the string when it is mentioned in dot.
|
||||||
|
*/
|
||||||
|
if (dot.tok_file != FileName) {
|
||||||
|
free(FileName);
|
||||||
|
} else if (dot.tok_file != saved_name) {
|
||||||
|
if (saved_name) free(saved_name);
|
||||||
|
saved_name = dot.tok_file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FileName = tk.tk_bts;
|
FileName = tk.tk_bts;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue