Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / gdb / f-lang.c
index cc4e154f47ab4450f4ddb75e2e7cf9848994688f..c7c47cf8dcfeebadb91f76b4a68a1331f531d093 100644 (file)
@@ -1,6 +1,6 @@
 /* Fortran language support routines for GDB, the GNU debugger.
 
-   Copyright (C) 1993-2019 Free Software Foundation, Inc.
+   Copyright (C) 1993-2020 Free Software Foundation, Inc.
 
    Contributed by Motorola.  Adapted from the C parser by Farooq Butt
    (fmbutt@engage.sps.mot.com).
@@ -35,6 +35,7 @@
 #include "charset.h"
 #include "c-lang.h"
 #include "target-float.h"
+#include "gdbarch.h"
 
 #include <math.h>
 
@@ -58,7 +59,7 @@ f_get_encoding (struct type *type)
       encoding = target_charset (get_type_arch (type));
       break;
     case 4:
-      if (gdbarch_byte_order (get_type_arch (type)) == BFD_ENDIAN_BIG)
+      if (type_byte_order (type) == BFD_ENDIAN_BIG)
        encoding = "UTF-32BE";
       else
        encoding = "UTF-32LE";
@@ -242,7 +243,8 @@ f_collect_symbol_completion_matches (completion_tracker &tracker,
 }
 
 /* Special expression evaluation cases for Fortran.  */
-struct value *
+
+static struct value *
 evaluate_subexp_f (struct type *expect_type, struct expression *exp,
                   int *pos, enum noside noside)
 {
@@ -643,7 +645,7 @@ extern const struct language_defn f_language_defn =
   f_printstr,                  /* function to print string constant */
   f_emit_char,                 /* Function to print a single character */
   f_print_type,                        /* Print a type using appropriate syntax */
-  default_print_typedef,       /* Print a typedef using appropriate syntax */
+  f_print_typedef,             /* Print a typedef using appropriate syntax */
   f_val_print,                 /* Print a value using appropriate syntax */
   c_value_print,               /* FIXME */
   default_read_var_value,      /* la_read_var_value */
@@ -670,11 +672,10 @@ extern const struct language_defn f_language_defn =
   f_language_arch_info,
   default_print_array_index,
   default_pass_by_reference,
-  default_get_string,
   c_watch_location_expression,
-  NULL,                                /* la_get_symbol_name_matcher */
+  cp_get_symbol_name_matcher,  /* la_get_symbol_name_matcher */
   iterate_over_symbols,
-  default_search_name_hash,
+  cp_search_name_hash,
   &default_varobj_ops,
   NULL,
   NULL,
@@ -689,7 +690,7 @@ build_fortran_types (struct gdbarch *gdbarch)
     = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_f_type);
 
   builtin_f_type->builtin_void
-    = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "VOID");
+    = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
 
   builtin_f_type->builtin_character
     = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character");
@@ -727,9 +728,17 @@ build_fortran_types (struct gdbarch *gdbarch)
   builtin_f_type->builtin_real_s8
     = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
                       "real*8", gdbarch_double_format (gdbarch));
-  builtin_f_type->builtin_real_s16
-    = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
-                      "real*16", gdbarch_long_double_format (gdbarch));
+  auto fmt = gdbarch_floatformat_for_type (gdbarch, "real(kind=16)", 128);
+  if (fmt != nullptr)
+    builtin_f_type->builtin_real_s16
+      = arch_float_type (gdbarch, 128, "real*16", fmt);
+  else if (gdbarch_long_double_bit (gdbarch) == 128)
+    builtin_f_type->builtin_real_s16
+      = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
+                        "real*16", gdbarch_long_double_format (gdbarch));
+  else
+    builtin_f_type->builtin_real_s16
+      = arch_type (gdbarch, TYPE_CODE_ERROR, 128, "real*16");
 
   builtin_f_type->builtin_complex_s8
     = arch_complex_type (gdbarch, "complex*8",
This page took 0.025796 seconds and 4 git commands to generate.