# New Ticket Created by [EMAIL PROTECTED]
# Please include the string: [perl #52710]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=52710 >
Hey,
I *thought* I'd try and clean up an easy one, so I took
src/key.c
src/key.c: In function `key_integer':
src/key.c:368: warning: switch missing default case
After a little poking I tracked the rest of the Key_xxxx_FLAG s down to
include/parrot/key.h (and pobj.h) [1] and so I rearrainged the case stmt
to cover them all (noting the TODO on slices, I separated those), putting
in the current default behavior for everything that wasn't already covered
and then adding a default branch w/ an exception (taken from the next sub
... ). This broke iterator.t tests and it appears to be due to a missing
(?) flag value of '8' for switch test
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
So ... either there's a missing KEY_xxxx_FLAG or something. One hint is in
src/packdump.c [3] which would say the '8' is an 'is_string' flag? I've
not yet been able to track backwards (my debugging is painfully slow w/
printf's and re-makes) to see who's calling w/ the funny flag value but I
thought I'd ask here to see if anybody had an answer.
Thanks.
a
p.s. Thanks again to jkeen for being so helpful and patient w/ my
rambling. I *almost* asked this on #parrot last night, but I chickened
out ;->
[1]
key.h
typedef enum {
KEY_integer_FLAG = PObj_private0_FLAG,
KEY_number_FLAG = PObj_private1_FLAG,
KEY_hash_iterator_FLAGS = PObj_private0_FLAG | PObj_private1_FLAG,
KEY_string_FLAG = PObj_private2_FLAG,
KEY_pmc_FLAG = PObj_private3_FLAG,
KEY_register_FLAG = PObj_private4_FLAG,
KEY_start_slice_FLAG = PObj_private5_FLAG,
KEY_end_slice_FLAG = PObj_private6_FLAG,
KEY_inf_slice_FLAG = PObj_private7_FLAG,
...
pobj.h
#define POBJ_FLAG(n) ((UINTVAL)1 << (n))
/* PObj flags */
typedef enum PObj_enum {
/* This first 8 flags may be used privately by a Parrot Object.
* You should alias these within an individual class's header file.
*
* Note: If the meanings of these flags are changed, then the
symbolic
* names kept in flag_bit_names (see src/packdump.c) must also be
updated.
*/
PObj_private0_FLAG = POBJ_FLAG(0),
PObj_private1_FLAG = POBJ_FLAG(1),
PObj_private2_FLAG = POBJ_FLAG(2),
PObj_private3_FLAG = POBJ_FLAG(3),
PObj_private4_FLAG = POBJ_FLAG(4),
PObj_private5_FLAG = POBJ_FLAG(5),
PObj_private6_FLAG = POBJ_FLAG(6),
PObj_private7_FLAG = POBJ_FLAG(7),
[2]
PARROT_API
PARROT_WARN_UNUSED_RESULT
INTVAL
key_integer(PARROT_INTERP, ARGIN(PMC *key))
{
if (VTABLE_isa(interp, key, CONST_STRING(interp, "Key"))) {
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_hash_iterator_FLAGS:
case KEY_integer_FLAG:
{
return PMC_int_val(key);
}
case KEY_integer_FLAG | KEY_register_FLAG:
{
return REG_INT(interp, PMC_int_val(key));
}
case KEY_pmc_FLAG | KEY_register_FLAG:
{
PMC * const reg = REG_PMC(interp, PMC_int_val(key));
return VTABLE_get_integer(interp, reg);
}
case KEY_string_FLAG:
{
return string_to_int(interp,
PMC_str_val(key));
}
case KEY_string_FLAG | KEY_register_FLAG:
{
STRING * const s_reg = REG_STR(interp, PMC_int_val(key));
return string_to_int(interp, s_reg);
}
/* TODO check for slice_FLAGs */
case KEY_start_slice_FLAG:
case KEY_end_slice_FLAG:
case KEY_inf_slice_FLAG:
{
return VTABLE_get_integer(interp, key);
}
case KEY_number_FLAG:
{
return VTABLE_get_integer(interp, key);
}
default:
real_exception(interp, NULL, INVALID_OPERATION,
"Key_integer %d %d %d not a valid flag!\n", VTABLE_get_int eger(interp,
key), PObj_get_FLAGS(key), PObj_get_FLAGS(key) & KEY_type_FLAGS);
} // switch
} // if VTABLE_isa
return VTABLE_get_integer(interp, key);
} // sub key_integer
[3]
/* [this desperately needs better abstraction, so we're not duplicating
the enum
* PObj_enum definition in the include/parrot/pobj.h file. -- rgr,
1-Mar-08.]
*/
static const char *flag_bit_names[] =
{
"private0",
"private1",
"private2",
"private3",
"private4",
"private5",
"private6",
"private7",
"is_string",
"is_PMC",
"is_PMC_EXT",
-------------------
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
Voice: (608) 261-5738 Fax: 264-5932
The bureaucracy is expanding to meet the needs of an expanding
bureaucracy.