CHILL warning question ... (grant.c & typeck.c spots)

Dave Brolley brolley@cygnus.com
Wed Sep 30 17:36:00 GMT 1998


Kaveh R. Ghazi wrote:

>  ---------------------------
> grant.c: In function `decode_decl_selective':
> grant.c:2508: warning: enumeration value `__DUMMY' not handled in switch
> [...]
> grant.c:2508: warning: case value `29' not in enumerated type `chill_tree_code'
> grant.c:2508: warning: case value `31' not in enumerated type `chill_tree_code'
> grant.c:2508: warning: case value `32' not in enumerated type `chill_tree_code'
> grant.c:2508: warning: case value `33' not in enumerated type `chill_tree_code'
> grant.c:2508: warning: case value `36' not in enumerated type `chill_tree_code'
> ---------------------------

This one uses enumerators from both enum tree_code and enum chill_tree_code. I think one
way to get rid of the warnings might be to change the switch statement itself to

switch ((int)TREE_CODE (decl))

since enumerators have type int in C anyway. A default: label will get rid of the other
warning, but I'm not sure myself whether it should abort, or fall though.

> grant.c: In function `really_grant_this':
> grant.c:2792: warning: enumeration value `__DUMMY' not handled in switch
> [...]
> grant.c:2792: warning: case value `29' not in enumerated type `chill_tree_code'
> grant.c:2792: warning: case value `31' not in enumerated type `chill_tree_code'
> grant.c:2792: warning: case value `32' not in enumerated type `chill_tree_code'
> grant.c:2792: warning: case value `33' not in enumerated type `chill_tree_code'
> ---------------------------

Same with this one, except it seems clear that the default: should fall through in order
to generrate the error message.

> typeck.c: In function `chill_resulting_class':
> typeck.c:2039: warning: enumeration value `CH_NULL_CLASS' not handled in switch
> typeck.c:2039: warning: enumeration value `CH_REFERENCE_CLASS' not handled in switch
> ---------------------------
> typeck.c:2055: warning: enumeration value `CH_NULL_CLASS' not handled in switch
> typeck.c:2055: warning: enumeration value `CH_REFERENCE_CLASS' not handled in switch
> ---------------------------
> typeck.c:2071: warning: enumeration value `CH_NULL_CLASS' not handled in switch
> typeck.c:2071: warning: enumeration value `CH_REFERENCE_CLASS' not handled in switch
> ---------------------------
> typeck.c:2072: warning: enumeration value `CH_NULL_CLASS' not handled in switch
> typeck.c:2072: warning: enumeration value `CH_REFERENCE_CLASS' not handled in switch
> ---------------------------

These should all have default: labels which fall through in order to generate the error
message at the bottom of the function. The outer switch should also have breaks added
for each block.

Dave




More information about the Gcc mailing list