diff options
author | Sami Wagiaalla <swagiaal@redhat.com> | 2010-11-04 20:26:23 +0000 |
---|---|---|
committer | Sami Wagiaalla <swagiaal@redhat.com> | 2010-11-04 20:26:23 +0000 |
commit | 6403aeeaa1ebe388c0fc518f02569f9323a79981 (patch) | |
tree | ac904232227856af2b0f41d4666fac6701e05816 /gdb/valops.c | |
parent | 23fa7f66ac5f3ae5ea7c44bf45771e1b666c5ef3 (diff) | |
download | gdb-6403aeeaa1ebe388c0fc518f02569f9323a79981.zip gdb-6403aeeaa1ebe388c0fc518f02569f9323a79981.tar.gz gdb-6403aeeaa1ebe388c0fc518f02569f9323a79981.tar.bz2 |
Create and use struct rank.
2010-11-04 Sami Wagiaalla <swagiaal@redhat.com>
* gdbtypes.h: Create struct rank.
Convert all 'BADNESS' macros to const struct rank declarations.
(sum_ranks): New function.
(compare_ranks): New function.
* valops.c (find_oload_champ): Updated.
(classify_oload_match): Use compare_ranks.
Improved comments.
(compare_parameters): Use compare_ranks.
* gdbtypes.c: Initialize 'BADNESS' constants.
(sum_ranks): New function.
(compare_ranks): New function.
(compare_badness): Use compare_ranks.
(rank_function): Use global constants instead of literals.
(rank_one_type): Ditto.
Return struct rank.
Use sum_ranks.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index e98f7c1..9ddf94d 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2905,7 +2905,7 @@ find_oload_champ (struct type **arg_types, int nargs, int method, for (jj = 0; jj < nargs - static_offset; jj++) fprintf_filtered (gdb_stderr, "...Badness @ %d : %d\n", - jj, bv->rank[jj]); + jj, bv->rank[jj].rank); fprintf_filtered (gdb_stderr, "Overload resolution champion is %d, ambiguous? %d\n", oload_champ, oload_ambiguous); @@ -2939,9 +2939,15 @@ classify_oload_match (struct badness_vector *oload_champ_bv, for (ix = 1; ix <= nargs - static_offset; ix++) { - if (oload_champ_bv->rank[ix] >= 100) + /* If this conversion is as bad as INCOMPATIBLE_TYPE_BADNESS + or worse return INCOMPATIBLE. */ + if (compare_ranks (oload_champ_bv->rank[ix], + INCOMPATIBLE_TYPE_BADNESS) <= 0) return INCOMPATIBLE; /* Truly mismatched types. */ - else if (oload_champ_bv->rank[ix] >= 10) + /* Otherwise If this conversion is as bad as + NS_POINTER_CONVERSION_BADNESS or worse return NON_STANDARD. */ + else if (compare_ranks (oload_champ_bv->rank[ix], + NS_POINTER_CONVERSION_BADNESS) <= 0) return NON_STANDARD; /* Non-standard type conversions needed. */ } @@ -3077,9 +3083,9 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial) for (i = 0; i < TYPE_NFIELDS (t2); ++i) { - if (rank_one_type (TYPE_FIELD_TYPE (t1, start + i), - TYPE_FIELD_TYPE (t2, i)) - != 0) + if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i), + TYPE_FIELD_TYPE (t2, i)), + EXACT_MATCH_BADNESS) != 0) return 0; } |