fixed bug with undefined structs
ceriel changed debugging information
This commit is contained in:
parent
7e58923415
commit
c3f305bea1
4 changed files with 49 additions and 14 deletions
|
@ -195,6 +195,10 @@ ch3cast(expp, oper, tp)
|
||||||
string2pointer(*expp);
|
string2pointer(*expp);
|
||||||
oldtp = (*expp)->ex_type;
|
oldtp = (*expp)->ex_type;
|
||||||
|
|
||||||
|
if (oldtp->tp_size <= 0) {
|
||||||
|
expr_error(*expp,"incomplete type in expression");
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NOBITFIELD
|
#ifndef NOBITFIELD
|
||||||
if (oldtp->tp_fund == FIELD) {
|
if (oldtp->tp_fund == FIELD) {
|
||||||
field2arith(expp);
|
field2arith(expp);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "specials.h"
|
#include "specials.h"
|
||||||
#include "atw.h"
|
#include "atw.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "file_info.h"
|
#include "LLlex.h"
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
#include "l_lint.h"
|
#include "l_lint.h"
|
||||||
#endif LINT
|
#endif LINT
|
||||||
|
@ -267,8 +267,12 @@ begin_proc(ds, idf) /* to be called when entering a procedure */
|
||||||
C_insertpart(pro_id = C_getid());
|
C_insertpart(pro_id = C_getid());
|
||||||
#endif
|
#endif
|
||||||
if (is_struct_or_union(func_type->tp_fund)) {
|
if (is_struct_or_union(func_type->tp_fund)) {
|
||||||
C_df_dlb(func_res_label = data_label());
|
if (func_size <= 0) {
|
||||||
C_bss_cst(func_size, (arith)0, 1);
|
error("unknown return type for function %s", name);
|
||||||
|
} else {
|
||||||
|
C_df_dlb(func_res_label = data_label());
|
||||||
|
C_bss_cst(func_size, (arith)0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
func_res_label = 0;
|
func_res_label = 0;
|
||||||
|
@ -383,6 +387,9 @@ do_return()
|
||||||
probably smarter than generating a direct return.
|
probably smarter than generating a direct return.
|
||||||
Return sequences may be expensive.
|
Return sequences may be expensive.
|
||||||
*/
|
*/
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(dot.tk_file, dot.tk_line);
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
C_bra(return2_label);
|
C_bra(return2_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +451,6 @@ code_declaration(idf, expr, lvl, sc)
|
||||||
/* is this an allocating declaration? */
|
/* is this an allocating declaration? */
|
||||||
if ( (sc == 0 || sc == STATIC)
|
if ( (sc == 0 || sc == STATIC)
|
||||||
&& fund != FUNCTION
|
&& fund != FUNCTION
|
||||||
&& size >= 0
|
|
||||||
)
|
)
|
||||||
def->df_alloc = ALLOC_SEEN;
|
def->df_alloc = ALLOC_SEEN;
|
||||||
if (expr && def_sc == STATIC && sc == EXTERN) {
|
if (expr && def_sc == STATIC && sc == EXTERN) {
|
||||||
|
@ -609,8 +615,13 @@ bss(idf)
|
||||||
stb_string(df, df->df_sc, idf->id_text);
|
stb_string(df, df->df_sc, idf->id_text);
|
||||||
}
|
}
|
||||||
#endif /* DBSYMTAB */
|
#endif /* DBSYMTAB */
|
||||||
C_df_dnam(idf->id_text);
|
if (df->df_type->tp_size <= 0) {
|
||||||
C_bss_cst(ATW(df->df_type->tp_size), (arith)0, 1);
|
error("size of %s unknown (\"%s\", line %d)"
|
||||||
|
, idf->id_text, df->df_file, df->df_line);
|
||||||
|
} else {
|
||||||
|
C_df_dnam(idf->id_text);
|
||||||
|
C_bss_cst(ATW(df->df_type->tp_size), (arith)0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formal_cvt(hasproto,df)
|
formal_cvt(hasproto,df)
|
||||||
|
@ -655,7 +666,7 @@ code_expr(expr, val, code, tlbl, flbl)
|
||||||
if (! options['L']) /* profiling */
|
if (! options['L']) /* profiling */
|
||||||
C_lin((arith)(expr->ex_line));
|
C_lin((arith)(expr->ex_line));
|
||||||
#ifdef DBSYMTAB
|
#ifdef DBSYMTAB
|
||||||
if (options['g']) db_line(expr->ex_file, (int)expr->ex_line);
|
if (options['g']) db_line(expr->ex_file, (unsigned int)expr->ex_line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EVAL(expr, val, code, tlbl, flbl);
|
EVAL(expr, val, code, tlbl, flbl);
|
||||||
|
@ -683,6 +694,9 @@ code_break()
|
||||||
{
|
{
|
||||||
register struct stmt_block *stmt_block = stmt_stack;
|
register struct stmt_block *stmt_block = stmt_stack;
|
||||||
|
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(dot.tk_file, dot.tk_line);
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
if (stmt_block)
|
if (stmt_block)
|
||||||
C_bra(stmt_block->st_break);
|
C_bra(stmt_block->st_break);
|
||||||
else
|
else
|
||||||
|
@ -700,6 +714,9 @@ code_continue()
|
||||||
|
|
||||||
while (stmt_block) {
|
while (stmt_block) {
|
||||||
if (stmt_block->st_continue) {
|
if (stmt_block->st_continue) {
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g']) db_line(dot.tk_file, dot.tk_line);
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
C_bra(stmt_block->st_continue);
|
C_bra(stmt_block->st_continue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -754,16 +771,16 @@ prc_exit()
|
||||||
|
|
||||||
#ifdef DBSYMTAB
|
#ifdef DBSYMTAB
|
||||||
db_line(file, line)
|
db_line(file, line)
|
||||||
char *file;
|
char *file;
|
||||||
int line;
|
unsigned int line;
|
||||||
{
|
{
|
||||||
static int oldline;
|
static unsigned oldline;
|
||||||
static char *oldfile;
|
static char *oldfile;
|
||||||
|
|
||||||
if (file != oldfile || line != oldline) {
|
if (file != oldfile || line != oldline) {
|
||||||
C_ms_std((char *) 0, N_SLINE, line);
|
C_ms_std((char *) 0, N_SLINE, (int) line);
|
||||||
oldline = line;
|
oldline = line;
|
||||||
oldfile = file;
|
oldfile = file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* DBSYMTAB */
|
||||||
|
|
|
@ -264,6 +264,11 @@ initializer(struct idf *idf; int sc;)
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
change_state(idf, SET);
|
change_state(idf, SET);
|
||||||
#endif LINT
|
#endif LINT
|
||||||
|
#ifdef DBSYMTAB
|
||||||
|
if (options['g'] && level >= L_LOCAL && expr) {
|
||||||
|
db_line(expr->ex_file, (int) expr->ex_line);
|
||||||
|
}
|
||||||
|
#endif /* DBSYMTAB */
|
||||||
if (autoagg)
|
if (autoagg)
|
||||||
loc_init((struct expr *) 0, idf);
|
loc_init((struct expr *) 0, idf);
|
||||||
else code_declaration(idf, expr, level, sc);
|
else code_declaration(idf, expr, level, sc);
|
||||||
|
|
|
@ -59,9 +59,18 @@ stack_idf(idf, stl)
|
||||||
struct idf *idf;
|
struct idf *idf;
|
||||||
register struct stack_level *stl;
|
register struct stack_level *stl;
|
||||||
{
|
{
|
||||||
/* The identifier idf is inserted in the stack on level stl.
|
/* The identifier idf is inserted in the stack on level stl,
|
||||||
|
but only if it is not already present at this level.
|
||||||
*/
|
*/
|
||||||
register struct stack_entry *se = new_stack_entry();
|
register struct stack_entry *se;
|
||||||
|
|
||||||
|
se = stl->sl_entry;
|
||||||
|
while (se) {
|
||||||
|
if (se->se_idf == idf) return;
|
||||||
|
se = se->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
se = new_stack_entry();
|
||||||
|
|
||||||
/* link it into the stack level */
|
/* link it into the stack level */
|
||||||
se->next = stl->sl_entry;
|
se->next = stl->sl_entry;
|
||||||
|
|
Loading…
Reference in a new issue