Branch: Tag:

2021-10-02

2021-10-02 12:47:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Cpp: Add some paranoia against errors being thrown.

3508:    struct pike_string *charset)   {    struct svalue *save_sp = Pike_sp; -  int save_flags; +  JMP_BUF tmp;       /* Keep d around... */    push_svalue(&d->self);       stack_swap();    -  +  if (!SETJMP(tmp)) {    if ((d->args == 1) && !Pike_sp[-1].u.array->size &&    !(d->flags & CPP_MACRO_VARARGS)) {    // Allow a single argument to be left out.
3526:    push_int(flags);    apply_lfun(d->self.u.object, LFUN_CALL, 3);    +  UNSETJMP(tmp); +     if (TYPEOF(Pike_sp[-1]) == PIKE_T_STRING) { -  save_flags = d->flags; +  int save_flags = d->flags;    d->flags |= CPP_MACRO_DISABLED;       /* NB: We're executing in the CPP context object. */
3539:    } else {    this->compile_errors++;    } +  } else { +  UNSETJMP(tmp);    -  +  this->compile_errors++; +  } +     /* NB: Pop the args array too... */    pop_n_elems(Pike_sp + 1 - save_sp);   }