On Fri, Apr 27, 2007 at 09:22:22AM -0700, Steve Peters wrote: > # New Ticket Created by Steve Peters > # Please include the string: [perl #42768] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42768 > > > > Intel C++ complains very loudly using enum types in variable and parameter > declarations. This patch helps to clean them up. >
The attached additional patch fixes one problem caused by the previous patch and gets Intel C++ to compile and pass all of its tests on Linux. Only apply the attached patch after applying the first patch. Steve Peters [EMAIL PROTECTED]
Index: src/embed.c =================================================================== --- src/embed.c (revision 18345) +++ src/embed.c (working copy) @@ -150,7 +150,7 @@ /* -=item C<void Parrot_clear_flag(Interp *, Parrot_Interp_flag flag)> +=item C<void Parrot_clear_flag(Interp *, Parrot_Int flag)> =item C<void Parrot_clear_debug(Interp *, UINTVAL flag)> Index: src/pmc/role.pmc =================================================================== --- src/pmc/role.pmc (revision 18345) +++ src/pmc/role.pmc (working copy) @@ -306,11 +306,9 @@ PMC *new_attribute = pmc_new(interp, enum_class_Hash); /* Set name and type. */ - VTABLE_set_string_keyed_str(interp, new_attribute, - CONST_STRING(interp, "name"), name); + VTABLE_set_string_keyed_str(interp, new_attribute, CONST_STRING(interp, "name"), name); if (!PMC_IS_NULL(type)) { - VTABLE_set_pmc_keyed_str(interp, new_attribute, - CONST_STRING(interp, "type"), type); + VTABLE_set_pmc_keyed_str(interp, new_attribute, CONST_STRING(interp, "type"), type); } /* Enter the attribute in the attributes array. */ @@ -483,8 +481,7 @@ /* We'll build a hash just containing the name, then give this to * init_role_from_hash - saves some code duplication. */ PMC *naming_hash = pmc_new(interp, enum_class_Hash); - VTABLE_set_string_keyed_str(interp, naming_hash, - CONST_STRING(interp, "name"), name); + VTABLE_set_string_keyed_str(interp, naming_hash, CONST_STRING(interp, "name"), name); init_role_from_hash(interp, SELF, naming_hash); } @@ -523,8 +520,7 @@ */ PCCMETHOD void attributes() { - PMC *ret_attrib_metadata = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "attributes")); + PMC *ret_attrib_metadata = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "attributes")); PCCRETURN(PMC *ret_attrib_metadata); } @@ -558,8 +554,7 @@ */ PCCMETHOD void methods() { - PMC *ret_methods = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "methods")); + PMC *ret_methods = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "methods")); PCCRETURN(PMC *ret_methods); } @@ -590,8 +585,7 @@ */ PCCMETHOD void roles() { - PMC *ret_roles = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "roles")); + PMC *ret_roles = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "roles")); PCCRETURN(PMC *ret_roles); } Index: src/pmc/class.pmc =================================================================== --- src/pmc/class.pmc (revision 18345) +++ src/pmc/class.pmc (working copy) @@ -468,11 +468,9 @@ } /* Set name and type. */ - VTABLE_set_string_keyed_str(interp, new_attribute, - CONST_STRING(interp, "name"), name); + VTABLE_set_string_keyed_str(interp, new_attribute, CONST_STRING(interp, "name"), name); if (!PMC_IS_NULL(type)) { - VTABLE_set_pmc_keyed_str(interp, new_attribute, - CONST_STRING(interp, "type"), type); + VTABLE_set_pmc_keyed_str(interp, new_attribute, CONST_STRING(interp, "type"), type); } /* Enter the attribute in the attributes array. */ @@ -744,8 +742,7 @@ /* We'll build a hash just containing the name, then give this to * init_class_from_hash - saves some code duplication. */ PMC *naming_hash = pmc_new(interp, enum_class_Hash); - VTABLE_set_string_keyed_str(interp, naming_hash, - CONST_STRING(interp, "name"), name); + VTABLE_set_string_keyed_str(interp, naming_hash, CONST_STRING(interp, "name"), name); init_class_from_hash(interp, SELF, naming_hash); } @@ -874,8 +871,7 @@ */ PCCMETHOD void attributes() { - PMC *ret_attrib_metadata = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "attributes")); + PMC *ret_attrib_metadata = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "attributes")); PCCRETURN(PMC *ret_attrib_metadata); } @@ -904,8 +900,7 @@ */ PCCMETHOD void methods() { - PMC *ret_methods = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "methods")); + PMC *ret_methods = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "methods")); PCCRETURN(PMC *ret_methods); } @@ -934,8 +929,7 @@ */ PCCMETHOD void parents() { - PMC *ret_parents = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "parents")); + PMC *ret_parents = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "parents")); PCCRETURN(PMC *ret_parents); } @@ -962,8 +956,7 @@ */ PCCMETHOD void roles() { - PMC *ret_roles = VTABLE_inspect_str(interp, SELF, - CONST_STRING(interp, "roles")); + PMC *ret_roles = VTABLE_inspect_str(interp, SELF, CONST_STRING(interp, "roles")); PCCRETURN(PMC *ret_roles); } Index: src/mmd.c =================================================================== --- src/mmd.c (revision 18345) +++ src/mmd.c (working copy) @@ -1703,7 +1703,12 @@ * register default mmds for this type */ for (i = 0; i < n; ++i) { + /* The following always fails for Intel C++ for unknown reasons, + * but I'm assuming its optimizer related. + */ +#ifndef __INTEL_COMPILER assert((PTR2UINTVAL(mmd_table[i].func_ptr) & 3) == 0); +#endif mmd_register(interp, mmd_table[i].func_nr, type, mmd_table[i].right, mmd_table[i].func_ptr); Index: src/packfile.c =================================================================== --- src/packfile.c (revision 18345) +++ src/packfile.c (working copy) @@ -247,7 +247,7 @@ static PMC* run_sub(Parrot_Interp interp, PMC *sub_pmc) { - const Parrot_Run_core_t old = interp->run_core; + const INTVAL old = interp->run_core; PMC *retval; /* @@ -2817,7 +2817,7 @@ /* =item C<static PackFile_FixupEntry * -find_fixup(PackFile_FixupTable *ft, enum_fixup_t type, const char *name)> +find_fixup(PackFile_FixupTable *ft, INTVAL type, const char *name)> Finds the fix-up entry for C<name> and returns it. @@ -2826,7 +2826,7 @@ */ static PackFile_FixupEntry * -find_fixup(PackFile_FixupTable *ft, enum_fixup_t type, const char *name) +find_fixup(PackFile_FixupTable *ft, INTVAL type, const char *name) { opcode_t i; for (i = 0; i < ft->fixup_count; i++) { Index: include/parrot/embed.h =================================================================== --- include/parrot/embed.h (revision 18345) +++ include/parrot/embed.h (working copy) @@ -28,9 +28,9 @@ PARROT_API void Parrot_init(Parrot_Interp); PARROT_API void Parrot_init_stacktop(Parrot_Interp, void *); -PARROT_API void Parrot_set_flag(Parrot_Interp, Parrot_Interp_flag); -PARROT_API void Parrot_clear_flag(Parrot_Interp, Parrot_Interp_flag); -PARROT_API Parrot_Int Parrot_test_flag(Parrot_Interp, Parrot_Interp_flag); +PARROT_API void Parrot_set_flag(Parrot_Interp, Parrot_Int); +PARROT_API void Parrot_clear_flag(Parrot_Interp, Parrot_Int); +PARROT_API Parrot_Int Parrot_test_flag(Parrot_Interp, Parrot_Int); PARROT_API void Parrot_set_trace(Parrot_Interp, Parrot_UInt); PARROT_API void Parrot_clear_trace(Parrot_Interp, Parrot_UInt); Index: include/parrot/interpreter.h =================================================================== --- include/parrot/interpreter.h (revision 18345) +++ include/parrot/interpreter.h (working copy) @@ -320,7 +320,7 @@ UINTVAL debug_flags; /* debug settings */ - Run_Cores run_core; /* type of core to run the ops */ + INTVAL run_core; /* type of core to run the ops */ /* TODO profile per code segment or global */ RunProfile *profile; /* The structure and array where we keep the Index: compilers/imcc/symreg.h =================================================================== --- compilers/imcc/symreg.h (revision 18345) +++ compilers/imcc/symreg.h (working copy) @@ -58,8 +58,8 @@ typedef struct _SymReg { char * name; - enum VARTYPE type; /* Variable type */ - enum USAGE usage; /* s. USAGE above */ + INTVAL type; /* Variable type */ + INTVAL usage; /* s. USAGE above */ int set; /* Which register set/file it belongs to */ int want_regno; /* wanted register number */ INTVAL color; /* Color: parrot register number @@ -162,7 +162,7 @@ int nret; SymReg ** multi; int nmulti; - pragma_enum_t pragma; + INTVAL pragma; int calls_a_sub; int flags; /* isNCI, isTAIL_CALL */ int label; Index: compilers/imcc/unit.h =================================================================== --- compilers/imcc/unit.h (revision 18345) +++ compilers/imcc/unit.h (working copy) @@ -28,7 +28,7 @@ } ; typedef struct _IMC_Unit { - IMC_Unit_Type type; + INTVAL type; Instruction * instructions; Instruction * last_ins; SymHash hash;