diff options
author | Doug Evans <dje@google.com> | 2010-06-27 16:40:11 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2010-06-27 16:40:11 +0000 |
commit | 93420a888a8f56199d7584c2c025190d389e4a5a (patch) | |
tree | 543c7a62c57e1f35f30eb21672258e8e8d3999da /gdb/value.c | |
parent | a88c2e0c85d5f6750416e6595b7bf44f79193e7d (diff) | |
download | gdb-93420a888a8f56199d7584c2c025190d389e4a5a.tar.gz |
* value.c (value_static_field): Use `switch' instead of `if'.
Assert-fail if passed invalid TYPE_FIELD_LOC_KIND.
Diffstat (limited to 'gdb/value.c')
-rw-r--r-- | gdb/value.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/value.c b/gdb/value.c index 5e0e8d8268b..1c0bc57792c 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1850,7 +1850,7 @@ unpack_pointer (struct type *type, const gdb_byte *valaddr) } -/* Get the value of the FIELDN'th field (which must be static) of +/* Get the value of the FIELDNO'th field (which must be static) of TYPE. Return NULL if the field doesn't exist or has been optimized out. */ @@ -1859,12 +1859,13 @@ value_static_field (struct type *type, int fieldno) { struct value *retval; - if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR) + switch (TYPE_FIELD_LOC_KIND (type, fieldno)) { + case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); - } - else + break; + case FIELD_LOC_KIND_PHYSNAME: { char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno); /*TYPE_FIELD_NAME (type, fieldno);*/ @@ -1897,7 +1898,12 @@ value_static_field (struct type *type, int fieldno) if (retval && VALUE_LVAL (retval) == lval_memory) SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), value_address (retval)); + break; } + default: + gdb_assert (0); + } + return retval; } |