SYSLIB = $(EMHOME)/modules/lib/libsystem.a
EMKLIB = $(EMHOME)/modules/lib/libemk.a
EMELIB = $(EMHOME)/modules/lib/libeme.a
-STRLIB = $(EMHOME)/modules/lib/libstr.a
+STRLIB = $(EMHOME)/modules/lib/libstring.a
PRTLIB = $(EMHOME)/modules/lib/libprint.a
EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a
INPLIB = $(EMHOME)/modules/lib/libinput.a
do not generate EM register messages.
The user-declared variables are not stored into registers on the target
machine.
-.IP \fB\-p\fR
-generate the EM \fBfil\fR and \fBlin\fR instructions in order to enable
+.IP \fB\-L\fR
+don't generate the EM \fBfil\fR and \fBlin\fR instructions
+that usually are generated to enable
an interpreter to keep track of the current location in the source code.
.IP \fB\-P\fR
like \fB\-E\fR but without #\fBline\fR control lines.
*expp = new_oper((*expp)->ex_type, *expp, oper, expr);
#endif NOBITFIELD
(*expp)->OP_TYPE = tp; /* for EVAL() */
+ (*expp)->ex_flags |= EX_SIDEEFFECTS;
}
/* Some interesting (?) questions answered.
else
*expp = new_oper((*expp)->ex_type->tp_up,
*expp, '(', expr);
+ (*expp)->ex_flags |= EX_SIDEEFFECTS;
break;
case PARCOMMA: /* RM 7.1 */
if ((*expp)->ex_type->tp_fund == FUNCTION)
}
break;
case LEFT:
- case LEFTAB:
case RIGHT:
+ case LEFTAB:
case RIGHTAB:
opnd2integral(expp, oper);
opnd2integral(&expr, oper);
lab_count = (label) 1;
return_label = text_label();
return_expr_occurred = 0;
- if (options['p']) { /* profiling */
+ if (! options['L']) { /* profiling */
if (strcmp(last_fn_given, FileName) != 0) {
/* previous function came from other file */
C_df_dlb(file_name_label = data_label());
generator. If line number trace is wanted, it generates a
lin instruction. EVAL() is called directly.
*/
- if (options['p']) /* profiling */
+ if (! options['L']) /* profiling */
C_lin((arith)LineNumber);
EVAL(expr, val, code, tlbl, flbl);
}
do_endif()
{
SkipRestOfLine();
- if (nestlevel-- < 0)
+ if (nestlevel < 0) {
lexerror("#endif without corresponding #if");
+ }
+ else nestlevel--;
}
PRIVATE
register struct expr *right = expr->OP_RIGHT;
register struct type *tp = expr->OP_TYPE;
- if (tp->tp_fund == ERRONEOUS) /* stop immediately */
+ if (tp->tp_fund == ERRONEOUS || (expr->ex_flags & EX_ERROR)) {
+ /* stop immediately */
break;
+ }
if (tp->tp_fund == VOID)
gencode = 0;
switch (oper) {
C_bra(false_label);
}
else {
- label l_true = text_label();
- label l_end = text_label();
-
- compare(oper, l_true);
- C_loc((arith)0);
- C_bra(l_end);
- C_df_ilb(l_true);
- C_loc((arith)1);
- C_df_ilb(l_end);
+ truthvalue(oper);
}
}
break;
load_val(left, RVAL);
}
else
- if (left->ex_depth == 1 && left->OP_OPER == ARROW) {
- compl = 1; /* Value->sel */
- ASSERT(left->OP_LEFT->ex_class == Value);
+ if (left->ex_depth == 1 &&
+ !(left->ex_flags & EX_SIDEEFFECTS)) {
+ compl = 1;
EVAL(left, RVAL, newcode, NO_LABEL, NO_LABEL);
}
else {
}
}
+/* truthvalue() serves as an auxiliary function of EVAL */
+truthvalue(relop)
+ int relop;
+{
+ switch (relop) {
+ case '<':
+ C_tlt();
+ break;
+ case LESSEQ:
+ C_tle();
+ break;
+ case '>':
+ C_tgt();
+ break;
+ case GREATEREQ:
+ C_tge();
+ break;
+ case EQUAL:
+ C_teq();
+ break;
+ case NOTEQUAL:
+ C_tne();
+ break;
+ default:
+ CRASH();
+ }
+}
+
+
/* assop() generates the opcode of an assignment operators op= */
assop(type, oper)
register struct type *type;
#define EX_LOGICAL 0004 /* contains logical operator */
#define EX_COMMA 0010 /* contains expression comma */
#define EX_PARENS 0020 /* the top level is parenthesized */
+#define EX_SIDEEFFECTS 0040 /* expression has side effects */
#define EX_ERROR 0200 /* the expression is wrong */
#define NILEXPR ((struct expr *)0)
break;
case 'L' :
- warning("-L: default no EM profiling; use -p for EM profiling");
+ options['L'] = 1; /* no fil/lin */
break;
case 'M': /* maximum identifier length */
fatal("maximum identifier length is %d", IDFSIZE);
break;
- case 'p' : /* generate profiling code (fil/lin) */
- options['p'] = 1;
- break;
-
case 'P' : /* run preprocessor stand-alone, without #'s */
#ifndef NOPP
options['E'] = 1;
/* copy the text of the actual parameter
into the replacement text
*/
- for (p = actpars[n - 1]; p && *p; p++) {
+ for (p = actpars[n - 1]; *p; p++) {
text[pos++] = *p;
if (pos == size)
text = Srealloc(text, size += RSTRSIZE);