compatibility change in l_class.h for prototypes in ANSI C
This commit is contained in:
		
							parent
							
								
									34d6b23ba6
								
							
						
					
					
						commit
						a0460b8bfc
					
				
					 5 changed files with 37 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -8,14 +8,25 @@
 | 
			
		|||
 | 
			
		||||
#define	LFDF	'a'	/* Library Function Definition */
 | 
			
		||||
#define	LVDF	'b'	/* Library Variable Definition */
 | 
			
		||||
#define	EFDF	'c'	/* External Function Definition */
 | 
			
		||||
#define	EVDF	'd'	/* External Variable Definition */
 | 
			
		||||
#define	EFDC	'e'	/* External Function Declaration */
 | 
			
		||||
#define	EVDC	'f'	/* External Variable Declaration */
 | 
			
		||||
#define	IFDC	'g'	/* Implicit Function Declaration */
 | 
			
		||||
#define	SFDF	'h'	/* Static Function Definition */
 | 
			
		||||
#define	SVDF	'i'	/* Static Variable Definition */
 | 
			
		||||
#define	FC	'j'	/* Function Call */
 | 
			
		||||
#define	VU	'k'	/* Variable Usage */
 | 
			
		||||
#define	XXDF	'l'	/* Ignore Class */
 | 
			
		||||
 | 
			
		||||
#define	PFDF	'd'	/* Prototype Function Definition */
 | 
			
		||||
 | 
			
		||||
#define	EFDF	'f'	/* External Function Definition */
 | 
			
		||||
#define	EVDF	'g'	/* External Variable Definition */
 | 
			
		||||
#define	EFDC	'h'	/* External Function Declaration */
 | 
			
		||||
#define	EVDC	'i'	/* External Variable Declaration */
 | 
			
		||||
 | 
			
		||||
#define	IFDC	'm'	/* Implicit Function Declaration */
 | 
			
		||||
 | 
			
		||||
#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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@
 | 
			
		|||
#define	C_lin(c)
 | 
			
		||||
#define	C_loi(c)
 | 
			
		||||
#define	C_lol(c)
 | 
			
		||||
#define	C_ret(c)
 | 
			
		||||
#define	C_sdl(c)
 | 
			
		||||
#define	C_sti(c)
 | 
			
		||||
#define	C_stl(c)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -364,6 +364,10 @@ lint_ptr_conv(from, to)
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (from == VOID) {
 | 
			
		||||
		/* OK any which way */
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	if (from == CHAR) {
 | 
			
		||||
		hwarning("pointer to char may not align correctly for a %s",
 | 
			
		||||
			symbol2str(to));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ PRIVATE outargs();
 | 
			
		|||
PRIVATE outarg();
 | 
			
		||||
PRIVATE outargstring();
 | 
			
		||||
PRIVATE outargtype();
 | 
			
		||||
PRIVATE fill_arg();
 | 
			
		||||
PRIVATE add_expr_arg();
 | 
			
		||||
 | 
			
		||||
lint_declare_idf(idf, sc)
 | 
			
		||||
	struct idf *idf;
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +159,7 @@ local_EFDC(idf)
 | 
			
		|||
 | 
			
		||||
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.
 | 
			
		||||
 */
 | 
			
		||||
	register struct stack_entry *se = stack_level_of(L_FORMAL1)->sl_entry;
 | 
			
		||||
| 
						 | 
				
			
			@ -286,7 +286,7 @@ PRIVATE
 | 
			
		|||
output_def(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.
 | 
			
		||||
 */
 | 
			
		||||
	if (od->od_class == XXDF || !od->od_name || od->od_name[0] == '#')
 | 
			
		||||
| 
						 | 
				
			
			@ -301,7 +301,7 @@ output_def(od)
 | 
			
		|||
			od->od_class = LVDF;
 | 
			
		||||
			break;
 | 
			
		||||
		case SFDF:
 | 
			
		||||
			/* remove tp_entries */
 | 
			
		||||
			/* remove 'struct argument's */
 | 
			
		||||
			while (od->od_arg) {
 | 
			
		||||
				register struct argument *tmp = od->od_arg;
 | 
			
		||||
				od->od_arg = od->od_arg->next;
 | 
			
		||||
| 
						 | 
				
			
			@ -526,19 +526,20 @@ fill_outcall(ex, used)
 | 
			
		|||
	OutCall.od_arg = (struct argument *)0;
 | 
			
		||||
	OutCall.od_nrargs = 0;
 | 
			
		||||
 | 
			
		||||
	if ((ex = ex->OP_RIGHT) != 0) {	/* function call with arguments */
 | 
			
		||||
		/* store types of argument expressions in tp_entries */
 | 
			
		||||
	if ((ex = ex->OP_RIGHT) != 0) {
 | 
			
		||||
		/* function call with arguments */
 | 
			
		||||
		/* store types of argument expressions in 'struct argument's */
 | 
			
		||||
		while (ex->ex_class == Oper && ex->OP_OPER == PARCOMMA) {
 | 
			
		||||
			fill_arg(ex->OP_RIGHT);
 | 
			
		||||
			add_expr_arg(ex->OP_RIGHT);
 | 
			
		||||
			ex = ex->OP_LEFT;
 | 
			
		||||
		}
 | 
			
		||||
		fill_arg(ex);
 | 
			
		||||
		add_expr_arg(ex);
 | 
			
		||||
	}
 | 
			
		||||
	OutCall.od_valused = used;	/* USED, IGNORED or VOIDED */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
PRIVATE
 | 
			
		||||
fill_arg(e)
 | 
			
		||||
add_expr_arg(e)
 | 
			
		||||
	struct expr *e;
 | 
			
		||||
{
 | 
			
		||||
	register struct argument *arg;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
#define	ArgExpr		1		/* actual */
 | 
			
		||||
#define	ArgConst	2		/* integer constant */
 | 
			
		||||
#define	ArgString	3		/* string */
 | 
			
		||||
#define	ArgEllipsis	4		/* ellipsis */
 | 
			
		||||
 | 
			
		||||
struct argument {
 | 
			
		||||
	struct argument *next;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue