fixed bug with undefined structs

ceriel changed debugging information
This commit is contained in:
eck 1990-10-19 11:21:43 +00:00
parent 7e58923415
commit c3f305bea1
4 changed files with 49 additions and 14 deletions

View file

@ -195,6 +195,10 @@ ch3cast(expp, oper, tp)
string2pointer(*expp);
oldtp = (*expp)->ex_type;
if (oldtp->tp_size <= 0) {
expr_error(*expp,"incomplete type in expression");
}
#ifndef NOBITFIELD
if (oldtp->tp_fund == FIELD) {
field2arith(expp);

View file

@ -31,7 +31,7 @@
#include "specials.h"
#include "atw.h"
#include "assert.h"
#include "file_info.h"
#include "LLlex.h"
#ifdef LINT
#include "l_lint.h"
#endif LINT
@ -267,8 +267,12 @@ begin_proc(ds, idf) /* to be called when entering a procedure */
C_insertpart(pro_id = C_getid());
#endif
if (is_struct_or_union(func_type->tp_fund)) {
C_df_dlb(func_res_label = data_label());
C_bss_cst(func_size, (arith)0, 1);
if (func_size <= 0) {
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
func_res_label = 0;
@ -383,6 +387,9 @@ do_return()
probably smarter than generating a direct return.
Return sequences may be expensive.
*/
#ifdef DBSYMTAB
if (options['g']) db_line(dot.tk_file, dot.tk_line);
#endif /* DBSYMTAB */
C_bra(return2_label);
}
@ -444,7 +451,6 @@ code_declaration(idf, expr, lvl, sc)
/* is this an allocating declaration? */
if ( (sc == 0 || sc == STATIC)
&& fund != FUNCTION
&& size >= 0
)
def->df_alloc = ALLOC_SEEN;
if (expr && def_sc == STATIC && sc == EXTERN) {
@ -609,8 +615,13 @@ bss(idf)
stb_string(df, df->df_sc, idf->id_text);
}
#endif /* DBSYMTAB */
C_df_dnam(idf->id_text);
C_bss_cst(ATW(df->df_type->tp_size), (arith)0, 1);
if (df->df_type->tp_size <= 0) {
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)
@ -655,7 +666,7 @@ code_expr(expr, val, code, tlbl, flbl)
if (! options['L']) /* profiling */
C_lin((arith)(expr->ex_line));
#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
EVAL(expr, val, code, tlbl, flbl);
@ -683,6 +694,9 @@ code_break()
{
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)
C_bra(stmt_block->st_break);
else
@ -700,6 +714,9 @@ code_continue()
while (stmt_block) {
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);
return;
}
@ -754,16 +771,16 @@ prc_exit()
#ifdef DBSYMTAB
db_line(file, line)
char *file;
int line;
char *file;
unsigned int line;
{
static int oldline;
static unsigned oldline;
static char *oldfile;
if (file != oldfile || line != oldline) {
C_ms_std((char *) 0, N_SLINE, line);
C_ms_std((char *) 0, N_SLINE, (int) line);
oldline = line;
oldfile = file;
}
}
#endif
#endif /* DBSYMTAB */

View file

@ -264,6 +264,11 @@ initializer(struct idf *idf; int sc;)
#ifdef LINT
change_state(idf, SET);
#endif LINT
#ifdef DBSYMTAB
if (options['g'] && level >= L_LOCAL && expr) {
db_line(expr->ex_file, (int) expr->ex_line);
}
#endif /* DBSYMTAB */
if (autoagg)
loc_init((struct expr *) 0, idf);
else code_declaration(idf, expr, level, sc);

View file

@ -59,9 +59,18 @@ stack_idf(idf, stl)
struct idf *idf;
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 */
se->next = stl->sl_entry;