pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:88:      struct cpp;   struct define_struct;   typedef void (*magic_define_fun)(struct cpp *,    struct define_struct *,    struct pike_string *,    struct string_builder *);      DECLARATIONS;    + #define CPP_MACRO_DISABLED 1 /* Don't expand. */ + #define CPP_MACRO_IN_USE 2 /* In use. */ +    PIKECLASS define   {    PIKEVAR string name flags ID_PRIVATE|ID_PROTECTED;    PIKEVAR array(string|int) parts flags ID_PRIVATE|ID_PROTECTED;    CVAR magic_define_fun magic;    CVAR int args; -  CVAR short inside; /* 1 - Don't expand. 2 - In use. */ +  CVAR short flags; /* CPP_MACRO_* */    CVAR short varargs;       DECLARE_STORAGE;       INIT    {    struct define_struct *def = (struct define_struct *)(Pike_fp->current_storage);    def->magic=0;    def->args=-1; -  def->inside=0; +  def->flags = 0;    def->varargs=0;    }   }      struct cpp   {    struct mapping *defines;    INT_TYPE current_line;    INT32 compile_errors;    struct pike_string *current_file;
pike.git/src/cpp.cmod:1589:    */   static void undefine(struct cpp *this, struct pike_string *name)   {    ref_push_string(name);    push_int(0);    map_delete_no_free(this->defines, Pike_sp - 2, Pike_sp - 1);       if (TYPEOF(Pike_sp[-1]) == PIKE_T_OBJECT) {    struct object *o = Pike_sp[-1].u.object;    struct define_struct *def = (struct define_struct *)get_storage(o, define_program); -  if (def->inside) { +  if (def->flags & (CPP_MACRO_IN_USE | CPP_MACRO_DISABLED)) {    /* Restore the #define. */    mapping_insert(this->defines, Pike_sp - 2, Pike_sp - 1);    cpp_error(this, "Illegal to undefine a macro during its expansion.");    pop_n_elems(2);    return;    }    }       pop_n_elems(2);   }