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: decspecs.c,v 3.13 1994/06/24 12:03:08 ceriel Exp $ */
6 /* D E C L A R A T I O N S P E C I F I E R C H E C K I N G */
16 #include "noRoption.h"
18 extern char options[];
20 extern char *symbol2str();
22 struct decspecs null_decspecs;
25 register struct decspecs *ds;
27 /* The provisional decspecs ds as obtained from the program
28 is turned into a legal consistent decspecs.
30 register struct type *tp = ds->ds_type;
32 ASSERT(level != L_FORMAL1);
34 if ( level == L_GLOBAL &&
35 (ds->ds_sc == AUTO || ds->ds_sc == REGISTER)
37 warning("no global %s variable allowed",
38 symbol2str(ds->ds_sc));
42 if (level == L_FORMAL2) {
43 if (ds->ds_sc_given &&
44 ds->ds_sc != REGISTER){
45 error("%s formal illegal", symbol2str(ds->ds_sc));
49 /* The tests concerning types require a full knowledge of the
50 type and will have to be postponed to declare_idf.
53 /* some adjustments as described in RM 8.2 */
54 if (tp == 0 && ds->ds_size == 0 && ds->ds_unsigned == 0) {
55 ds->ds_notypegiven = 1;
60 switch (ds->ds_size) {
65 error("short with illegal type");
76 error("long with illegal type");
79 if (ds->ds_unsigned) {
80 switch (tp->tp_fund) {
84 warning("unsigned char not allowed");
91 warning("unsigned short not allowed");
101 warning("unsigned long not allowed");
106 error("unsigned with illegal type");