some fixes

This commit is contained in:
ceriel 1989-05-29 11:32:23 +00:00
parent aaea752423
commit aa0e321971
4 changed files with 19 additions and 17 deletions

View file

@ -4,5 +4,5 @@
* See the copyright notice in the ACK home directory, in the file "Copyright". * See the copyright notice in the ACK home directory, in the file "Copyright".
*/ */
#ifndef lint #ifndef lint
static char Version[] = "ACK CEM compiler Version 3.1"; static char Version[] = "ACK CEM compiler Version 3.2";
#endif lint #endif lint

View file

@ -53,12 +53,12 @@ ch7mon(oper, expp)
break; break;
case '&': case '&':
if ((*expp)->ex_type->tp_fund == ARRAY) { if ((*expp)->ex_type->tp_fund == ARRAY) {
warning("& before array ignored"); expr_warning(*expp, "& before array ignored");
array2pointer(*expp); array2pointer(*expp);
} }
else else
if ((*expp)->ex_type->tp_fund == FUNCTION) { if ((*expp)->ex_type->tp_fund == FUNCTION) {
warning("& before function ignored"); expr_warning(*expp, "& before function ignored");
function2pointer(*expp); function2pointer(*expp);
} }
else else
@ -146,7 +146,7 @@ ch7mon(oper, expp)
break; break;
case SIZEOF: case SIZEOF:
if (ISNAME(*expp) && (*expp)->VL_IDF->id_def->df_formal_array) if (ISNAME(*expp) && (*expp)->VL_IDF->id_def->df_formal_array)
warning("sizeof formal array %s is sizeof pointer!", expr_warning(*expp, "sizeof formal array %s is sizeof pointer!",
(*expp)->VL_IDF->id_text); (*expp)->VL_IDF->id_text);
expr = intexpr((*expp)->ex_class == String ? expr = intexpr((*expp)->ex_class == String ?
(arith)((*expp)->SG_LEN) : (arith)((*expp)->SG_LEN) :

View file

@ -132,7 +132,7 @@ domacro()
} }
PRIVATE PRIVATE
skip_block() skip_block(to_endif)
{ {
/* skip_block() skips the input from /* skip_block() skips the input from
1) a false #if, #ifdef, #ifndef or #elif until the 1) a false #if, #ifdef, #ifndef or #elif until the
@ -173,7 +173,7 @@ skip_block()
push_if(); push_if();
break; break;
case K_ELIF: case K_ELIF:
if (nestlevel == skiplevel) { if (! to_endif && nestlevel == skiplevel) {
nestlevel--; nestlevel--;
push_if(); push_if();
if (ifexpr()) { if (ifexpr()) {
@ -183,12 +183,14 @@ skip_block()
} }
break; break;
case K_ELSE: case K_ELSE:
if (! to_endif) {
++(ifstack[nestlevel]); ++(ifstack[nestlevel]);
if (nestlevel == skiplevel) { if (nestlevel == skiplevel) {
SkipRestOfLine(); SkipRestOfLine();
NoUnstack--; NoUnstack--;
return; return;
} }
}
break; break;
case K_ENDIF: case K_ENDIF:
ASSERT(nestlevel > nestlow); ASSERT(nestlevel > nestlow);
@ -328,7 +330,7 @@ do_elif()
else { /* restart at this level as if a #if is detected. */ else { /* restart at this level as if a #if is detected. */
nestlevel--; nestlevel--;
push_if(); push_if();
skip_block(); skip_block(1);
} }
} }
@ -340,7 +342,7 @@ do_else()
lexerror("#else without corresponding #if"); lexerror("#else without corresponding #if");
else { /* mark this level as else-d */ else { /* mark this level as else-d */
++(ifstack[nestlevel]); ++(ifstack[nestlevel]);
skip_block(); skip_block(1);
} }
} }
@ -359,7 +361,7 @@ do_if()
{ {
push_if(); push_if();
if (!ifexpr()) /* a false #if/#elif expression */ if (!ifexpr()) /* a false #if/#elif expression */
skip_block(); skip_block(0);
} }
PRIVATE PRIVATE
@ -377,7 +379,7 @@ do_ifdef(how)
(how && !id->id_macro) || (!how && id->id_macro) (how && !id->id_macro) || (!how && id->id_macro)
*/ */
if (how ^ (id && id->id_macro != 0)) if (how ^ (id && id->id_macro != 0))
skip_block(); skip_block(0);
else else
SkipRestOfLine(); SkipRestOfLine();
} }

View file

@ -5,8 +5,8 @@ E run preprocessor only
I expand include table with directory name following I expand include table with directory name following
M set identifier length M set identifier length
n don't generate register messages n don't generate register messages
p generate linenumbers and filename indications L don't generate linenumbers and filename indications
while generating EM code p trace
P in running the preprocessor do not output '# line' lines P in running the preprocessor do not output '# line' lines
R restricted C R restricted C
T take path following as directory for storing temporary file(s) T take path following as directory for storing temporary file(s)