Specialize value_cast error message for Ada

Message ID 20190618150049.15300-1-tromey@adacore.com
State New, archived
Headers

Commit Message

Tom Tromey June 18, 2019, 3 p.m. UTC
  In Ada, the term for a cast is "type conversion".  AdaCore has been
carrying a local patch to specialize the error message in value_cast,
but it seemed fine to me for this to be part of gdb.  This also
removes a dead "return" statement.

gdb/ChangeLog
2019-06-18  Tom Tromey  <tromey@adacore.com>

	* valops.c (value_cast): Specialize error message for Ada.
---
 gdb/ChangeLog | 4 ++++
 gdb/valops.c  | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Tom Tromey July 10, 2019, 6:18 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> In Ada, the term for a cast is "type conversion".  AdaCore has been
Tom> carrying a local patch to specialize the error message in value_cast,
Tom> but it seemed fine to me for this to be part of gdb.  This also
Tom> removes a dead "return" statement.

Tom> gdb/ChangeLog
Tom> 2019-06-18  Tom Tromey  <tromey@adacore.com>

Tom> 	* valops.c (value_cast): Specialize error message for Ada.

I'm checking this in now.

Tom
  

Patch

diff --git a/gdb/valops.c b/gdb/valops.c
index 948ad89fe92..0b32c5de9ef 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -555,8 +555,9 @@  value_cast (struct type *type, struct value *arg2)
     return value_at_lazy (to_type, value_address (arg2));
   else
     {
+      if (current_language->la_language == language_ada)
+	error (_("Invalid type conversion."));
       error (_("Invalid cast."));
-      return 0;
     }
 }