From: eck Date: Fri, 29 Sep 1989 16:20:38 +0000 (+0000) Subject: minor changes concerning void and pre-processor X-Git-Tag: release-5-5~2270 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=4bde31f78ade66e0599b40a64d65f34b65745c96;p=ack.git minor changes concerning void and pre-processor --- diff --git a/lang/cem/cemcom.ansi/LLlex.c b/lang/cem/cemcom.ansi/LLlex.c index 3011aa88c..985691281 100644 --- a/lang/cem/cemcom.ansi/LLlex.c +++ b/lang/cem/cemcom.ansi/LLlex.c @@ -203,8 +203,7 @@ garbage: ptok->tk_bts = string_token("file specifier", '>', &(ptok->tk_len)); return ptok->tk_symb = FILESPECIFIER; - } - if (nch == '<') { + } else if (nch == '<') { if ((nch = GetChar()) == '=') return ptok->tk_symb = LEFTAB; UnGetChar(); @@ -321,15 +320,9 @@ garbage: idef->id_line = ptok->tk_line; #ifndef NOPP if (idef->id_macro && ReplaceMacros && !NoExpandNext) { -#if 0 - if (idef->id_macro->mc_count > 0) - idef->id_macro->mc_count--; - else -#endif /* 0 */ if (replace(idef)) goto again; } - NoExpandNext = 0; if (UnknownIdIsZero && idef->id_reserved != SIZEOF) { ptok->tk_ival = (arith)0; ptok->tk_fund = INT; diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom.ansi/arith.c index 745e1b231..86364cd2c 100644 --- a/lang/cem/cemcom.ansi/arith.c +++ b/lang/cem/cemcom.ansi/arith.c @@ -143,14 +143,13 @@ relbalance(e1p, oper, e2p) function2pointer(*e2p); if ((*e1p)->ex_type->tp_fund == POINTER) ch3pointer(e2p, oper, (*e1p)->ex_type); - else - if ((*e2p)->ex_type->tp_fund == POINTER) + else if ((*e2p)->ex_type->tp_fund == POINTER) ch3pointer(e1p, oper, (*e2p)->ex_type); - else - if ( (*e1p)->ex_type == (*e2p)->ex_type && - (*e1p)->ex_type->tp_fund == ENUM - ) - {} + else if ((*e1p)->ex_type == (*e2p)->ex_type + && (*e1p)->ex_type->tp_fund == ENUM) {} + else if (oper == ':' + && (*e1p)->ex_type->tp_fund == VOID + && (*e2p)->ex_type->tp_fund == VOID) {} else arithbalance(e1p, oper, e2p); } @@ -160,7 +159,7 @@ ch3pointer(expp, oper, tp) register struct type *tp; { /* Checks whether *expp may be compared to tp using oper, - as described in chapter 7.6 and 7.7. + as described in chapter 3.3.8 and 3.3.9. tp is known to be a pointer. */ register struct expr *exp = *expp; diff --git a/lang/cem/cemcom.ansi/ch3.c b/lang/cem/cemcom.ansi/ch3.c index a15840d88..81b035184 100644 --- a/lang/cem/cemcom.ansi/ch3.c +++ b/lang/cem/cemcom.ansi/ch3.c @@ -195,8 +195,9 @@ ch3cast(expp, oper, tp) } else #endif NOBITFIELD - if (equal_type(tp, oldtp, 0)) { + if (equal_type(tp, oldtp, oper != CAST)) { /* life is easy */ + (*expp)->ex_type = tp; /* so qualifiers are allright */ } else if (tp->tp_fund == VOID) { @@ -382,14 +383,16 @@ equal_type(tp, otp, check_qual) case POINTER: if (equal_type(tp->tp_up, otp->tp_up, check_qual)) { - if (otp->tp_up->tp_typequal & TQ_CONST) { - if (!(tp->tp_up->tp_typequal & TQ_CONST)) { - strict("illegal use of pointer to const object"); + if (check_qual) { + if (otp->tp_up->tp_typequal & TQ_CONST) { + if (!(tp->tp_up->tp_typequal & TQ_CONST)) { + strict("illegal use of pointer to const object"); + } } - } - if (otp->tp_up->tp_typequal & TQ_VOLATILE) { - if (!(tp->tp_up->tp_typequal & TQ_VOLATILE)) { - strict("illegal use of pointer to volatile object"); + if (otp->tp_up->tp_typequal & TQ_VOLATILE) { + if (!(tp->tp_up->tp_typequal & TQ_VOLATILE)) { + strict("illegal use of pointer to volatile object"); + } } } return 1; @@ -568,8 +571,8 @@ ch3asgn(expp, oper, expr) /* Preserve volatile markers across the tree. This is questionable, depending on the way the optimizer wants this information. - vol = (exp->ex_flags & EX_VOLATILE) || (expr->ex_flags & EX_VOLATILE); */ + vol = (exp->ex_flags & EX_VOLATILE) || (expr->ex_flags & EX_VOLATILE); if (oper == '=') { ch3cast(&expr, oper, exp->ex_type); @@ -587,7 +590,7 @@ ch3asgn(expp, oper, expr) ((typeof (f op e))f op (typeof (f op e))e), where f ~ extmp and e ~ expr. We want to use (typeof (f op e))e. - Ch7bin does not create a tree if both operands + Ch3bin does not create a tree if both operands were illegal or constants! */ tp = extmp->ex_type; /* perform the arithmetic in type tp */ diff --git a/lang/cem/cemcom.ansi/ch3bin.c b/lang/cem/cemcom.ansi/ch3bin.c index 51de8ce3f..f2af26343 100644 --- a/lang/cem/cemcom.ansi/ch3bin.c +++ b/lang/cem/cemcom.ansi/ch3bin.c @@ -167,7 +167,7 @@ ch3bin(expp, oper, expr) case RIGHTAB: opnd2integral(expp, oper); opnd2integral(&expr, oper); - arithbalance(expp, oper, &expr); /* ch. 7.5 */ + arithbalance(expp, oper, &expr); /* ch. 3.3.7 */ ch3cast(&expr, oper, int_type); /* cvt. rightop to int */ non_commutative_binop(expp, oper, expr); break; diff --git a/lang/cem/cemcom.ansi/ch3mon.c b/lang/cem/cemcom.ansi/ch3mon.c index 8538dc2d7..b047671f0 100644 --- a/lang/cem/cemcom.ansi/ch3mon.c +++ b/lang/cem/cemcom.ansi/ch3mon.c @@ -100,7 +100,7 @@ ch3mon(oper, expp) (*expp)->ex_type = pointer_to((*expp)->ex_type, (*expp)->ex_type->tp_typequal); (*expp)->ex_lvalue = 0; - (*expp)->ex_flags &= ~EX_READONLY; + (*expp)->ex_flags &= ~(EX_READONLY | EX_VOLATILE); } break; case '~': diff --git a/lang/cem/cemcom.ansi/class.h b/lang/cem/cemcom.ansi/class.h index 737713189..5c5df084e 100644 --- a/lang/cem/cemcom.ansi/class.h +++ b/lang/cem/cemcom.ansi/class.h @@ -22,7 +22,7 @@ #define STGARB 2 /* garbage ascii character: not allowed in C */ #define STSIMP 3 /* this character can occur as token in C */ #define STCOMP 4 /* this one can start a compound token in C */ -#define STELL 5 /* possible start of wide char stuff or idf */ +#define STELL 5 /* wide character- or string- constant prefix */ #define STIDF 6 /* being the initial character of an identifier */ #define STCHAR 7 /* the starter of a character constant */ #define STSTR 8 /* the starter of a string */ diff --git a/lang/cem/cemcom.ansi/declar.g b/lang/cem/cemcom.ansi/declar.g index 499c0270f..86ca4b714 100644 --- a/lang/cem/cemcom.ansi/declar.g +++ b/lang/cem/cemcom.ansi/declar.g @@ -641,14 +641,7 @@ parameter_declarator(register struct declarator *dc;) parameter_type_list(&pl) | formal_list(&fm) - | - /* empty */ - { - pl = new_proto(); - pl->pl_type = void_type; - pl->pl_flag = PL_VOID; - } - ] + ]? ')' { add_decl_unary(dc, FUNCTION, 0, (arith)0, fm, pl); reject_params(dc); diff --git a/lang/cem/cemcom.ansi/declarator.c b/lang/cem/cemcom.ansi/declarator.c index dde0314d9..318473fda 100644 --- a/lang/cem/cemcom.ansi/declarator.c +++ b/lang/cem/cemcom.ansi/declarator.c @@ -117,7 +117,7 @@ check_array_subscript(expr) } else if (size == 0) { - warning("array size is 0"); + strict("array size is 0"); } else if (size & ~max_unsigned) { /* absolutely ridiculous */ diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 6da31a738..70f1da547 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -39,8 +39,8 @@ GetIdentifier(skiponerr) { /* returns a pointer to the descriptor of the identifier that is read from the input stream. When the input doe not contain - an identifier, the rest of the line is skipped and a - null-pointer is returned. + an identifier, the rest of the line is skipped when + skiponerr is on, and a null-pointer is returned. The substitution of macros is disabled. */ int tmp = UnknownIdIsZero; @@ -422,7 +422,7 @@ do_undef() if (id->id_macro->mc_flag & NOUNDEF) { lexerror("it is not allowed to undef %s", id->id_text); } else { - free(id->id_text); + free(id->id_macro->mc_text); free_macro(id->id_macro); id->id_macro = (struct macro *) 0; } @@ -539,7 +539,6 @@ macro_def(id, text, nformals, length, flags) newdef->mc_nps = nformals; /* nr of formals */ newdef->mc_length = length; /* length of repl. text */ newdef->mc_flag = flags; /* special flags */ - newdef->mc_count = 0; } int @@ -699,11 +698,17 @@ domacro() EoiForNewline = 1; if ((tok = GetToken(&tk)) == IDENTIFIER) { - if (strcmp(tk.tk_idf->id_text, "line") != 0) { + if (strcmp(tk.tk_idf->id_text, "line") + && strcmp(tk.tk_idf->id_text, "pragma")) { error("illegal # line"); SkipToNewLine(0); return; } + else if ( !strcmp(tk.tk_idf->id_text, "pragma")) { + do_pragma(); + EoiForNewline = 0; + return; + } tok = GetToken(&tk); } if (tok != INTEGER) { diff --git a/lang/cem/cemcom.ansi/eval.c b/lang/cem/cemcom.ansi/eval.c index 0defbfe92..82f233008 100644 --- a/lang/cem/cemcom.ansi/eval.c +++ b/lang/cem/cemcom.ansi/eval.c @@ -635,6 +635,7 @@ EVAL(expr, val, code, true_label, false_label) default: crash("(EVAL) bad expression class"); } + if (expr->ex_flags & EX_VOLATILE) C_nop(); } /* compare() serves as an auxiliary function of EVAL */ diff --git a/lang/cem/cemcom.ansi/expression.g b/lang/cem/cemcom.ansi/expression.g index c3f23786a..3caa6e1a1 100644 --- a/lang/cem/cemcom.ansi/expression.g +++ b/lang/cem/cemcom.ansi/expression.g @@ -22,7 +22,7 @@ int InSizeof = 0; /* inside a sizeof- expression */ int ResultKnown = 0; /* result of the expression is already known */ /* Since the grammar in the standard is not LL(n), it is modified so that - * it accepts basically the same grammar. Thsi means that there is no 1-1 + * it accepts basically the same grammar. This means that there is no 1-1 * mapping from the grammar in the standard to the grammar given here. * Such is life. */ diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index c8c06d655..dabf7bcac 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -210,7 +210,7 @@ declare_idf(ds, dc, lvl) } else if (type->tp_fund != LABEL) { /* CJ */ - warning("%s has size 0", idf->id_text); + strict("%s has size 0", idf->id_text); } } } diff --git a/lang/cem/cemcom.ansi/init.c b/lang/cem/cemcom.ansi/init.c index 9476ed466..212ce68ac 100644 --- a/lang/cem/cemcom.ansi/init.c +++ b/lang/cem/cemcom.ansi/init.c @@ -74,6 +74,7 @@ init_pp() /* __DATE__ */ sprintf(dbuf, "\"%.3s %.2d %d\"", months[tp->tm_mon], tp->tm_mday, tp->tm_year+1900); + if (tp->tm_mday < 10) dbuf[5] = ' '; /* hack */ macro_def(str2idf("__DATE__"), dbuf, -1, strlen(dbuf), NOUNDEF); /* __TIME__ */ diff --git a/lang/cem/cemcom.ansi/input.c b/lang/cem/cemcom.ansi/input.c index 6e917e47e..3f6250908 100644 --- a/lang/cem/cemcom.ansi/input.c +++ b/lang/cem/cemcom.ansi/input.c @@ -44,8 +44,6 @@ getwdir(fn) int NoUnstack; int InputLevel; -#if 0 -#endif AtEoIT() { diff --git a/lang/cem/cemcom.ansi/ival.g b/lang/cem/cemcom.ansi/ival.g index 38fc01e34..a927188a2 100644 --- a/lang/cem/cemcom.ansi/ival.g +++ b/lang/cem/cemcom.ansi/ival.g @@ -475,8 +475,11 @@ check_ival(expp, tp) if (expr->VL_CLASS == Name) { register struct idf *idf = expr->VL_IDF; - if (idf->id_def->df_level >= L_LOCAL) + if (idf->id_def->df_level >= L_LOCAL + && idf->id_def->df_sc != GLOBAL + && idf->id_def->df_sc != EXTERN) { illegal_init_cst(expr); + } else /* e.g., int f(); int p = f; */ if (idf->id_def->df_type->tp_fund == FUNCTION) C_con_pnam(idf->id_text); diff --git a/lang/cem/cemcom.ansi/macro.str b/lang/cem/cemcom.ansi/macro.str index fa8fb7d15..ae0692269 100644 --- a/lang/cem/cemcom.ansi/macro.str +++ b/lang/cem/cemcom.ansi/macro.str @@ -11,10 +11,10 @@ /* The flags of the mc_flag field of the macro structure. Note that these flags can be set simultaneously. */ -#define NOFLAG 0 /* no special flags */ +#define NOFLAG 0 /* no special flags */ #define FUNC 0x1 /* function attached */ -#define NOUNDEF 0x2 /* special macro */ -#define NOREPLACE 0x4 /* prevent recursion */ +#define NOUNDEF 0x2 /* reserved macro */ +#define NOREPLACE 0x4 /* prevent recursion */ #define FORMALP 0200 /* mask for creating macro formal parameter */ @@ -28,7 +28,6 @@ struct macro { char * mc_text; /* the replacement text */ int mc_nps; /* number of formal parameters */ int mc_length; /* length of replacement text */ - int mc_count; /* # of "concurrent" invocations*/ char mc_flag; /* marking this macro */ }; diff --git a/lang/cem/cemcom.ansi/pragma.c b/lang/cem/cemcom.ansi/pragma.c index e350c4cf5..783e51b86 100644 --- a/lang/cem/cemcom.ansi/pragma.c +++ b/lang/cem/cemcom.ansi/pragma.c @@ -11,9 +11,6 @@ #include "debug.h" #include "idf.h" #include "input.h" -#include "nopp.h" - -#ifndef NOPP #include "ifdepth.h" #include "botch_free.h" #include "nparams.h" @@ -58,15 +55,9 @@ do_pragma() break; case P_UNKNOWN: - strict("unknown pragma directive %s", id->id_text); - break; - default: - strict("unimplemented pragma directive"); break; } SkipToNewLine(0); } - else strict("unrecognized pragma line"); } -#endif diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index 11aa83b21..c800ae108 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -40,23 +40,20 @@ replace(idf) higher interface to the real thing: expand_macro(). */ struct repl *repl; - + if (!(idf->id_macro)) return 0; - if (idf->id_macro->mc_flag & NOREPLACE){ + if (idf->id_macro->mc_flag & NOREPLACE) return 0; - } repl = new_repl(); repl->r_ptr = repl->r_text; repl->r_args = new_args(); repl->r_idf = idf; -/* repl->r_level = InputLevel; /* ?? temporary */ - if (!expand_macro(repl, idf)) { + if (!expand_macro(repl, idf)) return 0; - } InputLevel++; InsertText(repl->r_text, repl->r_ptr - repl->r_text); - repl->r_level = InputLevel; idf->id_macro->mc_flag |= NOREPLACE; + repl->r_level = InputLevel; repl->next = ReplaceList; ReplaceList = repl; return 1; @@ -122,7 +119,7 @@ expand_macro(repl, idf) #ifdef DEBUG if (strcmp("defined", idf->id_text)) crash("in %s, %u: assertion %s failed", - __FILE__, __LINE__ - 2, + __FILE__, __LINE__ - 2, "strcmp(\"defined\", idf->id_text)"); #endif if (!AccDefined) return 0; @@ -133,10 +130,6 @@ expand_macro(repl, idf) ch = GetChar(); ch = skipspaces(ch,1); if (ch != '(') { /* no replacement if no () */ - /* This is obscure. See the examples for the - replace algorithm in section 3`.8.3.5. - lexwarning("macro %s needs arguments", idf->id_text); - */ UnGetChar(); return 0; } else @@ -153,7 +146,7 @@ expand_macro(repl, idf) #define a + a+b; --> + + b ; - + 'a' must be substituded, but the result should be three tokens: + + ID. Because this preprocessor is character based, we have a problem. @@ -201,7 +194,7 @@ expand_defined(repl) } getactuals(repl, idf) - struct repl* repl; + struct repl *repl; register struct idf *idf; { /* Get the actual parameters from the input stream. @@ -217,7 +210,7 @@ getactuals(repl, idf) args->a_expvec[0] = args->a_expptr = &args->a_expbuf[0]; args->a_rawvec[0] = args->a_rawptr = &args->a_rawbuf[0]; if ((ch = GetChar()) != ')') { - PushBack(); + UnGetChar(); while ((ch = actual(repl)) != ')' ) { if (ch != ',') { lexerror("illegal macro call"); @@ -257,11 +250,11 @@ struct repl *repl; like macro calls. It makes the following code work: - #define def(a,b) x(a,b) + #define def(a,b) x(a,b) #define glue(a,b) a ## b glue(abc,def(a,b)) - + Results in: abcdef(a,b); @@ -371,7 +364,8 @@ actual(repl) } UnGetChar(); } else if (ch == '(' || ch == '[' || ch == '{') { - /* a comma may occur within these constructions */ + /* a comma may occur within these constructions ??? + */ level++; stash(repl, ch, !nostashraw); } else if (ch == ')' || ch == ']' || ch == '}') { @@ -392,7 +386,7 @@ actual(repl) /* newlines are accepted as white spaces */ LineNumber++; while ((ch = GetChar()), class(ch) == STSKIP) - /* VOID */; + /* EMPTY */; /* This piece of code needs some explanation: consider the call of a macro defined as: @@ -456,7 +450,7 @@ macro_func(idef) register struct idf *idef; { /* macro_func() performs the special actions needed with some - macros. These macros are __FILE__ and __LINE__ which + macros. These macros are __FILE__ and __LINE__ which replacement texts must be evaluated at the time they are used. */ @@ -504,7 +498,7 @@ macro2buffer(repl, idf, args) | TOKEN '##' PARAMETER | PARAMETER '##' PARAMETER ; - + As the grammar indicates, we could make a DFA and use this finite state machine for the replacement list parsing (inserting the arguments, etc.). @@ -526,11 +520,11 @@ macro2buffer(repl, idf, args) do { *repl->r_ptr++ = *ptr; if (*ptr == '\\') - *repl->r_ptr++ = *++ptr; + *repl->r_ptr++ = *++ptr; if (*ptr == '\0') { - lexerror("unterminated string"); - *repl->r_ptr = '\0'; - return; + lexerror("unterminated string"); + *repl->r_ptr = '\0'; + return; } ptr++; } while (*ptr != delim || *ptr == '\0'); @@ -543,21 +537,20 @@ macro2buffer(repl, idf, args) /* trim the actual replacement list */ --repl->r_ptr; while (is_wsp(*repl->r_ptr) - && repl->r_ptr >= repl->r_text) - --repl->r_ptr; + && repl->r_ptr >= repl->r_text) + --repl->r_ptr; - /* ## occurred at the beginning of the - replacement list. - */ + /* ## occurred at the beginning of the replacement list. + */ if (repl->r_ptr == repl->r_text && is_wsp(*repl->r_ptr)) { - err = 1; - break; + err = 1; + break; } while(*repl->r_ptr == TOKSEP - && repl->r_ptr >= repl->r_text) - --repl->r_ptr; + && repl->r_ptr >= repl->r_text) + --repl->r_ptr; tmpptr = repl->r_ptr; ++repl->r_ptr; @@ -567,7 +560,7 @@ macro2buffer(repl, idf, args) ptr++; /* ## occurred at the end of the replacement list. - */ + */ if (*ptr & FORMALP) { register int n = *ptr++ & 0177; register char *p; @@ -598,13 +591,13 @@ macro2buffer(repl, idf, args) if (*tmpptr == NOEXPM) *tmpptr = TOKSEP; } } - } else + } else /* # operator */ ptr = stringify(repl, ptr, args); } else if (*ptr & FORMALP) { /* insert actual parameter */ register int n = *ptr++ & 0177; register char *p, *q; - + ASSERT(n > 0); /* This is VERY dirty, we look ahead for the @@ -613,7 +606,7 @@ macro2buffer(repl, idf, args) one. */ for (p = ptr; (*p & FORMALP) == 0 && is_wsp(*p); p++) - /* EMPTY */; + /* EMPTY */; if (*p == '#' && p[1] == '#') q = args->a_rawvec[n-1]; else @@ -632,7 +625,6 @@ macro2buffer(repl, idf, args) *repl->r_ptr = '\0'; if (err) lexerror("illegal use of the ## operator"); - return; } char * @@ -664,7 +656,7 @@ stringify(repl, ptr, args) if (*ptr & FORMALP) { register int n = *ptr++ & 0177; register char *p; - + ASSERT(n != 0); p = args->a_rawvec[n-1]; *repl->r_ptr++ = '"'; @@ -692,11 +684,12 @@ stringify(repl, ptr, args) /* trim spaces in the replacement list */ for (--repl->r_ptr; is_wsp(*repl->r_ptr); repl->r_ptr--) - /* VOID */; + /* EMPTY */; *++repl->r_ptr = '"'; ++repl->r_ptr; /* oops, one to far */ } else error("illegal use of # operator"); + *repl->r_ptr = '\0'; return ptr; } diff --git a/lang/cem/cemcom.ansi/skip.c b/lang/cem/cemcom.ansi/skip.c index 94fdd3b8c..7a06c7881 100644 --- a/lang/cem/cemcom.ansi/skip.c +++ b/lang/cem/cemcom.ansi/skip.c @@ -50,7 +50,7 @@ skipspaces(ch, skipnl) return '/'; } } - else if(nlseen && ch == '#') { + else if (nlseen && ch == '#') { domacro(); ch = GetChar(); } else diff --git a/lang/cem/cemcom.ansi/switch.c b/lang/cem/cemcom.ansi/switch.c index 8d4575e95..ce1230e1a 100644 --- a/lang/cem/cemcom.ansi/switch.c +++ b/lang/cem/cemcom.ansi/switch.c @@ -60,9 +60,16 @@ code_startswitch(expp) switch (fund) { case LONG: + /* switches on longs should work. Unfortunately, no backend + * has simplemented switches with sizes other than the + * word_size. Furthermore, building the rom should then be + * done using C_rom_icon(). + * Just cast the expression to int and give a warning when + * this means truncation. + */ if (long_size > int_size) warning("can't switch on longs (cast to int)"); - int2int(expp, int_type); + int2int(expp, int_type); /* for now ??? */ break; case FLOAT: case DOUBLE: diff --git a/lang/cem/cemcom.ansi/tokenname.c b/lang/cem/cemcom.ansi/tokenname.c index b7ea1a1bb..80aa489af 100644 --- a/lang/cem/cemcom.ansi/tokenname.c +++ b/lang/cem/cemcom.ansi/tokenname.c @@ -37,6 +37,16 @@ struct tokenname tkspec[] = { /* the names of the special tokens */ #ifdef ____ struct tokenname tkcomp[] = { /* names of the composite tokens */ + {PLUSAB, "+="}, + {MINAB, "-="}, + {TIMESAB, "*="}, + {DIVAB, "/="}, + {MODAB, "%="}, + {LEFTAB, "<<="}, + {RIGHTAB, ">>="}, + {ANDAB, "&="}, + {XORAB, "^="}, + {ORAB, "|="}, {NOTEQUAL, "!="}, {AND, "&&"}, {PLUSPLUS, "++"}, @@ -113,16 +123,6 @@ struct tokenname tkfunny[] = { /* internal keywords */ {CASTAB, "castab"}, {POSTINCR, "postfix ++"}, {POSTDECR, "postfix --"}, - {PLUSAB, "+="}, - {MINAB, "-="}, - {TIMESAB, "*="}, - {DIVAB, "/="}, - {MODAB, "%="}, - {LEFTAB, "<<="}, - {RIGHTAB, ">>="}, - {ANDAB, "&="}, - {XORAB, "^="}, - {ORAB, "|="}, {INT2INT, "int2int"}, {INT2FLOAT, "int2float"}, diff --git a/lang/cem/cemcom.ansi/type.c b/lang/cem/cemcom.ansi/type.c index f1cada94b..00a0a6583 100644 --- a/lang/cem/cemcom.ansi/type.c +++ b/lang/cem/cemcom.ansi/type.c @@ -112,7 +112,7 @@ construct_type(fund, tp, qual, count, pl) count = (arith)-1; } else if (tp->tp_size == 0) /* CJ */ - warning("array elements have size 0"); + strict("array elements have size 0"); if (count >= (arith)0) count *= tp->tp_size; dtp = array_of(tp, count, qual);