compatibility change in l_class.h for prototypes in ANSI C

This commit is contained in:
dick 1991-07-05 11:33:49 +00:00
parent 34d6b23ba6
commit a0460b8bfc
5 changed files with 37 additions and 19 deletions

View file

@ -8,14 +8,25 @@
#define LFDF 'a' /* Library Function Definition */ #define LFDF 'a' /* Library Function Definition */
#define LVDF 'b' /* Library Variable Definition */ #define LVDF 'b' /* Library Variable Definition */
#define EFDF 'c' /* External Function Definition */
#define EVDF 'd' /* External Variable Definition */ #define PFDF 'd' /* Prototype Function Definition */
#define EFDC 'e' /* External Function Declaration */
#define EVDC 'f' /* External Variable Declaration */ #define EFDF 'f' /* External Function Definition */
#define IFDC 'g' /* Implicit Function Declaration */ #define EVDF 'g' /* External Variable Definition */
#define SFDF 'h' /* Static Function Definition */ #define EFDC 'h' /* External Function Declaration */
#define SVDF 'i' /* Static Variable Definition */ #define EVDC 'i' /* External Variable Declaration */
#define FC 'j' /* Function Call */
#define VU 'k' /* Variable Usage */ #define IFDC 'm' /* Implicit Function Declaration */
#define XXDF 'l' /* Ignore Class */
#define SFDF 'q' /* Static Function Definition */
#define SVDF 'r' /* Static Variable Definition */
#define FC 'u' /* Function Call */
#define VU 'v' /* Variable Usage */
#define XXDF 'z' /* Ignore Class */
/* Two meta-definitions */
#define MIN_CLASS_CONST LFDF
#define MAX_CLASS_CONST XXDF

View file

@ -28,6 +28,7 @@
#define C_lin(c) #define C_lin(c)
#define C_loi(c) #define C_loi(c)
#define C_lol(c) #define C_lol(c)
#define C_ret(c)
#define C_sdl(c) #define C_sdl(c)
#define C_sti(c) #define C_sti(c)
#define C_stl(c) #define C_stl(c)

View file

@ -364,6 +364,10 @@ lint_ptr_conv(from, to)
break; break;
} }
if (from == VOID) {
/* OK any which way */
}
else
if (from == CHAR) { if (from == CHAR) {
hwarning("pointer to char may not align correctly for a %s", hwarning("pointer to char may not align correctly for a %s",
symbol2str(to)); symbol2str(to));

View file

@ -50,7 +50,7 @@ PRIVATE outargs();
PRIVATE outarg(); PRIVATE outarg();
PRIVATE outargstring(); PRIVATE outargstring();
PRIVATE outargtype(); PRIVATE outargtype();
PRIVATE fill_arg(); PRIVATE add_expr_arg();
lint_declare_idf(idf, sc) lint_declare_idf(idf, sc)
struct idf *idf; struct idf *idf;
@ -159,7 +159,7 @@ local_EFDC(idf)
lint_formals() lint_formals()
{ {
/* Make a list of tp_entries containing the types of the formal /* Make a list of 'struct argument's containing the types of the formal
* parameters of the function definition just parsed. * parameters of the function definition just parsed.
*/ */
register struct stack_entry *se = stack_level_of(L_FORMAL1)->sl_entry; register struct stack_entry *se = stack_level_of(L_FORMAL1)->sl_entry;
@ -286,7 +286,7 @@ PRIVATE
output_def(od) output_def(od)
struct outdef *od; struct outdef *od;
{ {
/* As the types are output the tp_entries are removed, because they /* As the types are output the 'struct argument's are removed, because they
* are then not needed anymore. * are then not needed anymore.
*/ */
if (od->od_class == XXDF || !od->od_name || od->od_name[0] == '#') if (od->od_class == XXDF || !od->od_name || od->od_name[0] == '#')
@ -301,7 +301,7 @@ output_def(od)
od->od_class = LVDF; od->od_class = LVDF;
break; break;
case SFDF: case SFDF:
/* remove tp_entries */ /* remove 'struct argument's */
while (od->od_arg) { while (od->od_arg) {
register struct argument *tmp = od->od_arg; register struct argument *tmp = od->od_arg;
od->od_arg = od->od_arg->next; od->od_arg = od->od_arg->next;
@ -526,19 +526,20 @@ fill_outcall(ex, used)
OutCall.od_arg = (struct argument *)0; OutCall.od_arg = (struct argument *)0;
OutCall.od_nrargs = 0; OutCall.od_nrargs = 0;
if ((ex = ex->OP_RIGHT) != 0) { /* function call with arguments */ if ((ex = ex->OP_RIGHT) != 0) {
/* store types of argument expressions in tp_entries */ /* function call with arguments */
/* store types of argument expressions in 'struct argument's */
while (ex->ex_class == Oper && ex->OP_OPER == PARCOMMA) { while (ex->ex_class == Oper && ex->OP_OPER == PARCOMMA) {
fill_arg(ex->OP_RIGHT); add_expr_arg(ex->OP_RIGHT);
ex = ex->OP_LEFT; ex = ex->OP_LEFT;
} }
fill_arg(ex); add_expr_arg(ex);
} }
OutCall.od_valused = used; /* USED, IGNORED or VOIDED */ OutCall.od_valused = used; /* USED, IGNORED or VOIDED */
} }
PRIVATE PRIVATE
fill_arg(e) add_expr_arg(e)
struct expr *e; struct expr *e;
{ {
register struct argument *arg; register struct argument *arg;

View file

@ -10,6 +10,7 @@
#define ArgExpr 1 /* actual */ #define ArgExpr 1 /* actual */
#define ArgConst 2 /* integer constant */ #define ArgConst 2 /* integer constant */
#define ArgString 3 /* string */ #define ArgString 3 /* string */
#define ArgEllipsis 4 /* ellipsis */
struct argument { struct argument {
struct argument *next; struct argument *next;