-/*****************************************************************************/
-/* Data */
-/*****************************************************************************/
-
-
-
-/* Maximum count of cases */
-#define CASE_MAX 257
-
-
-
/*****************************************************************************/
/* Helper functions */
/*****************************************************************************/
/* Generate a jump label and parse the condition */
Label1 = GetLocalLabel ();
- test (Label1, 0);
+ TestInParens (Label1, 0);
/* Parse the if body */
GotBreak = Statement (0);
/* Parse the end condition */
Consume (TOK_WHILE, "`while' expected");
- test (loop, 1);
+ TestInParens (loop, 1);
ConsumeSemi ();
/* Define the break label */
g_defcodelabel (loop);
/* Test the loop condition */
- test (lab, 0);
+ TestInParens (lab, 0);
/* Loop body */
Statement (&PendingToken);
/* Exit label */
g_defcodelabel (lab);
- /* Eat remaining tokens that were delayed because of line info
- * correctness
+ /* Eat remaining tokens that were delayed because of line info
+ * correctness
*/
SkipPending (PendingToken);
NextToken ();
if (CurTok.Tok != TOK_SEMI) {
- if (HasVoidReturn (CurrentFunc)) {
+
+ /* Check if the function has a return value declared */
+ if (F_HasVoidReturn (CurrentFunc)) {
Error ("Returning a value in function with return type void");
}
expression (&lval);
/* Convert the return value to the type of the function result */
- if (!HasVoidReturn (CurrentFunc)) {
- assignadjust (GetReturnType (CurrentFunc), &lval);
+ if (!F_HasVoidReturn (CurrentFunc)) {
+ assignadjust (F_GetReturnType (CurrentFunc), &lval);
}
- } else if (!HasVoidReturn (CurrentFunc)) {
- Error ("Function `%s' must return a value", GetFuncName (CurrentFunc));
+
+ } else if (!F_HasVoidReturn (CurrentFunc) && !F_HasOldStyleIntRet (CurrentFunc)) {
+ Error ("Function `%s' must return a value", F_GetFuncName (CurrentFunc));
}
/* Cleanup the stack in case we're inside a block with locals */
- g_space (oursp - GetTopLevelSP (CurrentFunc));
+ g_space (oursp - F_GetTopLevelSP (CurrentFunc));
/* Output a jump to the function exit code */
- g_jump (GetRetLab (CurrentFunc));
+ g_jump (F_GetRetLab (CurrentFunc));
}
/* Handle a 'for' statement */
{
ExprDesc lval1;
- ExprDesc lval2;
ExprDesc lval3;
int HaveIncExpr;
CodeMark IncExprStart;
/* Parse the test expression */
if (CurTok.Tok != TOK_SEMI) {
- boolexpr (&lval2);
- g_truejump (CF_NONE, lstat);
+ Test (lstat, 1);
g_jump (lab);
} else {
g_jump (lstat);
case TOK_SEMI:
/* Ignore it */
- NextToken ();
+ CheckSemi (PendingToken);
break;
case TOK_PRAGMA:
-
+