Hello > Just popping in to say that we cannot const any parms to vtable methods. > Parrot can't impose promises on the called code.
The attached patch drops the :const attribute in isa and get_class methods. A lot of cast warnings disappear, and all tests pass in my system. -- Salu2
Index: src/vtable.tbl =================================================================== --- src/vtable.tbl (revision 27126) +++ src/vtable.tbl (working copy) @@ -338,7 +338,7 @@ INTVAL does(STRING* role) INTVAL isa_pmc(PMC* _class) -INTVAL isa(STRING* _class) :const +INTVAL isa(STRING* _class) PMC* get_attr(INTVAL idx) PMC* get_attr_str(STRING* idx) @@ -347,7 +347,7 @@ void set_attr_str(STRING* idx, PMC* value) :write void set_attr_keyed(PMC* key, STRING* idx, PMC* value) :write -PMC* get_class() :const +PMC* get_class() void add_parent(PMC* parent) :write void remove_parent(PMC* parent) :write Index: src/key.c =================================================================== --- src/key.c (revision 27126) +++ src/key.c (working copy) @@ -322,6 +322,8 @@ return string_to_int(interp, s_reg); } /* TODO check for slice_FLAGs */ + default: + /* Do nothing */; } } @@ -442,7 +444,7 @@ PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT PMC * -key_next(PARROT_INTERP, ARGIN(const PMC *key)) +key_next(PARROT_INTERP, ARGIN(PMC *key)) { return VTABLE_isa(interp, key, CONST_STRING(interp, "Key")) && key->pmc_ext ? Index: src/pmc/class.pmc =================================================================== --- src/pmc/class.pmc (revision 27126) +++ src/pmc/class.pmc (working copy) @@ -1190,7 +1190,7 @@ */ - VTABLE INTVAL isa(STRING *classname) :const { + VTABLE INTVAL isa(STRING *classname) { Parrot_Class * const _class = PARROT_CLASS(SELF); INTVAL i, num_parents; Index: src/pmc/object.pmc =================================================================== --- src/pmc/object.pmc (revision 27126) +++ src/pmc/object.pmc (working copy) @@ -376,7 +376,7 @@ =cut */ - VTABLE PMC *get_class() :const { + VTABLE PMC *get_class() { PMC * const classobj = PARROT_OBJECT(SELF)->_class; STRING *get_class = CONST_STRING(interp, "get_class"); /* If there's a vtable override for 'get_class' run that instead. */ @@ -437,7 +437,7 @@ */ - VTABLE INTVAL isa(STRING *classname) :const { + VTABLE INTVAL isa(STRING *classname) { PMC *_class; if (SUPER(classname)) Index: src/pmc/delegate.pmc =================================================================== --- src/pmc/delegate.pmc (revision 27126) +++ src/pmc/delegate.pmc (working copy) @@ -129,7 +129,7 @@ return SUPER(); } - VTABLE INTVAL isa(STRING *classname) :const { + VTABLE INTVAL isa(STRING *classname) { if (SUPER(classname)) return 1; Index: src/pmc/namespace.pmc =================================================================== --- src/pmc/namespace.pmc (revision 27126) +++ src/pmc/namespace.pmc (working copy) @@ -124,7 +124,7 @@ */ - PMC *get_class() :const { + PMC *get_class() { return PARROT_NAMESPACE(SELF)->_class; } Index: src/pmc/pmcproxy.pmc =================================================================== --- src/pmc/pmcproxy.pmc (revision 27126) +++ src/pmc/pmcproxy.pmc (working copy) @@ -279,7 +279,7 @@ */ - VTABLE INTVAL isa(STRING *classname) :const { + VTABLE INTVAL isa(STRING *classname) { const STRING * const pmc_proxy = CONST_STRING(interp, "PMCProxy"); if (string_equal(INTERP, classname, pmc_proxy) == 0) Index: src/pmc/default.pmc =================================================================== --- src/pmc/default.pmc (revision 27126) +++ src/pmc/default.pmc (working copy) @@ -931,7 +931,7 @@ */ - VTABLE INTVAL isa(STRING *_class) :const { + VTABLE INTVAL isa(STRING *_class) { /* RT#46665 - walk mro */ return does_isa(INTERP, _class, SELF->vtable->isa_str); } @@ -1007,7 +1007,7 @@ =cut */ - VTABLE PMC *get_class() :const { + VTABLE PMC *get_class() { /* Create a proxy */ INTVAL type = VTABLE_type(interp, SELF); PMC *type_num = pmc_new(interp, enum_class_Integer); Index: include/parrot/key.h =================================================================== --- include/parrot/key.h (revision 27126) +++ include/parrot/key.h (working copy) @@ -101,7 +101,7 @@ PARROT_API PARROT_CAN_RETURN_NULL PARROT_WARN_UNUSED_RESULT -PMC * key_next(SHIM_INTERP, ARGIN(const PMC *key)) +PMC * key_next(SHIM_INTERP, ARGIN(PMC *key)) __attribute__nonnull__(2); PARROT_API