From 34d6b23ba6adf397bad808f1f7f9b18735f8ec8e Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 1 Jul 1991 14:10:15 +0000 Subject: [PATCH] Fixed two bugs: - did not accept arrays in 'if (a) ...' - did not detect too few parameters in functions with ellipsis prototypes --- lang/cem/cemcom.ansi/arith.c | 8 ++++++++ lang/cem/cemcom.ansi/proto.c | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom.ansi/arith.c index 4e2221736..0714f0811 100644 --- a/lang/cem/cemcom.ansi/arith.c +++ b/lang/cem/cemcom.ansi/arith.c @@ -489,7 +489,15 @@ opnd2logical(expp, oper) { int fund = (*expp)->ex_type->tp_fund; + if (fund == FUNCTION || fund == ARRAY) { + expr_warning(*expp, "%s operand to %s", + symbol2str(fund), + symbol2str(oper)); + if (fund == FUNCTION) function2pointer(*expp); + else array2pointer(*expp); + } #ifndef NOBITFIELD + else if (fund == FIELD) field2arith(expp); #endif NOBITFIELD diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom.ansi/proto.c index 5325ad35f..81e7fce20 100644 --- a/lang/cem/cemcom.ansi/proto.c +++ b/lang/cem/cemcom.ansi/proto.c @@ -465,9 +465,8 @@ call_proto(expp) } else any2parameter(estack[ecnt]); } - if (pcnt >= 0 && !(pstack[0]->pl_flag & PL_ELLIPSIS)) + if (pcnt > 0 || (pcnt == 0 && !(pstack[0]->pl_flag & PL_ELLIPSIS))) expr_error(*expp, "fewer parameters than specified in prototype"); - } else { if (pl && !(pl->pl_flag & PL_VOID)) expr_error(*expp, "fewer parameters than specified in prototype");