diff options
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 24 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 4 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/overload.cc | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/overload.exp | 2 |
6 files changed, 34 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2c37e80..f504b95 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2003-02-04 David Carlton <carlton@math.stanford.edu> + + * gdbtypes.h: Delete INTEGER_COERCION_BADNESS, + FLOAT_COERCION_BADNESS. + * gdbtypes.c (rank_one_type): Replace all uses of + INTEGER_COERCION_BADNESS by INTEGER_CONVERSION_BADNESS. + 2003-02-04 Jim Blandy <jimb@redhat.com> * dwarf2read.c (dwarf2_locate_sections): When we find a macro info diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 679822f..f93b36b 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2591,7 +2591,7 @@ rank_one_type (struct type *parm, struct type *arg) if (TYPE_NOSIGN (arg)) /* plain char -> plain char */ return 0; else - return INTEGER_COERCION_BADNESS; /* signed/unsigned char -> plain char */ + return INTEGER_CONVERSION_BADNESS; /* signed/unsigned char -> plain char */ } else if (TYPE_UNSIGNED (parm)) { @@ -2604,13 +2604,13 @@ rank_one_type (struct type *parm, struct type *arg) && integer_types_same_name_p (TYPE_NAME (parm), "long")) return INTEGER_PROMOTION_BADNESS; /* unsigned int -> unsigned long */ else - return INTEGER_COERCION_BADNESS; /* unsigned long -> unsigned int */ + return INTEGER_CONVERSION_BADNESS; /* unsigned long -> unsigned int */ } else { if (integer_types_same_name_p (TYPE_NAME (arg), "long") && integer_types_same_name_p (TYPE_NAME (parm), "int")) - return INTEGER_COERCION_BADNESS; /* signed long -> unsigned int */ + return INTEGER_CONVERSION_BADNESS; /* signed long -> unsigned int */ else return INTEGER_CONVERSION_BADNESS; /* signed int/long -> unsigned int/long */ } @@ -2623,15 +2623,15 @@ rank_one_type (struct type *parm, struct type *arg) && integer_types_same_name_p (TYPE_NAME (parm), "long")) return INTEGER_PROMOTION_BADNESS; else - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; } else - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; } else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm)) return INTEGER_PROMOTION_BADNESS; else - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; case TYPE_CODE_ENUM: case TYPE_CODE_CHAR: case TYPE_CODE_RANGE: @@ -2653,7 +2653,7 @@ rank_one_type (struct type *parm, struct type *arg) case TYPE_CODE_RANGE: case TYPE_CODE_BOOL: case TYPE_CODE_ENUM: - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; case TYPE_CODE_FLT: return INT_FLOAT_CONVERSION_BADNESS; default: @@ -2666,12 +2666,12 @@ rank_one_type (struct type *parm, struct type *arg) case TYPE_CODE_RANGE: case TYPE_CODE_BOOL: case TYPE_CODE_ENUM: - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; case TYPE_CODE_FLT: return INT_FLOAT_CONVERSION_BADNESS; case TYPE_CODE_INT: if (TYPE_LENGTH (arg) > TYPE_LENGTH (parm)) - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm)) return INTEGER_PROMOTION_BADNESS; /* >>> !! else fall through !! <<< */ @@ -2683,7 +2683,7 @@ rank_one_type (struct type *parm, struct type *arg) if (TYPE_NOSIGN (arg)) return 0; else - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; } else if (TYPE_UNSIGNED (parm)) { @@ -2695,7 +2695,7 @@ rank_one_type (struct type *parm, struct type *arg) else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg)) return 0; else - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; default: return INCOMPATIBLE_TYPE_BADNESS; } @@ -2708,7 +2708,7 @@ rank_one_type (struct type *parm, struct type *arg) case TYPE_CODE_RANGE: case TYPE_CODE_BOOL: case TYPE_CODE_ENUM: - return INTEGER_COERCION_BADNESS; + return INTEGER_CONVERSION_BADNESS; case TYPE_CODE_FLT: return INT_FLOAT_CONVERSION_BADNESS; default: diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 30cdb5f..e3ba6fa 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1211,10 +1211,6 @@ extern int count_virtual_fns (struct type *); #define TOO_FEW_PARAMS_BADNESS 100 /* Badness if no conversion among types */ #define INCOMPATIBLE_TYPE_BADNESS 100 -/* Badness of coercing large integer to smaller size */ -#define INTEGER_COERCION_BADNESS 100 -/* Badness of coercing large floating type to smaller size */ -#define FLOAT_COERCION_BADNESS 100 /* Badness of integral promotion */ #define INTEGER_PROMOTION_BADNESS 1 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index dde2a43..44b3726 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2003-02-04 David Carlton <carlton@math.stanford.edu> + + * gdb.c++/overload.exp: Test intToChar(1). + * gdb.c++/overload.cc (intToChar): New. + (main): Call intToChar. + 2003-02-03 David Carlton <carlton@math.stanford.edu> * gdb.c++/ovldbreak.exp (continue_to_bp_overloaded): Add diff --git a/gdb/testsuite/gdb.c++/overload.cc b/gdb/testsuite/gdb.c++/overload.cc index 97083c5..2f46715 100644 --- a/gdb/testsuite/gdb.c++/overload.cc +++ b/gdb/testsuite/gdb.c++/overload.cc @@ -45,6 +45,11 @@ int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, }; +int intToChar (char c) +{ + return 297; +} + void marker1() {} @@ -72,6 +77,8 @@ int main () breakpoint(); #endif + // Verify that intToChar should work: + intToChar(1); marker1(); return 0; diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp index 7bfae10..227b055 100644 --- a/gdb/testsuite/gdb.c++/overload.exp +++ b/gdb/testsuite/gdb.c++/overload.exp @@ -378,3 +378,5 @@ gdb_test "list foo::overloadfnarg(int, int (*)(int))" \ gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \ "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \ "list overloaded function with function ptr args - quotes around argument" + +gdb_test "print intToChar(1)" ".\[0-9\]* = 297" |