# New Ticket Created by Steve Peters # Please include the string: [perl #42602] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42602 >
Thanks to Mark Glines email, the following appears to be the remaining C++ keywords hanging about. Steve Peters [EMAIL PROTECTED]
Index: src/debug.c =================================================================== --- src/debug.c (revision 18278) +++ src/debug.c (working copy) @@ -1273,7 +1273,7 @@ PDB_escape(const char *string, INTVAL length) { const char *end; - char *new,*fill; + char *_new,*fill; length = length > 20 ? 20 : length; end = string + length; @@ -1282,7 +1282,7 @@ if (!string) return NULL; - fill = new = (char *)mem_sys_allocate(length * 2 + 1); + fill = _new = (char *)mem_sys_allocate(length * 2 + 1); for (; string < end; string++) { switch (*string) { @@ -1320,7 +1320,7 @@ } } *fill = '\0'; - return new; + return _new; } /* @@ -1685,7 +1685,7 @@ long PDB_add_label(PDB_file_t *file, opcode_t *cur_opcode, opcode_t offset) { - PDB_label_t *new, *label = file->label; + PDB_label_t *_new, *label = file->label; /* See if there is already a label at this line */ while (label) { @@ -1695,20 +1695,20 @@ } /* Allocate a new label */ label = file->label; - new = (PDB_label_t *)mem_sys_allocate(sizeof (PDB_label_t)); - new->opcode = cur_opcode + offset; - new->next = NULL; + _new = mem_allocate_typed(PDB_label_t); + _new->opcode = cur_opcode + offset; + _new->next = NULL; if (label) { while (label->next) label = label->next; - new->number = label->number + 1; - label->next = new; + _new->number = label->number + 1; + label->next = _new; } else { - file->label = new; - new->number = 1; + file->label = _new; + _new->number = 1; } - return new->number; + return _new->number; } /* Index: src/gc/gc_ims.c =================================================================== --- src/gc/gc_ims.c (revision 18278) +++ src/gc/gc_ims.c (working copy) @@ -933,13 +933,13 @@ void -Parrot_dod_ims_wb(Interp* interp, PMC *agg, PMC *new) +Parrot_dod_ims_wb(Interp* interp, PMC *agg, PMC *_new) { #if DOD_IMS_GREY_NEW IMS_DEBUG((stderr, "%d agg %p mark %p\n", ((Gc_ims_private *)interp->arena_base-> - gc_private)->state, agg, new)); - pobject_lives(interp, (PObj*)new); + gc_private)->state, agg, _new)); + pobject_lives(interp, (PObj*)_new); #else PObj_get_FLAGS(agg) &= ~ (PObj_live_FLAG|PObj_custom_GC_FLAG); pobject_lives(interp, (PObj*)agg); Index: src/pic.c =================================================================== --- src/pic.c (revision 18278) +++ src/pic.c (working copy) @@ -556,15 +556,15 @@ switch (op) { case PARROT_OP_new_p_sc: { - STRING *class; + STRING *_class; INTVAL type; - class = (STRING *)cur_opcode[2]; - type = pmc_type(interp, class); + _class = (STRING *)cur_opcode[2]; + type = pmc_type(interp, _class); if (!type) - type = pmc_type(interp, class); + type = pmc_type(interp, _class); if (type <= 0) real_exception(interp, NULL, NO_CLASS, - "Class '%Ss' not found", class); + "Class '%Ss' not found", _class); pc_pred[2] = (void*)type; op = PARROT_OP_new_p_ic; } Index: src/pmc/role.pmc =================================================================== --- src/pmc/role.pmc (revision 18278) +++ src/pmc/role.pmc (working copy) @@ -54,7 +54,7 @@ /* This is the underlying structure of this PMC. */ typedef struct Parrot_Role { STRING *name; /* The name of the role. */ - PMC *namespace; /* The namespace it's linked to, if any. */ + PMC *_namespace; /* The namespace it's linked to, if any. */ PMC *roles; /* Any roles that this role is composed from. */ PMC *methods; /* Hash of method names to methods in this role. */ PMC *attrib_metadata; /* Hash of attributes in this role to hashes of metadata. */ @@ -80,21 +80,21 @@ string_from_const_cstring(interp, "namespace", 0)); /* Take a copy of the current namespace the role is attached to. */ - old_ns = role->namespace; + old_ns = role->_namespace; /* Let's roll (no pun intended!) If we have a namespace and a name, * set both. */ if (have_name && have_ns) { /* If we weren't passed a NameSpace PMC, assume it's something we have * to look one up with and do so. */ - PMC *namespace = VTABLE_get_pmc_keyed_str(interp, info, + PMC *_namespace = VTABLE_get_pmc_keyed_str(interp, info, string_from_const_cstring(interp, "namespace", 0)); - if (!VTABLE_isa(interp, namespace, string_from_const_cstring(interp, "NameSpace", 0))) - namespace = Parrot_make_namespace_autobase(interp, namespace); + if (!VTABLE_isa(interp, _namespace, string_from_const_cstring(interp, "NameSpace", 0))) + _namespace = Parrot_make_namespace_autobase(interp, _namespace); /* If we get something null back it's an error; otherwise, store it. */ - if (!PMC_IS_NULL(namespace)) - role->namespace = namespace; + if (!PMC_IS_NULL(_namespace)) + role->_namespace = _namespace; else real_exception(interp, NULL, E_NameError, "Namespace not found"); @@ -111,7 +111,7 @@ /* Namespace is nested in the current namespace and with the name of * the role. */ - role->namespace = Parrot_make_namespace_keyed_str(interp, + role->_namespace = Parrot_make_namespace_keyed_str(interp, CONTEXT(interp->ctx)->current_namespace, role->name); } @@ -119,31 +119,31 @@ else if (have_ns) { /* If we weren't passed a NameSpace PMC, assume it's something we have * to look one up with and do so. */ - PMC *namespace = VTABLE_get_pmc_keyed_str(interp, info, + PMC *_namespace = VTABLE_get_pmc_keyed_str(interp, info, string_from_const_cstring(interp, "namespace", 0)); - if (!VTABLE_isa(interp, namespace, string_from_const_cstring(interp, "NameSpace", 0))) - namespace = Parrot_make_namespace_autobase(interp, namespace); + if (!VTABLE_isa(interp, _namespace, string_from_const_cstring(interp, "NameSpace", 0))) + _namespace = Parrot_make_namespace_autobase(interp, _namespace); /* If we get something null back it's an error; otherwise, store it. */ - if (!PMC_IS_NULL(namespace)) - role->namespace = namespace; + if (!PMC_IS_NULL(_namespace)) + role->_namespace = _namespace; else real_exception(interp, NULL, E_NameError, "Namespace not found"); /* Name is that of the most nested part of the namespace. */ - role->name = VTABLE_get_string(interp, namespace); + role->name = VTABLE_get_string(interp, _namespace); } /* If we were attached to a namespce and are now attached to a new one, * need to unset ourselves in the old namespace. */ - if (!PMC_IS_NULL(old_ns) && role->namespace != old_ns) + if (!PMC_IS_NULL(old_ns) && role->_namespace != old_ns) Parrot_PCCINVOKE(interp, old_ns, string_from_const_cstring(interp, "set_class", 0), "P->", PMCNULL); /* Link namespace to this role, if there is one. */ - if (!PMC_IS_NULL(role->namespace)) - Parrot_PCCINVOKE(interp, role->namespace, + if (!PMC_IS_NULL(role->_namespace)) + Parrot_PCCINVOKE(interp, role->_namespace, string_from_const_cstring(interp, "set_class", 0), "P->", self); @@ -234,7 +234,7 @@ /* Set up the object. */ role = mem_sys_allocate_zeroed(sizeof (Parrot_Role)); role->name = CONST_STRING(interp, ""); - role->namespace = PMCNULL; + role->_namespace = PMCNULL; role->roles = pmc_new(interp, enum_class_ResizablePMCArray); role->methods = pmc_new(interp, enum_class_Hash); role->attrib_metadata = pmc_new(interp, enum_class_Hash); @@ -279,8 +279,8 @@ Parrot_Role *role = PARROT_ROLE(SELF); if (role->name) pobject_lives(interp, (PObj*)role->name); - if (role->namespace) - pobject_lives(interp, (PObj*)role->namespace); + if (role->_namespace) + pobject_lives(interp, (PObj*)role->_namespace); if (role->roles) pobject_lives(interp, (PObj*)role->roles); if (role->methods) @@ -402,7 +402,7 @@ } else if (string_equal(interp, what, CONST_STRING(interp, "namespace")) == 0) { /* Don't clone the namespace, as it's not part of our state. */ - return role->namespace; + return role->_namespace; } else if (string_equal(interp, what, CONST_STRING(interp, "attributes")) == 0) { found = role->attrib_metadata; @@ -496,7 +496,7 @@ /* =item C<PCCMETHOD void - namespace()> + pmc_namespace()> Gets the namespace associated with this role, if any. @@ -504,9 +504,9 @@ */ - PCCMETHOD void namespace() { + PCCMETHOD void pmc_namespace() { Parrot_Role *role = PARROT_ROLE(SELF); - PMC *ret_namespace = role->namespace; + PMC *ret_namespace = role->_namespace; PCCRETURN(PMC *ret_namespace); } Index: src/pmc/class.pmc =================================================================== --- src/pmc/class.pmc (revision 18278) +++ src/pmc/class.pmc (working copy) @@ -779,15 +779,15 @@ */ PCCMETHOD void resolve_method(PMC *resolve_list :optional, int got_list :opt_flag) { - Parrot_Class *class = PARROT_CLASS(SELF); + Parrot_Class *_class = PARROT_CLASS(SELF); PMC *ret_list = NULL; if (got_list) { /* Store list. */ - class->resolve_method = resolve_list; + _class->resolve_method = resolve_list; } - ret_list = class->resolve_method; + ret_list = _class->resolve_method; PCCRETURN(PMC *ret_list); } @@ -802,20 +802,20 @@ */ PCCMETHOD void new(PMC *args :slurpy :named) { - Parrot_Class *class = PARROT_CLASS(SELF); + Parrot_Class *_class = PARROT_CLASS(SELF); PMC *obj; PMC *iter; Parrot_Object *obj_guts = NULL; /* If we've not been instantiated before... */ - if (!class->instantiated) { + if (!_class->instantiated) { /* Check that we have all methods listed in resolve list. */ - int resolve_count = VTABLE_elements(interp, class->resolve_method); + int resolve_count = VTABLE_elements(interp, _class->resolve_method); int i; for (i = 0; i < resolve_count; i++) { STRING *check_meth = VTABLE_get_string_keyed_int(interp, - class->resolve_method, i); - if (!VTABLE_exists_keyed_str(interp, class->methods, check_meth)) { + _class->resolve_method, i); + if (!VTABLE_exists_keyed_str(interp, _class->methods, check_meth)) { real_exception(interp, NULL, METH_NOT_FOUND, "The method '%S' was named in the resolve list, but not supplied", check_meth); @@ -824,16 +824,16 @@ /* Build full parents list. * XXX Need pluggable MRO, for now always do C3. */ - class->all_parents = Parrot_ComputeMRO_C3(interp, SELF); + _class->all_parents = Parrot_ComputeMRO_C3(interp, SELF); /* Build attributes index. */ build_attrib_index(interp, SELF); - if (PMC_IS_NULL(class->attrib_index)) + if (PMC_IS_NULL(_class->attrib_index)) return; } /* Set instantiated flag. */ - class->instantiated = 1; + _class->instantiated = 1; /* Create object. */ obj = pmc_new_noinit(interp, enum_class_Object); @@ -982,23 +982,23 @@ int got_exclude_method :opt_flag, PMC* alias_method :optional :named["alias_method"], int got_alias_method :opt_flag) { - Parrot_Class *class = PARROT_CLASS(SELF); + Parrot_Class *_class = PARROT_CLASS(SELF); /* Add everything on the resolve list to the exclude list; if we have * no exclude list, pass along the resolve list in its place if it has * any methods listed in it. */ if (!got_exclude_method) { - if (VTABLE_elements(interp, class->resolve_method) != 0) { - exclude_method = class->resolve_method; + if (VTABLE_elements(interp, _class->resolve_method) != 0) { + exclude_method = _class->resolve_method; got_exclude_method = 1; } } else { - int resolve_count = VTABLE_elements(interp, class->resolve_method); + int resolve_count = VTABLE_elements(interp, _class->resolve_method); int i; for (i = 0; i < resolve_count; i++) { STRING *meth_name = VTABLE_get_string_keyed_int(interp, - class->resolve_method, i); + _class->resolve_method, i); VTABLE_push_string(interp, exclude_method, meth_name); } } @@ -1006,7 +1006,7 @@ /* Do the composition. */ Parrot_ComposeRole(interp, role, exclude_method, got_exclude_method, alias_method, got_alias_method, - class->methods, class->roles); + _class->methods, _class->roles); } /* Index: src/pmc/object.pmc =================================================================== --- src/pmc/object.pmc (revision 18278) +++ src/pmc/object.pmc (working copy) @@ -24,24 +24,24 @@ /* This finds the index of an attribute in an object's attribute store and * returns it. Returns -1 if the attribute does not exist. */ static INTVAL get_attrib_index(Parrot_Interp interp, PMC *self, STRING *name) { - Parrot_Class *class = PARROT_CLASS(self); + Parrot_Class *_class = PARROT_CLASS(self); /* If we can't find the attribute, we hand back -1. */ INTVAL index = -1; /* First see if we can find it in the cache. */ - if (VTABLE_exists_keyed_str(interp, class->attrib_cache, name)) { + if (VTABLE_exists_keyed_str(interp, _class->attrib_cache, name)) { /* Yay! We got a cache hit! */ - index = VTABLE_get_integer_keyed_str(interp, class->attrib_cache, name); + index = VTABLE_get_integer_keyed_str(interp, _class->attrib_cache, name); } else { /* No hit. We need to walk up the list of parents to try and find the * attribute. */ - int num_classes = VTABLE_elements(interp, class->all_parents); + int num_classes = VTABLE_elements(interp, _class->all_parents); int i; for (i = 0; i < num_classes; i++) { /* Get the class and its attribute metadata hash. */ - PMC *cur_class = VTABLE_get_pmc_keyed_int(interp, class->all_parents, i); + PMC *cur_class = VTABLE_get_pmc_keyed_int(interp, _class->all_parents, i); Parrot_Class *class_info = PARROT_CLASS(cur_class); /* Build a string representing the fully qualified attribute name. */ @@ -49,10 +49,10 @@ fq_name = string_append(interp, fq_name, name); /* Look up. */ - if (VTABLE_exists_keyed_str(interp, class->attrib_index, fq_name)) { + if (VTABLE_exists_keyed_str(interp, _class->attrib_index, fq_name)) { /* Found it. Get value, cache it and we're done. */ - index = VTABLE_get_integer_keyed_str(interp, class->attrib_index, fq_name); - VTABLE_set_integer_keyed_str(interp, class->attrib_cache, name, index); + index = VTABLE_get_integer_keyed_str(interp, _class->attrib_index, fq_name); + VTABLE_set_integer_keyed_str(interp, _class->attrib_cache, name, index); break; } } @@ -188,15 +188,15 @@ PMC* find_method(STRING *name) { Parrot_Object *obj = PARROT_OBJECT(SELF); - Parrot_Class *class = PARROT_CLASS(obj->_class); + Parrot_Class *_class = PARROT_CLASS(obj->_class); PMC *method = PMCNULL; /* Walk and search. One day, we'll use the cache first. */ - int num_classes = VTABLE_elements(interp, class->all_parents); + int num_classes = VTABLE_elements(interp, _class->all_parents); int i; for (i = 0; i < num_classes; i++) { /* Get the class and see if it has the method. */ - PMC *cur_class = VTABLE_get_pmc_keyed_int(interp, class->all_parents, i); + PMC *cur_class = VTABLE_get_pmc_keyed_int(interp, _class->all_parents, i); Parrot_Class *class_info = PARROT_CLASS(cur_class); if (VTABLE_exists_keyed_str(interp, class_info->methods, name)) { /* Found it! */ Index: src/pmc/string.pmc =================================================================== --- src/pmc/string.pmc (revision 18278) +++ src/pmc/string.pmc (working copy) @@ -629,22 +629,22 @@ } /* -=item C<void replace(STRING* orig, STRING* new)> +=item C<void replace(STRING* orig, STRING* _new)> -Replace every occurrence of C<orig> with C<new>. +Replace every occurrence of C<orig> with C<_new>. =cut */ - METHOD void replace(STRING* orig, STRING* new) { + METHOD void replace(STRING* orig, STRING* _new) { INTVAL i = 0; INTVAL old_len = string_length(INTERP, orig); - INTVAL new_len = string_length(INTERP, new); + INTVAL new_len = string_length(INTERP, _new); STRING *s = VTABLE_get_string(INTERP, SELF); while (-1 != (i = string_str_index(INTERP, s, orig, i))) { - (void)string_replace(INTERP, s, i, old_len, new, NULL); + (void)string_replace(INTERP, s, i, old_len, _new, NULL); i += new_len; } VTABLE_set_string_native(INTERP, SELF, s); Index: src/pmc/scalar.pmc =================================================================== --- src/pmc/scalar.pmc (revision 18278) +++ src/pmc/scalar.pmc (working copy) @@ -1400,16 +1400,16 @@ */ PMC* share_ro() { - PMC *true; + PMC *_true; PMC *ret; - true = pmc_new(INTERP, enum_class_Integer); - VTABLE_set_integer_native(INTERP, true, 1); + _true = pmc_new(INTERP, enum_class_Integer); + VTABLE_set_integer_native(INTERP, _true, 1); ret = pt_shared_fixup(INTERP, SELF); /* first set readonly */ - VTABLE_setprop(INTERP, ret, const_string(INTERP, "_ro"), true); + VTABLE_setprop(INTERP, ret, const_string(INTERP, "_ro"), _true); /* now share; we add a PMC_EXT so we can identify the owning interp */ Index: src/pmc/delegate.pmc =================================================================== --- src/pmc/delegate.pmc (revision 18278) +++ src/pmc/delegate.pmc (working copy) @@ -40,12 +40,12 @@ static PMC * find_meth(Interp *interp, PMC *pmc, STRING *meth) { - PMC *class = pmc; + PMC *_class = pmc; if (PObj_is_object_TEST(pmc)) { - class = GET_CLASS(PMC_data(pmc), pmc); + _class = GET_CLASS(PMC_data(pmc), pmc); } - return Parrot_find_method_with_cache(interp, class, meth); + return Parrot_find_method_with_cache(interp, _class, meth); } /* Index: src/pmc/deleg_pmc.pmc =================================================================== --- src/pmc/deleg_pmc.pmc (revision 18278) +++ src/pmc/deleg_pmc.pmc (working copy) @@ -39,7 +39,7 @@ void init() { } - void init_pmc(PMC* class) { + void init_pmc(PMC* _class) { } void mark() { Index: src/pmc/parrotclass.pmc =================================================================== --- src/pmc/parrotclass.pmc (revision 18278) +++ src/pmc/parrotclass.pmc (working copy) @@ -108,11 +108,11 @@ */ INTVAL isa(STRING* classname) { - PMC *class; + PMC *_class; if (SUPER(classname)) return 1; - class = Parrot_class_lookup(INTERP, classname); - return Parrot_object_isa(INTERP, SELF, class); + _class = Parrot_class_lookup(INTERP, classname); + return Parrot_object_isa(INTERP, SELF, _class); } Index: src/pmc/parrotobject.pmc =================================================================== --- src/pmc/parrotobject.pmc (revision 18278) +++ src/pmc/parrotobject.pmc (working copy) @@ -86,7 +86,7 @@ */ void destroy() { - PMC* class; + PMC* _class; PMC* meth, *ns; STRING* fin; @@ -94,12 +94,12 @@ */ if ((UINTVAL)SELF->vtable == 0xdeadbeef) return; - class = SELF->vtable->pmc_class; - if ((UINTVAL)class->vtable == 0xdeadbeef) + _class = SELF->vtable->pmc_class; + if ((UINTVAL)_class->vtable == 0xdeadbeef) return; if (PObj_get_FLAGS(SELF) & PObj_need_finalize_FLAG) { fin = CONST_STRING(INTERP, "__finalize"); - ns = VTABLE_pmc_namespace(interp, class); + ns = VTABLE_pmc_namespace(interp, _class); meth = VTABLE_get_pmc_keyed_str(interp, ns, fin); if (!PMC_IS_NULL(meth)) { /* @@ -127,8 +127,8 @@ */ STRING* name() { - PMC *class = VTABLE_get_class(INTERP, SELF); - return VTABLE_name(INTERP, class); + PMC *_class = VTABLE_get_class(INTERP, SELF); + return VTABLE_name(INTERP, _class); } @@ -163,14 +163,14 @@ */ PMC* find_method(STRING* name) { - PMC *class = VTABLE_get_class(INTERP, SELF); + PMC *_class = VTABLE_get_class(INTERP, SELF); STRING *meth = CONST_STRING(interp, "__find_method"); STRING *meth_v = CONST_STRING(interp, "find_method"); PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v); if (PMC_IS_NULL(sub)) sub = find_meth(interp, SELF, meth); if (PMC_IS_NULL(sub)) - return VTABLE_find_method(INTERP, class, name); + return VTABLE_find_method(INTERP, _class, name); return (PMC*) Parrot_run_meth_fromc_args(interp, sub, SELF, meth, "PS", name); } Index: src/pmc/array.pmc =================================================================== --- src/pmc/array.pmc (revision 18278) +++ src/pmc/array.pmc (working copy) @@ -1225,7 +1225,7 @@ */ PMC* share_ro() { - PMC *true; + PMC *_true; PMC *ret; /* prevent infinite recursion */ @@ -1234,13 +1234,13 @@ "something that already is shared"); } - true = pmc_new(INTERP, enum_class_Integer); - VTABLE_set_integer_native(INTERP, true, 1); + _true = pmc_new(INTERP, enum_class_Integer); + VTABLE_set_integer_native(INTERP, _true, 1); ret = pt_shared_fixup(INTERP, SELF); /* first set readonly */ - VTABLE_setprop(INTERP, ret, const_string(INTERP, "_ro"), true); + VTABLE_setprop(INTERP, ret, const_string(INTERP, "_ro"), _true); /* XXX do something that deals better with sparse lists */ { Index: src/pmc/pair.pmc =================================================================== --- src/pmc/pair.pmc (revision 18278) +++ src/pmc/pair.pmc (working copy) @@ -48,14 +48,14 @@ } PMC* instantiate(PMC* sig) { - PMC * const class = REG_PMC(2); + PMC * const _class = REG_PMC(2); const int argcP = REG_INT(3); const int argcS = REG_INT(2); return PMCNULL; /* XXX This looks wrong, since we skip all the * following code */ - SELF = pmc_new(INTERP, class->vtable->base_type); + SELF = pmc_new(INTERP, _class->vtable->base_type); if (argcS == 1 && argcP == 1) { PMC_struct_val(SELF) = REG_STR(5); PObj_key_is_string_SET(SELF); Index: src/pmc/namespace.pmc =================================================================== --- src/pmc/namespace.pmc (revision 18278) +++ src/pmc/namespace.pmc (working copy) @@ -343,14 +343,14 @@ */ - METHOD void add_namespace(STRING *name, PMC *namespace) { + METHOD void add_namespace(STRING *name, PMC *_namespace) { STRING *s_ns = CONST_STRING(INTERP, "NameSpace"); - if (!VTABLE_isa(INTERP, namespace, s_ns)) + if (!VTABLE_isa(INTERP, _namespace, s_ns)) real_exception(INTERP, NULL, E_TypeError, "Invalid type %d in add_namespace()", - namespace->vtable->base_type); + _namespace->vtable->base_type); - VTABLE_set_pmc_keyed_str(INTERP, SELF, name, namespace); + VTABLE_set_pmc_keyed_str(INTERP, SELF, name, _namespace); return; } Index: src/pmc/default.pmc =================================================================== --- src/pmc/default.pmc (revision 18278) +++ src/pmc/default.pmc (working copy) @@ -898,7 +898,7 @@ /* -=item C<INTVAL isa(STRING *class)> +=item C<INTVAL isa(STRING *_class)> Returns whether the PMC "isa" C<*class>. @@ -906,9 +906,9 @@ */ - INTVAL isa(STRING* class) { + INTVAL isa(STRING* _class) { /* TODO FIXME - walk mro */ - return does_isa(INTERP, class, SELF->vtable->isa_str); + return does_isa(INTERP, _class, SELF->vtable->isa_str); } /* Index: compilers/imcc/pbc.c =================================================================== --- compilers/imcc/pbc.c (revision 18278) +++ compilers/imcc/pbc.c (working copy) @@ -310,16 +310,16 @@ *pc = 0; for (s = globals.cs->first; s; s = s->next) { #if 0 - fprintf(stderr, "namespace %s\n", s->unit->namespace ? - s->unit->namespace->name : "(null"); + fprintf(stderr, "namespace %s\n", s->unit->_namespace ? + s->unit->_namespace->name : "(null"); #endif r = s->unit->instructions->r[0]; /* if names and namespaces are matching - ok */ if (r && !strcmp(r->name, name) && - ((sym->unit->namespace && s->unit->namespace && - !strcmp(sym->unit->namespace->name, - s->unit->namespace->name)) - || (!sym->unit->namespace && !s->unit->namespace))) { + ((sym->unit->_namespace && s->unit->_namespace && + !strcmp(sym->unit->_namespace->name, + s->unit->_namespace->name)) + || (!sym->unit->_namespace && !s->unit->_namespace))) { return s; } *pc += s->size; @@ -654,8 +654,8 @@ unit = globals.cs->subs->unit; - if (unit->namespace) { - ns = unit->namespace->reg; + if (unit->_namespace) { + ns = unit->_namespace->reg; IMCC_debug(interp, DEBUG_PBC_CONST, "name space const = %d ns name '%s'\n", ns->color, ns->name); @@ -950,7 +950,7 @@ make_pmc_const(Interp *interp, SymReg *r) { STRING *s; - PMC *p, *class; + PMC *p, *_class; int k; if (*r->name == '"') @@ -960,8 +960,8 @@ s = string_unescape_cstring(interp, r->name + 1, '\'', NULL); else s = string_unescape_cstring(interp, r->name, 0, NULL); - class = interp->vtables[r->pmc_type]->pmc_class; - p = VTABLE_new_from_string(interp, class, s, PObj_constant_FLAG); + _class = interp->vtables[r->pmc_type]->pmc_class; + p = VTABLE_new_from_string(interp, _class, s, PObj_constant_FLAG); /* append PMC constant */ k = PDB_extend_const_table(interp); interp->code->const_table->constants[k]->type = PFC_PMC; Index: compilers/imcc/symreg.c =================================================================== --- compilers/imcc/symreg.c (revision 18278) +++ compilers/imcc/symreg.c (working copy) @@ -19,16 +19,16 @@ push_namespace(char * name) { Namespace * ns = (Namespace *) malloc(sizeof (*ns)); - ns->parent = namespace; + ns->parent = _namespace; ns->name = name; ns->idents = NULL; - namespace = ns; + _namespace = ns; } void pop_namespace(char * name) { - Namespace * ns = namespace; + Namespace * ns = _namespace; if (ns == NULL) { fprintf(stderr, "pop() on empty namespace stack\n"); abort(); @@ -46,7 +46,7 @@ free(ident); } - namespace = ns->parent; + _namespace = ns->parent; free(ns); } @@ -160,13 +160,13 @@ if (!ns) return; - if (unit->namespace) + if (unit->_namespace) return; - if (unit->prev && unit->prev->namespace == ns) - unit->namespace = ns; + if (unit->prev && unit->prev->_namespace == ns) + unit->_namespace = ns; else { g = dup_sym(ns); - unit->namespace = g; + unit->_namespace = g; g->reg = ns; g->type = VT_CONSTP; if (! (r = _get_sym(&IMCC_INFO(interp)->ghash, g->name)) || @@ -269,21 +269,21 @@ char * mk_fullname(const char * name) { - return _mk_fullname(namespace, name); + return _mk_fullname(_namespace, name); } /* Makes a new identifier */ SymReg * mk_ident(Interp *interp, char * name, int t) { - char * fullname = _mk_fullname(namespace, name); + char * fullname = _mk_fullname(_namespace, name); Identifier * ident; SymReg * r; - if (namespace) { + if (_namespace) { ident = calloc(1, sizeof (struct ident_t)); ident->name = fullname; - ident->next = namespace->idents; - namespace->idents = ident; + ident->next = _namespace->idents; + _namespace->idents = ident; } r = mk_symreg(interp, fullname, t); r->type = VTIDENTIFIER; @@ -565,10 +565,10 @@ SymReg * dup_sym(SymReg *r) { - SymReg * new = mem_sys_allocate(sizeof (SymReg)); - memcpy(new, r, sizeof (SymReg)); - new->name = str_dup(r->name); - return new; + SymReg * new_sym = mem_allocate_typed(SymReg); + memcpy(new_sym, r, sizeof (SymReg)); + new_sym->name = str_dup(r->name); + return new_sym; } SymReg * @@ -789,7 +789,7 @@ find_sym(Interp *interp, const char * name) { if (IMCC_INFO(interp)->cur_unit) - return _find_sym(interp, namespace, &IMCC_INFO(interp)->cur_unit->hash, name); + return _find_sym(interp, _namespace, &IMCC_INFO(interp)->cur_unit->hash, name); return NULL; } Index: compilers/imcc/symreg.h =================================================================== --- compilers/imcc/symreg.h (revision 18278) +++ compilers/imcc/symreg.h (working copy) @@ -100,7 +100,7 @@ Identifier * idents; }; -EXTERN Namespace * namespace; +EXTERN Namespace * _namespace; struct _IMC_Unit; Index: compilers/imcc/unit.h =================================================================== --- compilers/imcc/unit.h (revision 18278) +++ compilers/imcc/unit.h (working copy) @@ -50,7 +50,7 @@ struct _IMC_Unit * prev; struct _IMC_Unit * next; - SymReg *namespace; + SymReg *_namespace; int pasm_file; const char *file; int n_vars_used[4]; /* INSP in PIR */ Index: config/auto/gcc.pm =================================================================== --- config/auto/gcc.pm (revision 18278) +++ config/auto/gcc.pm (working copy) @@ -206,7 +206,7 @@ . "-Wvariadic-macros " . "-Wno-discard-qual " . "-Wno-pointer-sign ", - 4.1 => "", + 4.1 => "-Wc++-compat", 4.2 => "", # -Wsequence-point is part of -Wall