Fix build breakage on GNU/Linux AArch64
[deliverable/binutils-gdb.git] / gdb / c-typeprint.c
index 12dda8447f1e95858ae2d0b6662e84cdc235a01a..f752300403ee66090315128d8df1b0a05b039049 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing C and C++ types for GDB, the GNU debugger.
-   Copyright (C) 1986-2016 Free Software Foundation, Inc.
+   Copyright (C) 1986-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -110,7 +110,7 @@ c_print_type (struct type *type,
                      && !TYPE_VECTOR (type))
                  || code == TYPE_CODE_MEMBERPTR
                  || code == TYPE_CODE_METHODPTR
-                 || code == TYPE_CODE_REF)))
+                 || TYPE_IS_REFERENCE (type))))
        fputs_filtered (" ", stream);
       need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
       c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
@@ -226,13 +226,21 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
                           language_cplus, DMGL_ANSI);
   fputs_filtered ("(", stream);
 
-  /* Skip the class variable.  */
+  /* Skip the class variable.  We keep this here to accommodate older
+     compilers and debug formats which may not support artificial
+     parameters.  */
   i = staticp ? 0 : 1;
   if (nargs > i)
     {
       while (i < nargs)
        {
-         c_print_type (args[i++].type, "", stream, 0, 0, flags);
+         struct field arg = args[i++];
+
+         /* Skip any artificial arguments.  */
+         if (FIELD_ARTIFICIAL (arg))
+           continue;
+
+         c_print_type (arg.type, "", stream, 0, 0, flags);
 
          if (i == nargs && varargs)
            fprintf_filtered (stream, ", ...");
@@ -339,9 +347,10 @@ c_type_print_varspec_prefix (struct type *type,
       break;
 
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
                                   stream, show, 1, 0, flags);
-      fprintf_filtered (stream, "&");
+      fprintf_filtered (stream, TYPE_CODE(type) == TYPE_CODE_REF ? "&" : "&&");
       c_type_print_modifier (type, stream, 1, need_post_space);
       break;
 
@@ -408,8 +417,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
   /* We don't print `const' qualifiers for references --- since all
      operators affect the thing referenced, not the reference itself,
      every reference is `const'.  */
-  if (TYPE_CONST (type)
-      && TYPE_CODE (type) != TYPE_CODE_REF)
+  if (TYPE_CONST (type) && !TYPE_IS_REFERENCE (type))
     {
       if (need_pre_space)
        fprintf_filtered (stream, " ");
@@ -539,7 +547,7 @@ is_type_conversion_operator (struct type *type, int i, int j)
      some other way, feel free to rewrite this function.  */
   const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
 
-  if (!startswith (name, "operator"))
+  if (!startswith (name, CP_OPERATOR_STR))
     return 0;
 
   name += 8;
@@ -720,6 +728,7 @@ c_type_print_varspec_suffix (struct type *type,
 
     case TYPE_CODE_PTR:
     case TYPE_CODE_REF:
+    case TYPE_CODE_RVALUE_REF:
       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
                                   show, 1, 0, flags);
       break;
@@ -884,12 +893,19 @@ c_type_print_base (struct type *type, struct ui_file *stream,
       fprintf_filtered (stream, _("<unnamed typedef>"));
       break;
 
+    case TYPE_CODE_FUNC:
+    case TYPE_CODE_METHOD:
+      if (TYPE_TARGET_TYPE (type) == NULL)
+       type_print_unknown_return_type (stream);
+      else
+       c_type_print_base (TYPE_TARGET_TYPE (type),
+                          stream, show, level, flags);
+      break;
     case TYPE_CODE_ARRAY:
     case TYPE_CODE_PTR:
     case TYPE_CODE_MEMBERPTR:
     case TYPE_CODE_REF:
-    case TYPE_CODE_FUNC:
-    case TYPE_CODE_METHOD:
+    case TYPE_CODE_RVALUE_REF:
     case TYPE_CODE_METHODPTR:
       c_type_print_base (TYPE_TARGET_TYPE (type),
                         stream, show, level, flags);
This page took 0.028104 seconds and 4 git commands to generate.