pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:2240:    if( (name->len > 2) &&    (index_shared_string(name, name->len-1) == ')') &&    (index_shared_string(name, name->len-2) == '(')) {    /* Function-style macro. */    push_string(name = string_slice(name, 0, name->len-2));    }       /* NB: alloc_empty_define() pushes the define object onto the stack.    */    def = alloc_empty_define(name); -  mapping_string_insert(this->defines, def->name, Pike_sp-1); -  pop_stack(); +     -  if (orig_name != name) { -  /* Function-style macro. */ -  def->flags |= CPP_MACRO_VARARGS | CPP_MACRO_KEEP_NL; -  def->args = 1; -  pop_stack(); -  } -  +     if (!what || ((TYPEOF(*what) == PIKE_T_INT) && !what->u.integer)) {    ref_push_string(empty_pike_string);    f_aggregate(1);    def->parts = Pike_sp[-1].u.array;    Pike_sp--;    } else if (TYPEOF(*what) == PIKE_T_ARRAY) {    def->parts = what->u.array;    add_ref(what->u.array); -  } else { +  } else if ((TYPEOF(*what) == PIKE_T_STRING) || +  (TYPEOF(*what) == PIKE_T_FUNCTION)) {    push_svalue(what);    f_aggregate(1);    def->parts = Pike_sp[-1].u.array;    Pike_sp--; -  +  } else { +  Pike_error("Expected zero, string or function value for predefine %q.", +  name);    }    -  +  mapping_string_insert(this->defines, def->name, Pike_sp-1); +  pop_stack(); +  +  if (orig_name != name) { +  /* Function-style macro. */ +  def->flags |= CPP_MACRO_VARARGS | CPP_MACRO_KEEP_NL; +  def->args = 1; +  pop_stack(); +  } +     return def;   }      static void simple_add_define(struct CPP_struct *this,    const char *name,    const char *what)   {       struct pike_string *name_str = make_define_name(this, name);    push_text(what);