From 8a00e32bc85b471460ee229542b92ca0756f96f1 Mon Sep 17 00:00:00 2001 From: eck Date: Mon, 12 Nov 1990 15:28:44 +0000 Subject: [PATCH] fixed type of sizeof (decreases size!) fixed bug with typedef of function with block scope --- lang/cem/cemcom.ansi/cemcom.1 | 2 ++ lang/cem/cemcom.ansi/expr.c | 32 +++++-------------------------- lang/cem/cemcom.ansi/idf.c | 2 +- lang/cem/cemcom.ansi/make.tokfile | 2 +- lang/cem/cemcom.ansi/options | 1 + 5 files changed, 10 insertions(+), 29 deletions(-) diff --git a/lang/cem/cemcom.ansi/cemcom.1 b/lang/cem/cemcom.ansi/cemcom.1 index b23b487fd..0d2b8225e 100644 --- a/lang/cem/cemcom.ansi/cemcom.1 +++ b/lang/cem/cemcom.ansi/cemcom.1 @@ -85,6 +85,8 @@ suppress warning messages. suppress stricts. .IP \fB\-a\fR suppress warnings and stricts. +.IP \fB\-o\fR +suppress warnings and stricts about old-style. .IP \fB\-\-\fItext\fR .br where \fItext\fR can be either of the above or diff --git a/lang/cem/cemcom.ansi/expr.c b/lang/cem/cemcom.ansi/expr.c index 7d1787806..e32930369 100644 --- a/lang/cem/cemcom.ansi/expr.c +++ b/lang/cem/cemcom.ansi/expr.c @@ -294,39 +294,17 @@ fill_int_expr(ex, ivalue, fund) case INT: ex->ex_type = int_type; break; - case INTEGER: - if (ivalue >= 0 && ivalue <= max_int) { - ex->ex_type = int_type; - break; - } - /*FALL THROUGH*/ + case UNSIGNED: + ex->ex_type = uint_type; + break; case LONG: - ex->ex_type = - (ivalue & (1L << (8*long_size - 1))) ? ulong_type - : long_type; + ex->ex_type = long_type; break; case ULONG: ex->ex_type = ulong_type; break; - case UNSIGNED: - /* We cannot make a test like - ivalue <= max_unsigned - because, if - sizeof(arith) == int_size - holds, max_unsigned may be a negative arith in - which case the comparison results in an unexpected - answer. - */ - ex->ex_type = - (ivalue & ~max_int) ? - ( (ivalue & ~max_unsigned) ? - ( ivalue & (1L<<(8*long_size-1)) ? - ulong_type : long_type - ) : uint_type - ) : int_type; - break; default: - crash("(intexpr) bad fund %s\n", symbol2str(fund)); + crash("(fill_int_expr) bad fund %s\n", symbol2str(fund)); /*NOTREACHED*/ } ex->ex_class = Value; diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 900915c62..30bbce415 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -250,7 +250,7 @@ declare_idf(ds, dc, lvl) if (lvl != L_GLOBAL) { /* 3.5.1 */ if (sc == 0) sc = GLOBAL; - else if (sc != EXTERN) { + else if (sc != EXTERN && sc != TYPEDEF) { error("illegal storage class %s for function with block-scope" , symbol2str(sc)); ds->ds_sc = sc = EXTERN; diff --git a/lang/cem/cemcom.ansi/make.tokfile b/lang/cem/cemcom.ansi/make.tokfile index 74a7c44d9..26381e13f 100755 --- a/lang/cem/cemcom.ansi/make.tokfile +++ b/lang/cem/cemcom.ansi/make.tokfile @@ -1,6 +1,6 @@ cat <<'--EOT--' /* Generated by make.tokfile */ -/* $Header: */ +/* $Header$ */ --EOT-- sed ' diff --git a/lang/cem/cemcom.ansi/options b/lang/cem/cemcom.ansi/options index 83ab79749..75feae9f0 100644 --- a/lang/cem/cemcom.ansi/options +++ b/lang/cem/cemcom.ansi/options @@ -12,6 +12,7 @@ m generate file.o: file1.h format dependency lines M set identifier length n don't generate register messages L don't generate linenumbers and filename indications +o no warnings or stricts about normal old-style constuctions p trace P in running the preprocessor do not output '# line' lines R restricted C -- 2.34.1