Branch: Tag:

2016-09-02

2016-09-02 08:52:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [cpp]: Use the precompiler for the define class.

100:    struct pike_string *,    struct string_builder *);    - struct define_struct + DECLARATIONS; +  + PIKECLASS define   { -  struct hash_entry link; /* must be first */ -  magic_define_fun magic; -  int args; -  ptrdiff_t num_parts; -  short inside; /* 1 - Don't expand. 2 - In use. */ -  short varargs; -  struct pike_string *first; -  struct define_part *parts; - }; +  CVAR struct hash_entry link; /* must be first */ +  CVAR magic_define_fun magic; +  CVAR int args; +  CVAR ptrdiff_t num_parts; +  CVAR short inside; /* 1 - Don't expand. 2 - In use. */ +  CVAR short varargs; +  CVAR struct pike_string *first; +  CVAR struct define_part *parts;    - static void init_define_struct(struct object *UNUSED(o)) +  DECLARE_STORAGE; +  + INIT   {    struct define_struct *def = (struct define_struct *)(Pike_fp->current_storage);    def->magic=0;
125:    def->link.s = NULL;   }    - static void exit_define_struct(struct object *UNUSED(o)) + EXIT   {    struct define_struct *d = (struct define_struct *)(Pike_fp->current_storage);    INT32 e;
138:    if(d->first)    free_string(d->first);   } + }    - static struct program *define_program = NULL; -  +    struct cpp   {    struct mapping *defines;
168:    return (struct define_struct *)get_storage(s->u.object, define_program);   }    - DECLARE_STORAGE; -  +    static void cpp_error(struct cpp *this, const char *err) ATTRIBUTE((noinline));   static void cpp_error_vsprintf (struct cpp *this, const char *fmt,    va_list args) ATTRIBUTE((noinline));
3622:   {    struct svalue s;    -  start_new_program(); -  ADD_STORAGE(struct define_struct); -  set_init_callback(init_define_struct); -  set_exit_callback(exit_define_struct); -  define_program = end_program(); -  -  defined_macro=alloc_empty_define(make_shared_string("defined"),0); -  defined_macro->magic=check_defined; -  defined_macro->args=1; -  defined_macro_sval = Pike_sp[-1]; -  Pike_sp--; -  +     efun_str = make_shared_string ("efun");    constant_str = make_shared_string ("constant");    defined_str = make_shared_string ("defined");
3642:       INIT;    +  defined_macro=alloc_empty_define(make_shared_string("defined"),0); +  defined_macro->magic=check_defined; +  defined_macro->args=1; +  defined_macro_sval = Pike_sp[-1]; +  Pike_sp--; +     ADD_INT_CONSTANT("__HAVE_CPP_PREFIX_SUPPORT__", 1, 0);       /* Somewhat tricky to add a _constant_ function in _static_modules.Builtin. */
3702:    free_string (constant_str);    free_string (defined_str);    -  free_program(define_program); +    #endif   }