lint update (merge from C compiler)
This commit is contained in:
parent
d9be4de96a
commit
495a037714
23 changed files with 869 additions and 504 deletions
|
@ -56,7 +56,7 @@ l_brace.str
|
|||
l_class.h
|
||||
l_comment.h
|
||||
l_comment.c
|
||||
l_dummy.c
|
||||
l_em.h
|
||||
l_ev_ord.c
|
||||
l_lint.c
|
||||
l_lint.h
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
!File: lint.h
|
||||
#define LINT 1 /* if defined, 'lint' is produced */
|
||||
#define ANSI 1 /* tell l_* files it's ANSI */
|
||||
|
||||
|
||||
!File: pathlength.h
|
||||
|
@ -22,7 +23,8 @@
|
|||
|
||||
|
||||
!File: nparams.h
|
||||
#define NPARAMS 32 /* maximum number of parameters of macros */
|
||||
#define NPARAMS 32 /* maximum number of parameters */
|
||||
#define STDC_NPARAMS 31 /* ANSI limit on number of parameters */
|
||||
|
||||
|
||||
!File: ifdepth.h
|
||||
|
@ -33,14 +35,15 @@
|
|||
#define DENSITY 2 /* see switch.[ch] for an explanation */
|
||||
|
||||
|
||||
!File: lapbuf.h
|
||||
#define LAPBUF 4096 /* size of macro actual parameter buffer */
|
||||
!File: macbuf.h
|
||||
#define LAPBUF 128 /* initial size of macro replacement buffer */
|
||||
#define ARGBUF 128 /* initial size of macro parameter buffer(s) */
|
||||
|
||||
|
||||
!File: strsize.h
|
||||
#define ISTRSIZE 32 /* minimum number of bytes allocated for
|
||||
storing a string */
|
||||
#define RSTRSIZE 8 /* step size in enlarging the memory for
|
||||
#define RSTRSIZE 16 /* step size in enlarging the memory for
|
||||
the storage of a string */
|
||||
|
||||
|
||||
|
@ -56,6 +59,7 @@
|
|||
#define SZ_FLOAT 4
|
||||
#define SZ_DOUBLE 8
|
||||
#define SZ_POINTER 4
|
||||
#define SZ_LNGDBL 8 /* for now */
|
||||
|
||||
/* target machine alignment requirements */
|
||||
#define AL_CHAR 1
|
||||
|
@ -65,6 +69,7 @@
|
|||
#define AL_LONG SZ_WORD
|
||||
#define AL_FLOAT SZ_WORD
|
||||
#define AL_DOUBLE SZ_WORD
|
||||
#define AL_LNGDBL SZ_WORD
|
||||
#define AL_POINTER SZ_WORD
|
||||
#define AL_STRUCT 1
|
||||
#define AL_UNION 1
|
||||
|
@ -99,7 +104,7 @@
|
|||
|
||||
|
||||
!File: textsize.h
|
||||
#define ITEXTSIZE 16 /* 1st piece of memory for repl. text */
|
||||
#define ITEXTSIZE 32 /* 1st piece of memory for repl. text */
|
||||
|
||||
|
||||
!File: inputtype.h
|
||||
|
@ -117,6 +122,7 @@
|
|||
!File: spec_arith.h
|
||||
/* describes internal compiler arithmetics */
|
||||
#undef SPECIAL_ARITHMETICS /* something different from native long */
|
||||
#undef UNSIGNED_ARITH unsigned arith
|
||||
|
||||
|
||||
!File: static.h
|
||||
|
|
|
@ -84,7 +84,7 @@ CSRC = main.c idf.c declarator.c decspecs.c struct.c \
|
|||
skip.c stack.c type.c ch3mon.c label.c eval.c \
|
||||
switch.c conversion.c util.c proto.c \
|
||||
pragma.c blocks.c dataflow.c Version.c stab.c\
|
||||
l_lint.c l_states.c l_misc.c l_ev_ord.c l_outdef.c l_comment.c l_dummy.c
|
||||
l_lint.c l_states.c l_misc.c l_ev_ord.c l_outdef.c l_comment.c
|
||||
COBJ = main.o idf.o declarator.o decspecs.o struct.o \
|
||||
expr.o ch3.o ch3bin.o cstoper.o fltcstoper.o arith.o \
|
||||
code.o dumpidf.o error.o field.o\
|
||||
|
@ -93,7 +93,7 @@ COBJ = main.o idf.o declarator.o decspecs.o struct.o \
|
|||
skip.o stack.o type.o ch3mon.o label.o eval.o \
|
||||
switch.o conversion.o util.o proto.o \
|
||||
pragma.o blocks.o dataflow.o Version.o stab.o \
|
||||
l_lint.o l_states.o l_misc.o l_ev_ord.o l_outdef.o l_comment.o l_dummy.o
|
||||
l_lint.o l_states.o l_misc.o l_ev_ord.o l_outdef.o l_comment.o
|
||||
|
||||
# Objects of other generated C files
|
||||
GCSRC = char.c symbol2str.c next.c
|
||||
|
@ -123,8 +123,8 @@ GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \
|
|||
regcount.h
|
||||
|
||||
HSRC = LLlex.h align.h arith.h assert.h atw.h class.h \
|
||||
input.h label.h level.h mes.h sizes.h specials.h \
|
||||
file_info.h tokenname.h l_lint.h
|
||||
input.h interface.h label.h level.h mes.h sizes.h specials.h \
|
||||
file_info.h tokenname.h l_em.h l_lint.h
|
||||
|
||||
HFILES = $(HSRC) $(GHSRC) $(GHSTRSRC)
|
||||
|
||||
|
@ -496,6 +496,7 @@ arith.o: sizes.h
|
|||
arith.o: spec_arith.h
|
||||
arith.o: trgt_sizes.h
|
||||
arith.o: type.h
|
||||
code.o: LLlex.h
|
||||
code.o: Lpars.h
|
||||
code.o: arith.h
|
||||
code.o: assert.h
|
||||
|
@ -508,6 +509,7 @@ code.o: debug.h
|
|||
code.o: declar.h
|
||||
code.o: decspecs.h
|
||||
code.o: def.h
|
||||
code.o: l_em.h
|
||||
code.o: expr.h
|
||||
code.o: file_info.h
|
||||
code.o: idf.h
|
||||
|
@ -549,6 +551,7 @@ error.o: LLlex.h
|
|||
error.o: arith.h
|
||||
error.o: debug.h
|
||||
error.o: def.h
|
||||
error.o: l_em.h
|
||||
error.o: errout.h
|
||||
error.o: expr.h
|
||||
error.o: file_info.h
|
||||
|
@ -611,6 +614,7 @@ LLmessage.o: file_info.h
|
|||
LLmessage.o: idf.h
|
||||
LLmessage.o: nopp.h
|
||||
LLmessage.o: spec_arith.h
|
||||
input.o: dbsymtab.h
|
||||
input.o: file_info.h
|
||||
input.o: input.h
|
||||
input.o: inputtype.h
|
||||
|
@ -621,6 +625,7 @@ domacro.o: arith.h
|
|||
domacro.o: assert.h
|
||||
domacro.o: botch_free.h
|
||||
domacro.o: class.h
|
||||
domacro.o: dbsymtab.h
|
||||
domacro.o: debug.h
|
||||
domacro.o: file_info.h
|
||||
domacro.o: idf.h
|
||||
|
@ -688,6 +693,7 @@ stack.o: botch_free.h
|
|||
stack.o: dbsymtab.h
|
||||
stack.o: debug.h
|
||||
stack.o: def.h
|
||||
stack.o: l_em.h
|
||||
stack.o: idf.h
|
||||
stack.o: level.h
|
||||
stack.o: lint.h
|
||||
|
@ -778,9 +784,11 @@ switch.o: code.h
|
|||
switch.o: dbsymtab.h
|
||||
switch.o: debug.h
|
||||
switch.o: density.h
|
||||
switch.o: l_em.h
|
||||
switch.o: expr.h
|
||||
switch.o: idf.h
|
||||
switch.o: label.h
|
||||
switch.o: lint.h
|
||||
switch.o: nobitfield.h
|
||||
switch.o: nocross.h
|
||||
switch.o: nopp.h
|
||||
|
@ -803,6 +811,7 @@ util.o: Lpars.h
|
|||
util.o: align.h
|
||||
util.o: debug.h
|
||||
util.o: def.h
|
||||
util.o: l_em.h
|
||||
util.o: lint.h
|
||||
util.o: nocross.h
|
||||
util.o: regcount.h
|
||||
|
@ -919,7 +928,6 @@ l_misc.o: Lpars.h
|
|||
l_misc.o: arith.h
|
||||
l_misc.o: code.h
|
||||
l_misc.o: dbsymtab.h
|
||||
l_misc.o: debug.h
|
||||
l_misc.o: def.h
|
||||
l_misc.o: expr.h
|
||||
l_misc.o: file_info.h
|
||||
|
@ -963,6 +971,8 @@ l_outdef.o: assert.h
|
|||
l_outdef.o: code.h
|
||||
l_outdef.o: dbsymtab.h
|
||||
l_outdef.o: debug.h
|
||||
l_outdef.o: declar.h
|
||||
l_outdef.o: decspecs.h
|
||||
l_outdef.o: def.h
|
||||
l_outdef.o: expr.h
|
||||
l_outdef.o: field.h
|
||||
|
@ -988,10 +998,6 @@ l_comment.o: l_comment.h
|
|||
l_comment.o: l_state.h
|
||||
l_comment.o: lint.h
|
||||
l_comment.o: spec_arith.h
|
||||
l_dummy.o: arith.h
|
||||
l_dummy.o: label.h
|
||||
l_dummy.o: lint.h
|
||||
l_dummy.o: spec_arith.h
|
||||
tokenfile.o: Lpars.h
|
||||
declar.o: LLlex.h
|
||||
declar.o: Lpars.h
|
||||
|
@ -1007,7 +1013,6 @@ declar.o: field.h
|
|||
declar.o: file_info.h
|
||||
declar.o: idf.h
|
||||
declar.o: l_lint.h
|
||||
declar.o: l_state.h
|
||||
declar.o: label.h
|
||||
declar.o: level.h
|
||||
declar.o: lint.h
|
||||
|
@ -1028,11 +1033,11 @@ statement.o: code.h
|
|||
statement.o: dbsymtab.h
|
||||
statement.o: debug.h
|
||||
statement.o: def.h
|
||||
statement.o: l_em.h
|
||||
statement.o: expr.h
|
||||
statement.o: file_info.h
|
||||
statement.o: idf.h
|
||||
statement.o: l_lint.h
|
||||
statement.o: l_state.h
|
||||
statement.o: label.h
|
||||
statement.o: lint.h
|
||||
statement.o: nobitfield.h
|
||||
|
@ -1070,7 +1075,7 @@ program.o: def.h
|
|||
program.o: expr.h
|
||||
program.o: file_info.h
|
||||
program.o: idf.h
|
||||
program.o: l_state.h
|
||||
program.o: l_lint.h
|
||||
program.o: label.h
|
||||
program.o: lint.h
|
||||
program.o: nobitfield.h
|
||||
|
@ -1085,6 +1090,7 @@ ival.o: assert.h
|
|||
ival.o: dbsymtab.h
|
||||
ival.o: debug.h
|
||||
ival.o: def.h
|
||||
ival.o: l_em.h
|
||||
ival.o: estack.h
|
||||
ival.o: expr.h
|
||||
ival.o: field.h
|
||||
|
|
|
@ -270,10 +270,15 @@ ch3bin(expp, oper, expr)
|
|||
break;
|
||||
|
||||
case ',':
|
||||
if (is_cp_cst(*expp))
|
||||
if (is_cp_cst(*expp)) {
|
||||
#ifdef LINT
|
||||
hwarning("constant expression ignored");
|
||||
#endif LINT
|
||||
*expp = expr;
|
||||
else
|
||||
}
|
||||
else {
|
||||
*expp = new_oper(expr->ex_type, *expp, oper, expr);
|
||||
}
|
||||
(*expp)->ex_flags |= EX_COMMA;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
#include "lint.h"
|
||||
#include "debug.h"
|
||||
#include "dbsymtab.h"
|
||||
#include <em_code.h>
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#include "l_lint.h"
|
||||
#endif LINT
|
||||
#include "botch_free.h"
|
||||
#include <alloc.h>
|
||||
#include "dataflow.h"
|
||||
|
@ -135,6 +140,7 @@ flush_strings() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef LINT
|
||||
end_code()
|
||||
{
|
||||
/* end_code() performs the actions to be taken when closing
|
||||
|
@ -147,6 +153,7 @@ end_code()
|
|||
C_ms_src((int)(LineNumber - 2), FileName);
|
||||
C_close();
|
||||
}
|
||||
#endif LINT
|
||||
|
||||
#ifdef PREPEND_SCOPES
|
||||
prepend_scopes()
|
||||
|
@ -592,7 +599,7 @@ loc_init(expr, id)
|
|||
store_val(&vl, tp);
|
||||
}
|
||||
#else LINT
|
||||
df->df_set = 1;
|
||||
id->id_def->df_set = 1;
|
||||
#endif LINT
|
||||
free_expression(expr);
|
||||
}
|
||||
|
@ -644,7 +651,9 @@ formal_cvt(hasproto,df)
|
|||
&& tp->tp_fund == FLOAT
|
||||
&& !hasproto) {
|
||||
LoadLocal(df->df_address, double_size);
|
||||
#ifndef LINT
|
||||
conversion(double_type, float_type);
|
||||
#endif LINT
|
||||
StoreLocal(df->df_address, tp->tp_size);
|
||||
}
|
||||
}
|
||||
|
@ -666,7 +675,6 @@ code_expr(expr, val, code, tlbl, flbl)
|
|||
#ifdef DBSYMTAB
|
||||
if (options['g']) db_line(expr->ex_file, (unsigned int)expr->ex_line);
|
||||
#endif
|
||||
|
||||
EVAL(expr, val, code, tlbl, flbl);
|
||||
#else LINT
|
||||
lint_expr(expr, code ? USED : IGNORED);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "level.h"
|
||||
#ifdef LINT
|
||||
#include "l_lint.h"
|
||||
#include "l_state.h"
|
||||
#endif LINT
|
||||
|
||||
extern char options[];
|
||||
|
@ -643,7 +642,7 @@ parameter_decl(struct proto **plp;)
|
|||
|
||||
/* This is weird. Due to the LR structure of the ANSI C grammar
|
||||
we have to duplicate the actions of 'declarator' and
|
||||
'abstract_declarator'. Calling these separate, as in
|
||||
'abstract_declarator'. Calling these separately, as in
|
||||
|
||||
parameter_decl:
|
||||
decl_specifiers
|
||||
|
|
|
@ -12,7 +12,7 @@ struct def { /* for ordinary tags */
|
|||
int df_level;
|
||||
struct type *df_type;
|
||||
int df_sc; /* may be:
|
||||
GLOBAL, STATIC, EXTERN
|
||||
GLOBAL, STATIC, EXTERN,
|
||||
TYPEDEF,
|
||||
FORMAL, AUTO,
|
||||
ENUM, LABEL
|
||||
|
@ -20,7 +20,6 @@ struct def { /* for ordinary tags */
|
|||
char df_initialized; /* an initialization has been generated */
|
||||
char df_alloc; /* 0, ALLOC_SEEN or ALLOC_DONE */
|
||||
char df_used; /* set if idf is used */
|
||||
char df_formal_array; /* to warn if sizeof is taken */
|
||||
char *df_file; /* file containing the definition */
|
||||
unsigned int df_line; /* line number of the definition */
|
||||
#ifdef LINT
|
||||
|
@ -28,6 +27,7 @@ struct def { /* for ordinary tags */
|
|||
int df_firstbrace; /* brace number of its first occurrence */
|
||||
int df_minlevel; /* the lowest level needed for this def */
|
||||
#endif LINT
|
||||
char df_formal_array; /* to warn if sizeof is taken */
|
||||
arith df_address;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,9 +5,14 @@
|
|||
/* $Header$ */
|
||||
/* E R R O R A N D D I A G N O S T I C R O U T I N E S */
|
||||
|
||||
#include "lint.h"
|
||||
#include <varargs.h>
|
||||
#include <system.h>
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#endif LINT
|
||||
|
||||
#include "debug.h"
|
||||
#include "lint.h"
|
||||
|
|
|
@ -266,23 +266,7 @@ declare_idf(ds, dc, lvl)
|
|||
: AUTO;
|
||||
|
||||
#ifdef LINT
|
||||
if ( def && def->df_level < lvl
|
||||
&& !( lvl == L_FORMAL2
|
||||
|| def->df_level == L_UNIVERSAL
|
||||
|| sc == GLOBAL
|
||||
|| sc == EXTERN
|
||||
)
|
||||
) {
|
||||
/* there is already a definition for this non-extern name
|
||||
on a more global level
|
||||
*/
|
||||
warning("%s is already defined as a %s",
|
||||
idf->id_text,
|
||||
def->df_level == L_GLOBAL ? "global" :
|
||||
def->df_level == L_FORMAL2 ? "formal" :
|
||||
"more global local"
|
||||
);
|
||||
}
|
||||
check_hiding(idf, lvl, sc); /* of some idf by this idf */
|
||||
#endif LINT
|
||||
|
||||
if ((def &&
|
||||
|
@ -332,8 +316,8 @@ declare_idf(ds, dc, lvl)
|
|||
newdef->df_file = idf->id_file;
|
||||
newdef->df_line = idf->id_line;
|
||||
#ifdef LINT
|
||||
newdef->df_set = (type->tp_fund == ARRAY);
|
||||
/* newdef->df_firstbrace = 0; */
|
||||
newdef->df_set = 0;
|
||||
newdef->df_firstbrace = 0;
|
||||
#endif LINT
|
||||
/* link it into the name list in the proper place */
|
||||
idf->id_def = newdef;
|
||||
|
|
|
@ -7,7 +7,12 @@
|
|||
|
||||
{
|
||||
#include "lint.h"
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#include "l_lint.h"
|
||||
#endif LINT
|
||||
#include "debug.h"
|
||||
#include <alloc.h>
|
||||
#include <assert.h>
|
||||
|
@ -28,9 +33,6 @@
|
|||
#include "def.h"
|
||||
#include "LLlex.h"
|
||||
#include "estack.h"
|
||||
#ifdef LINT
|
||||
#include "l_lint.h"
|
||||
#endif LINT
|
||||
|
||||
#define con_nullbyte() C_con_ucon("0", (arith)1)
|
||||
#define aggregate_type(tp) ((tp)->tp_fund == ARRAY || (tp)->tp_fund == STRUCT)
|
||||
|
|
75
lang/cem/cemcom.ansi/l_em.h
Normal file
75
lang/cem/cemcom.ansi/l_em.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* This file can be considered the em_code.h file of lint.
|
||||
* Those code generating functions that are used by cem and that have not
|
||||
* been defined away by #ifdef LINT, are defined away here. Note that this a
|
||||
* fairly random collection. E.g. it does not include C_open(), since the
|
||||
* standard C-open() C_close() sequence is protected by #ifdef LINT, but it
|
||||
* does include C_close() since the latter is also called in other places,
|
||||
* to terminate the compilation process.
|
||||
*/
|
||||
|
||||
#define store_block(sz, al)
|
||||
#define load_block(sz, al)
|
||||
|
||||
#define C_asp(c)
|
||||
#define C_bra(b)
|
||||
#define C_cal(p)
|
||||
#define C_csa(w)
|
||||
#define C_csb(w)
|
||||
#define C_fil_dlb(g,o)
|
||||
#define C_lae_dlb(g,o)
|
||||
#define C_lal(c)
|
||||
#define C_lin(c)
|
||||
#define C_loi(c)
|
||||
#define C_lol(c)
|
||||
#define C_sdl(c)
|
||||
#define C_sti(c)
|
||||
#define C_stl(c)
|
||||
|
||||
#define C_busy() 0
|
||||
#define C_close()
|
||||
|
||||
#define C_df_dlb(l)
|
||||
#define C_df_dnam(s)
|
||||
#define C_df_ilb(l)
|
||||
|
||||
#define C_pro_narg(s)
|
||||
#define C_end(l)
|
||||
|
||||
#define C_exa_dnam(s)
|
||||
#define C_ina_dnam(s)
|
||||
#define C_ina_dlb(l)
|
||||
#define C_exp(s)
|
||||
#define C_inp(s)
|
||||
|
||||
#define C_bss_cst(n,w,i)
|
||||
|
||||
#define C_con_cst(v)
|
||||
#define C_con_icon(v,s)
|
||||
#define C_con_ucon(v,s)
|
||||
#define C_con_fcon(v,s)
|
||||
#define C_con_scon(v,s)
|
||||
#define C_con_dnam(v,s)
|
||||
#define C_con_dlb(v,s)
|
||||
#define C_con_pnam(v)
|
||||
|
||||
#define C_rom_cst(v)
|
||||
#define C_rom_icon(v,s)
|
||||
#define C_rom_scon(v,s)
|
||||
#define C_rom_ilb(v)
|
||||
|
||||
#define C_ldl(l)
|
||||
|
||||
#define C_mes_begin(ms)
|
||||
#define C_mes_end()
|
||||
|
||||
#define C_ms_gto()
|
||||
#define C_ms_par(b)
|
||||
#define C_ms_reg(o,s,t,c)
|
||||
|
|
@ -12,7 +12,9 @@
|
|||
#include <alloc.h> /* for st_free */
|
||||
#include "interface.h"
|
||||
#include "assert.h"
|
||||
#ifdef ANSI
|
||||
#include <flt_arith.h>
|
||||
#endif ANSI
|
||||
#include "arith.h" /* definition arith */
|
||||
#include "label.h" /* definition label */
|
||||
#include "expr.h"
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include "debug.h"
|
||||
#include "interface.h"
|
||||
#include "assert.h"
|
||||
#ifdef ANSI
|
||||
#include <flt_arith.h>
|
||||
#endif ANSI
|
||||
#include "arith.h" /* definition arith */
|
||||
#include "label.h" /* definition label */
|
||||
#include "expr.h"
|
||||
|
@ -255,14 +257,6 @@ oper2state(expr, val, used)
|
|||
case GREATEREQ:
|
||||
case EQUAL:
|
||||
case NOTEQUAL:
|
||||
lint_relop(left, right, oper);
|
||||
lint_relop(right, left,
|
||||
oper == '<' ? '>' :
|
||||
oper == '>' ? '<' :
|
||||
oper == LESSEQ ? GREATEREQ :
|
||||
oper == GREATEREQ ? LESSEQ :
|
||||
oper
|
||||
);
|
||||
goto dyadic;
|
||||
|
||||
/* dyadic operators */
|
||||
|
@ -296,8 +290,10 @@ expr_ignored(expr)
|
|||
struct expr *expr;
|
||||
{
|
||||
switch (expr->ex_class) {
|
||||
int oper;
|
||||
case Oper:
|
||||
switch (expr->OP_OPER) {
|
||||
oper = expr->OP_OPER;
|
||||
switch (oper) {
|
||||
case '=':
|
||||
case TIMESAB:
|
||||
case DIVAB:
|
||||
|
@ -312,6 +308,7 @@ expr_ignored(expr)
|
|||
case '(':
|
||||
case '?':
|
||||
case ',':
|
||||
oper = 0; /* ignore the ignoring */
|
||||
break;
|
||||
|
||||
case PLUSAB:
|
||||
|
@ -320,29 +317,45 @@ expr_ignored(expr)
|
|||
case POSTDECR:
|
||||
case PLUSPLUS:
|
||||
case MINMIN:
|
||||
/* may hide the operator '*' */
|
||||
oper = 0; /* ignore in priciple */
|
||||
/* may, however, hide the operator '*' */
|
||||
if ( /* operation on a pointer */
|
||||
expr->OP_TYPE->tp_fund == POINTER
|
||||
&& /* the result is dereferenced, e.g. *p++; */
|
||||
expr->ex_type == expr->OP_TYPE->tp_up
|
||||
) {
|
||||
hwarning("result of * ignored");
|
||||
oper = '*';
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
hwarning("result of %s ignored",
|
||||
symbol2str(expr->OP_OPER));
|
||||
case '/':
|
||||
/* this is a specially weird case: the '/' may
|
||||
result from pointer subtraction
|
||||
*/
|
||||
if ( expr->OP_TYPE->tp_fund == INT
|
||||
&& expr->OP_LEFT->OP_OPER == '-'
|
||||
&& expr->OP_LEFT->OP_TYPE->tp_fund == POINTER
|
||||
) {
|
||||
oper = '-';
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (oper) {
|
||||
hwarning("result of %s ignored", symbol2str(oper));
|
||||
}
|
||||
break;
|
||||
|
||||
case Value:
|
||||
hwarning("value as statement");
|
||||
if (expr->VL_CLASS == Const) {
|
||||
hwarning("constant expression ignored");
|
||||
}
|
||||
else {
|
||||
hwarning("value ignored");
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* String Float */
|
||||
hwarning("constant as statement");
|
||||
hwarning("constant ignored");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
#ifdef LINT
|
||||
|
||||
#include <alloc.h> /* for st_free */
|
||||
#include "debug.h"
|
||||
#include "interface.h"
|
||||
#ifdef ANSI
|
||||
#include <flt_arith.h>
|
||||
#endif ANSI
|
||||
#include "arith.h" /* definition arith */
|
||||
#include "label.h" /* definition label */
|
||||
#include "expr.h"
|
||||
|
@ -33,6 +34,32 @@ PRIVATE lint_enum_arith();
|
|||
PRIVATE lint_conversion();
|
||||
PRIVATE int numsize();
|
||||
|
||||
check_hiding(idf, lvl, sc)
|
||||
struct idf *idf;
|
||||
int lvl;
|
||||
int sc;
|
||||
{
|
||||
/* Checks if there is already a definition for this non-extern
|
||||
name on a more global level.
|
||||
*/
|
||||
struct def *def = idf->id_def;
|
||||
|
||||
if ( def && def->df_level < lvl
|
||||
&& ! ( lvl == L_FORMAL2
|
||||
|| def->df_level == L_UNIVERSAL
|
||||
|| sc == GLOBAL
|
||||
|| sc == EXTERN
|
||||
)
|
||||
) {
|
||||
warning("%s is already defined as a %s",
|
||||
idf->id_text,
|
||||
def->df_level == L_GLOBAL ? "global" :
|
||||
def->df_level == L_FORMAL2 ? "formal" :
|
||||
"more global local"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
lint_new_oper(expr)
|
||||
struct expr *expr;
|
||||
{
|
||||
|
@ -53,14 +80,14 @@ lint_new_oper(expr)
|
|||
right == 0 ? 0 : /* for ( without parameters */
|
||||
right->ex_type->tp_fund;
|
||||
|
||||
/* In ch3.c, in ch3asgn(), a combined operator/assignment
|
||||
/* In ch7.c, in ch7asgn(), a combined operator/assignment
|
||||
is hammered into correctness by repeated application of
|
||||
ch3bin(), which calls new_oper(), which calls lint_new_oper().
|
||||
ch7bin(), which calls new_oper(), which calls lint_new_oper().
|
||||
These spurious calls understandably cause spurious error
|
||||
messages, which we don't like. So we try to suppress these
|
||||
wierd calls here. This refers to the code marked
|
||||
this is really $#@&*%$# !
|
||||
in ch3asgn().
|
||||
in ch7asgn().
|
||||
*/
|
||||
switch (oper) {
|
||||
case PLUSAB:
|
||||
|
@ -104,7 +131,7 @@ lint_new_oper(expr)
|
|||
else {
|
||||
/* binary */
|
||||
if (l_fund == ENUM && r_fund == ENUM) {
|
||||
if (!equal_type(left->ex_type, right->ex_type, 0))
|
||||
if (left->ex_type != right->ex_type)
|
||||
warning("subtracting enums of different type");
|
||||
/* update the type, cem does not do it */
|
||||
expr->ex_type = int_type;
|
||||
|
@ -141,8 +168,7 @@ lint_new_oper(expr)
|
|||
break;
|
||||
|
||||
case '~':
|
||||
if (r_fund == ENUM || r_fund == FLOAT || r_fund == DOUBLE
|
||||
/* ??? || r_fund == LNGDBL */ )
|
||||
if (r_fund == ENUM || r_fund == FLOAT || r_fund == DOUBLE)
|
||||
warning("~ on %s", symbol2str(r_fund));
|
||||
break;
|
||||
|
||||
|
@ -165,7 +191,7 @@ lint_new_oper(expr)
|
|||
case EQUAL:
|
||||
case NOTEQUAL:
|
||||
if ( (l_fund == ENUM || r_fund == ENUM)
|
||||
&& !equal_type(left->ex_type, right->ex_type, 0)
|
||||
&& left->ex_type != right->ex_type
|
||||
) {
|
||||
warning("comparing enum with non-enum");
|
||||
}
|
||||
|
@ -287,7 +313,6 @@ numsize(fund)
|
|||
case LONG: return 4;
|
||||
case FLOAT: return 5;
|
||||
case DOUBLE: return 6;
|
||||
case LNGDBL: return 7;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
@ -303,8 +328,8 @@ lint_ptr_conv(from, to)
|
|||
{
|
||||
/* X -> X ok -- this includes struct -> struct, of any size
|
||||
* X -> CHAR ok
|
||||
* LNGDBL -> X ok
|
||||
* DOUBLE -> FLOAT -> LONG -> INT -> SHORT ok
|
||||
* DOUBLE -> X ok
|
||||
* FLOAT -> LONG -> INT -> SHORT ok
|
||||
*/
|
||||
if (from == to)
|
||||
return;
|
||||
|
@ -312,18 +337,10 @@ lint_ptr_conv(from, to)
|
|||
if (to == CHAR)
|
||||
return;
|
||||
|
||||
if (from == LNGDBL)
|
||||
if (from == DOUBLE)
|
||||
return;
|
||||
|
||||
switch (from) {
|
||||
case DOUBLE:
|
||||
switch(to) {
|
||||
case FLOAT:
|
||||
case INT:
|
||||
case SHORT:
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case FLOAT:
|
||||
switch (to) {
|
||||
case LONG:
|
||||
|
@ -373,7 +390,7 @@ lint_relop(left, right, oper)
|
|||
&& right->ex_class == Value
|
||||
&& right->VL_CLASS == Const
|
||||
) {
|
||||
if (right->VL_VALUE < 0) {
|
||||
if (!right->ex_type->tp_unsigned && right->VL_VALUE < 0) {
|
||||
warning("unsigned compared to negative constant");
|
||||
}
|
||||
if (right->VL_VALUE == 0) {
|
||||
|
|
|
@ -10,12 +10,15 @@
|
|||
#ifdef LINT
|
||||
|
||||
#include <alloc.h>
|
||||
#include "debug.h"
|
||||
#include "interface.h"
|
||||
#ifdef ANSI
|
||||
#include <flt_arith.h>
|
||||
#endif ANSI
|
||||
#include "arith.h"
|
||||
#include "assert.h"
|
||||
#include "type.h"
|
||||
#include "declar.h"
|
||||
#include "decspecs.h"
|
||||
#include "LLlex.h"
|
||||
#include "Lpars.h"
|
||||
#include "stack.h"
|
||||
|
@ -34,6 +37,7 @@
|
|||
|
||||
extern char *bts2str();
|
||||
extern char *symbol2str();
|
||||
extern char *strindex();
|
||||
|
||||
int stat_number = 9999; /* static scope number */
|
||||
struct outdef OutDef;
|
||||
|
@ -46,7 +50,6 @@ PRIVATE outargs();
|
|||
PRIVATE outarg();
|
||||
PRIVATE outargstring();
|
||||
PRIVATE outargtype();
|
||||
PRIVATE implicit_func_decl();
|
||||
PRIVATE fill_arg();
|
||||
|
||||
lint_declare_idf(idf, sc)
|
||||
|
@ -69,10 +72,23 @@ lint_declare_idf(idf, sc)
|
|||
}
|
||||
}
|
||||
|
||||
lint_non_function_decl(ds, dc)
|
||||
struct decspecs *ds;
|
||||
struct declarator *dc;
|
||||
{
|
||||
register struct def *def = dc->dc_idf->id_def;
|
||||
register int is_function = def->df_type->tp_fund == FUNCTION;
|
||||
|
||||
if (is_function)
|
||||
def2decl(ds->ds_sc);
|
||||
if (def->df_sc != TYPEDEF)
|
||||
outdef();
|
||||
}
|
||||
|
||||
lint_ext_def(idf, sc)
|
||||
struct idf *idf;
|
||||
{
|
||||
/* At this place the following fields of the outputdefinition can be
|
||||
/* At this place the following fields of the output definition can be
|
||||
* filled:
|
||||
* name, stat_number, class, file, line, type.
|
||||
* For variable definitions and declarations this will be all.
|
||||
|
@ -165,7 +181,7 @@ lint_formals()
|
|||
switch (type->tp_fund) {
|
||||
case CHAR:
|
||||
case SHORT:
|
||||
type = int_type;
|
||||
type = (type->tp_unsigned ? uint_type : int_type);
|
||||
break;
|
||||
case FLOAT:
|
||||
type = double_type;
|
||||
|
@ -273,7 +289,7 @@ output_def(od)
|
|||
/* As the types are output the tp_entries are removed, because they
|
||||
* are then not needed anymore.
|
||||
*/
|
||||
if (od->od_class == XXDF)
|
||||
if (od->od_class == XXDF || !od->od_name || od->od_name[0] == '#')
|
||||
return;
|
||||
|
||||
if (LINTLIB) {
|
||||
|
@ -435,7 +451,18 @@ outargtype(tp)
|
|||
case STRUCT:
|
||||
case UNION:
|
||||
case ENUM:
|
||||
printf("%s %s", symbol2str(tp->tp_fund), tp->tp_idf->id_text);
|
||||
/* watch out for anonymous identifiers; the count field does
|
||||
not have to be the same for all compilation units.
|
||||
Remove it, so that pass 2 does not see it. The only
|
||||
problem with this is that pass2 will not see a difference
|
||||
between two non-tagged types declared on the same line.
|
||||
*/
|
||||
printf("%s ", symbol2str(tp->tp_fund));
|
||||
if (is_anon_idf(tp->tp_idf)) {
|
||||
/* skip the #<num>, replace it by '#anonymous id' */
|
||||
printf("#anonymous id%s", strindex(tp->tp_idf->id_text, ' '));
|
||||
}
|
||||
else printf(tp->tp_idf->id_text);
|
||||
break;
|
||||
|
||||
case CHAR:
|
||||
|
@ -444,7 +471,6 @@ outargtype(tp)
|
|||
case LONG:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
case LNGDBL:
|
||||
case VOID:
|
||||
case ERRONEOUS:
|
||||
if (tp->tp_unsigned)
|
||||
|
@ -457,6 +483,7 @@ outargtype(tp)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef IMPLICIT
|
||||
PRIVATE
|
||||
implicit_func_decl(idf, file, line)
|
||||
struct idf *idf;
|
||||
|
@ -474,6 +501,7 @@ implicit_func_decl(idf, file, line)
|
|||
output_def(&od);
|
||||
/* The other fields are not used for this class. */
|
||||
}
|
||||
#endif IMPLICIT
|
||||
|
||||
fill_outcall(ex, used)
|
||||
struct expr *ex;
|
||||
|
@ -482,10 +510,12 @@ fill_outcall(ex, used)
|
|||
register struct idf *idf = ex->OP_LEFT->VL_IDF;
|
||||
register struct def *def = idf->id_def;
|
||||
|
||||
#ifdef IMPLICIT
|
||||
if (def->df_sc == IMPLICIT && !idf->id_def->df_used) {
|
||||
/* IFDC, first time */
|
||||
implicit_func_decl(idf, ex->ex_file, ex->ex_line);
|
||||
}
|
||||
#endif IMPLICIT
|
||||
|
||||
OutCall.od_type = def->df_type->tp_up;
|
||||
OutCall.od_statnr = (def->df_sc == STATIC ? stat_number : 0);
|
||||
|
@ -519,7 +549,10 @@ fill_arg(e)
|
|||
arg->ar_class = ArgConst;
|
||||
arg->CAA_VALUE = e->VL_VALUE;
|
||||
}
|
||||
else if (e->ex_class == Value && e->VL_CLASS == Label) {
|
||||
else if ( e->ex_type == string_type
|
||||
&& e->ex_class == Value
|
||||
&& e->VL_CLASS == Label
|
||||
) {
|
||||
/* it may be a string; let's look it up */
|
||||
register struct string_cst *sc = str_list;
|
||||
|
||||
|
|
|
@ -12,35 +12,52 @@
|
|||
* control of the program.
|
||||
*/
|
||||
|
||||
#define TEST_VAR 0 /* not a constant */
|
||||
#define TEST_TRUE 1 /* always true */
|
||||
#define TEST_FALSE 2 /* always false */
|
||||
|
||||
struct switch_states {
|
||||
struct loop_state { /* used in lint_end_state only */
|
||||
int lps_test; /* is the test a constant? */
|
||||
struct state *lps_body;
|
||||
struct state *lps_loop;
|
||||
};
|
||||
|
||||
struct switch_state { /* used in lint_end_state only */
|
||||
struct state *sws_case;
|
||||
struct state *sws_break;
|
||||
int sws_default_met;
|
||||
};
|
||||
|
||||
/* This union describes the (possibly incomplete) state at the end of the
|
||||
mentioned construct.
|
||||
*/
|
||||
union lint_end_state { /* used in lint_stack_entry only */
|
||||
struct state *ule_if;
|
||||
struct loop_state ule_loop;
|
||||
struct switch_state ule_switch;
|
||||
};
|
||||
|
||||
struct lint_stack_entry {
|
||||
struct lint_stack_entry *next;
|
||||
struct lint_stack_entry *ls_previous;
|
||||
short ls_class; /* IF, WHILE, DO, FOR, SWITCH, CASE */
|
||||
int ls_level;
|
||||
struct state *ls_current; /* used by all classes */
|
||||
union {
|
||||
struct state *u_if_state; /* used for IF-class */
|
||||
struct state *u_end; /* used for loop-classes */
|
||||
struct switch_states u_switch;
|
||||
} ls_states; /* not used for CASE-class */
|
||||
struct state *ls_current; /* used by all classes */
|
||||
short ls_class; /* IF, WHILE, DO, FOR, SWITCH, CASE */
|
||||
union lint_end_state ls_end;
|
||||
};
|
||||
|
||||
/* macros to access the union */
|
||||
#define LS_IF_STATE ls_states.u_if_state
|
||||
#define LS_END ls_states.u_end
|
||||
#define LS_CASE ls_states.u_switch.sws_case
|
||||
#define LS_BREAK ls_states.u_switch.sws_break
|
||||
#define LS_DEFAULT_MET ls_states.u_switch.sws_default_met
|
||||
|
||||
/* ALLOCDEF "lint_stack_entry" 10 */
|
||||
|
||||
/* macros to access the union */
|
||||
#define LS_IF ls_end.ule_if
|
||||
#define LS_TEST ls_end.ule_loop.lps_test
|
||||
#define LS_BODY ls_end.ule_loop.lps_body
|
||||
#define LS_LOOP ls_end.ule_loop.lps_loop
|
||||
#define LS_CASE ls_end.ule_switch.sws_case
|
||||
#define LS_BREAK ls_end.ule_switch.sws_break
|
||||
#define LS_DEFAULT_MET ls_end.ule_switch.sws_default_met
|
||||
|
||||
/* describes a branch in the program, with its local idfs */
|
||||
struct state {
|
||||
struct state *next; /* only used by memory allocator */
|
||||
struct auto_def *st_auto_list;
|
||||
|
@ -50,6 +67,7 @@ struct state {
|
|||
|
||||
/* ALLOCDEF "state" 15 */
|
||||
|
||||
/* describes the state of a local idf in a given branch of the program */
|
||||
struct auto_def {
|
||||
struct auto_def *next;
|
||||
struct idf *ad_idf;
|
||||
|
@ -61,13 +79,14 @@ struct auto_def {
|
|||
|
||||
/* ALLOCDEF "auto_def" 20 */
|
||||
|
||||
struct expr_state {
|
||||
/* describes the state of an idf during expression evaluation */
|
||||
struct expr_state { /*actually concerns idfs only */
|
||||
struct expr_state *next;
|
||||
struct idf *es_idf;
|
||||
struct idf *es_idf; /* the idf with its offset */
|
||||
arith es_offset;
|
||||
int es_used;
|
||||
int es_referred;
|
||||
int es_set;
|
||||
int es_used; /* value has been used */
|
||||
int es_referred; /* address has been taken */
|
||||
int es_set; /* has been assigned to */
|
||||
};
|
||||
|
||||
/* ALLOCDEF "expr_state" 20 */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -298,7 +298,10 @@ compile(argc, argv)
|
|||
#ifdef PREPEND_SCOPES
|
||||
prepend_scopes();
|
||||
#endif PREPEND_SCOPES
|
||||
|
||||
#ifndef LINT
|
||||
end_code();
|
||||
#endif LINT
|
||||
|
||||
#ifdef DEBUG
|
||||
if (options['u']) {
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
#include "expr.h"
|
||||
#include "def.h"
|
||||
#ifdef LINT
|
||||
#include "l_state.h"
|
||||
#include "l_lint.h"
|
||||
#endif LINT
|
||||
|
||||
#ifndef NOPP
|
||||
|
@ -182,10 +182,7 @@ non_function(register struct decspecs *ds; register struct declarator *dc;)
|
|||
]
|
||||
{
|
||||
#ifdef LINT
|
||||
if (dc->dc_idf->id_def->df_type->tp_fund == FUNCTION)
|
||||
def2decl(ds->ds_sc);
|
||||
if (dc->dc_idf->id_def->df_sc != TYPEDEF)
|
||||
outdef();
|
||||
lint_non_function_decl(ds, dc);
|
||||
#endif LINT
|
||||
}
|
||||
[
|
||||
|
@ -225,11 +222,11 @@ function(struct decspecs *ds; struct declarator *dc;)
|
|||
{
|
||||
end_proc(fbytes);
|
||||
#ifdef LINT
|
||||
lint_return_stmt(0); /* implicit return at end of function */
|
||||
lint_implicit_return();
|
||||
#endif LINT
|
||||
unstack_level(); /* L_FORMAL2 declarations */
|
||||
#ifdef LINT
|
||||
check_args_used();
|
||||
lint_end_formals();
|
||||
#endif LINT
|
||||
unstack_level(); /* L_FORMAL1 declarations */
|
||||
#ifdef LINT
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
|
||||
#include "lint.h"
|
||||
#include <system.h>
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#endif LINT
|
||||
#include "debug.h"
|
||||
#include "botch_free.h"
|
||||
#include <alloc.h>
|
||||
|
@ -109,7 +113,7 @@ unstack_level()
|
|||
#endif DEBUG
|
||||
|
||||
#ifdef LINT
|
||||
lint_local_level(local_level);
|
||||
lint_end_local(local_level);
|
||||
#endif LINT
|
||||
|
||||
/* The implementation below is more careful than strictly
|
||||
|
@ -185,7 +189,7 @@ unstack_world()
|
|||
register struct stack_entry *se = local_level->sl_entry;
|
||||
|
||||
#ifdef LINT
|
||||
lint_global_level(local_level);
|
||||
lint_end_global(local_level);
|
||||
#endif LINT
|
||||
|
||||
#ifdef GEN_NM_LIST
|
||||
|
|
|
@ -6,9 +6,14 @@
|
|||
/* STATEMENT SYNTAX PARSER */
|
||||
|
||||
{
|
||||
#include <em_code.h>
|
||||
|
||||
#include "lint.h"
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#include "l_lint.h"
|
||||
#endif LINT
|
||||
|
||||
#include "debug.h"
|
||||
#include "botch_free.h"
|
||||
#include "dbsymtab.h"
|
||||
|
@ -23,10 +28,6 @@
|
|||
#include "code.h"
|
||||
#include "stack.h"
|
||||
#include "def.h"
|
||||
#ifdef LINT
|
||||
#include "l_lint.h"
|
||||
#include "l_state.h"
|
||||
#endif LINT
|
||||
#ifdef DBSYMTAB
|
||||
#include <stb.h>
|
||||
#endif /* DBSYMTAB */
|
||||
|
@ -215,18 +216,14 @@ while_statement
|
|||
if (expr->VL_VALUE == (arith)0) {
|
||||
C_bra(l_break);
|
||||
}
|
||||
#ifdef LINT
|
||||
start_loop_stmt(WHILE, 1,
|
||||
expr->VL_VALUE != (arith)0);
|
||||
#endif LINT
|
||||
}
|
||||
else {
|
||||
code_expr(expr, RVAL, TRUE, l_body, l_break);
|
||||
C_df_ilb(l_body);
|
||||
#ifdef LINT
|
||||
start_loop_stmt(WHILE, 0, 0);
|
||||
#endif LINT
|
||||
}
|
||||
#ifdef LINT
|
||||
start_while_stmt(expr);
|
||||
#endif LINT
|
||||
}
|
||||
')'
|
||||
statement
|
||||
|
@ -236,6 +233,7 @@ while_statement
|
|||
unstack_stmt();
|
||||
free_expression(expr);
|
||||
#ifdef LINT
|
||||
end_loop_body();
|
||||
end_loop_stmt();
|
||||
#endif LINT
|
||||
}
|
||||
|
@ -253,13 +251,17 @@ do_statement
|
|||
{ C_df_ilb(l_body);
|
||||
stack_stmt(l_break, l_continue);
|
||||
#ifdef LINT
|
||||
start_loop_stmt(DO, 1, 1);
|
||||
start_do_stmt();
|
||||
#endif LINT
|
||||
}
|
||||
statement
|
||||
WHILE
|
||||
'('
|
||||
{ C_df_ilb(l_continue);
|
||||
{
|
||||
#ifdef LINT
|
||||
end_loop_body();
|
||||
#endif LINT
|
||||
C_df_ilb(l_continue);
|
||||
}
|
||||
expression(&expr)
|
||||
{
|
||||
|
@ -295,9 +297,6 @@ for_statement
|
|||
label l_continue = text_label();
|
||||
label l_body = text_label();
|
||||
label l_test = text_label();
|
||||
#ifdef LINT
|
||||
int const = 1, cond = 1; /* the default case */
|
||||
#endif LINT
|
||||
}
|
||||
:
|
||||
FOR
|
||||
|
@ -320,17 +319,10 @@ for_statement
|
|||
if (e_test->VL_VALUE == (arith)0) {
|
||||
C_bra(l_break);
|
||||
}
|
||||
#ifdef LINT
|
||||
const = 1,
|
||||
cond = e_test->VL_VALUE != (arith)0;
|
||||
#endif LINT
|
||||
}
|
||||
else {
|
||||
code_expr(e_test, RVAL, TRUE, l_body, l_break);
|
||||
C_df_ilb(l_body);
|
||||
#ifdef LINT
|
||||
const = 0, cond = 0;
|
||||
#endif LINT
|
||||
}
|
||||
}
|
||||
]?
|
||||
|
@ -339,13 +331,13 @@ for_statement
|
|||
')'
|
||||
{
|
||||
#ifdef LINT
|
||||
start_loop_stmt(FOR, const, cond);
|
||||
start_for_stmt(e_test);
|
||||
#endif LINT
|
||||
}
|
||||
statement
|
||||
{
|
||||
#ifdef LINT
|
||||
end_loop_stmt();
|
||||
end_loop_body();
|
||||
#endif LINT
|
||||
C_df_ilb(l_continue);
|
||||
if (e_incr)
|
||||
|
@ -357,6 +349,9 @@ for_statement
|
|||
free_expression(e_init);
|
||||
free_expression(e_test);
|
||||
free_expression(e_incr);
|
||||
#ifdef LINT
|
||||
end_loop_stmt();
|
||||
#endif LINT
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -372,7 +367,7 @@ switch_statement
|
|||
{
|
||||
code_startswitch(&expr);
|
||||
#ifdef LINT
|
||||
start_switch_part(expr);
|
||||
start_switch_part(is_cp_cst(expr));
|
||||
#endif LINT
|
||||
}
|
||||
')'
|
||||
|
@ -435,7 +430,7 @@ return_statement
|
|||
do_return_expr(expr);
|
||||
free_expression(expr);
|
||||
#ifdef LINT
|
||||
lint_return_stmt(1);
|
||||
lint_return_stmt(VALRETURNED);
|
||||
#endif LINT
|
||||
}
|
||||
|
|
||||
|
@ -443,7 +438,7 @@ return_statement
|
|||
{
|
||||
do_return();
|
||||
#ifdef LINT
|
||||
lint_return_stmt(0);
|
||||
lint_return_stmt(NOVALRETURNED);
|
||||
#endif LINT
|
||||
}
|
||||
]
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
/* $Header$ */
|
||||
/* S W I T C H - S T A T E M E N T A D M I N I S T R A T I O N */
|
||||
|
||||
#include "lint.h"
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#endif LINT
|
||||
#include "debug.h"
|
||||
#include "botch_free.h"
|
||||
#include <alloc.h>
|
||||
|
@ -73,6 +78,9 @@ code_startswitch(expp)
|
|||
sh->sh_type = (*expp)->ex_type; /* the expression switched */
|
||||
/* sh->sh_entries = (struct case_entry *) 0; /* case-entry list */
|
||||
sh->sh_expr = *expp;
|
||||
#ifdef LINT
|
||||
code_expr(sh->sh_expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
|
||||
#endif
|
||||
sh->next = switch_stack; /* push onto switch-stack */
|
||||
switch_stack = sh;
|
||||
C_bra(l_table); /* goto start of switch_table */
|
||||
|
@ -92,7 +100,9 @@ code_endswitch()
|
|||
C_bra(sh->sh_break); /* skip the switch table now */
|
||||
C_df_ilb(sh->sh_table); /* switch table entry */
|
||||
/* evaluate the switch expr. */
|
||||
#ifndef LINT
|
||||
code_expr(sh->sh_expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
|
||||
#endif
|
||||
tablabel = data_label(); /* the rom must have a label */
|
||||
C_df_dlb(tablabel);
|
||||
C_rom_ilb(sh->sh_default);
|
||||
|
|
|
@ -11,12 +11,17 @@
|
|||
allowing re-use.
|
||||
*/
|
||||
|
||||
#include "lint.h"
|
||||
#ifndef LINT
|
||||
#include <em.h>
|
||||
#else
|
||||
#include "l_em.h"
|
||||
#endif LINT
|
||||
#include <em_arith.h>
|
||||
#include <em_reg.h>
|
||||
#include <alloc.h>
|
||||
#include <em_mes.h>
|
||||
|
||||
#include "lint.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "use_tmp.h"
|
||||
|
|
Loading…
Reference in a new issue