2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 /* $Id: declarator.c,v 3.11 1994/06/24 12:03:05 ceriel Exp $ */
6 /* D E C L A R A T O R M A N I P U L A T I O N */
8 #include "botch_free.h"
19 struct declarator null_declarator;
24 struct declarator *dc;
26 /* Applies the decl_unary list starting at dc->dc_decl_unary
27 to the type tp and returns the result.
29 register struct decl_unary *du = dc->dc_decl_unary;
32 tp = construct_type(du->du_fund, tp, du->du_count);
38 add_decl_unary(dc, fund, count, fm)
39 register struct declarator *dc;
43 /* A decl_unary describing a constructor with fundamental
44 type fund and with size count is inserted in front of the
47 register struct decl_unary *new = new_decl_unary();
49 new->next = dc->dc_decl_unary;
51 new->du_count = count;
53 if (dc->dc_decl_unary) {
54 /* paramlist only allowed at first decl_unary */
55 error("formal parameter list discarded");
58 /* register the parameters */
62 dc->dc_decl_unary = new;
66 struct declarator *dc;
68 /* The decl_unary list starting at dc->dc_decl_unary is
71 register struct decl_unary *du = dc->dc_decl_unary;
74 struct decl_unary *old_du = du;
77 free_decl_unary(old_du);
82 register struct declarator *dc;
84 /* The declarator is checked to have no parameters, if it
88 error("non_empty formal parameter pack");
89 free_formals(dc->dc_formal);
94 check_array_subscript(expr)
95 register struct expr *expr;
97 arith size = expr->VL_VALUE;
100 error("array size is negative");
101 expr->VL_VALUE = (arith)1;
105 warning("array size is 0");
108 if (size & ~max_unsigned) { /* absolutely ridiculous */
109 expr_error(expr, "overflow in array size");
110 expr->VL_VALUE = (arith)1;