/* Support for printing C and C++ types for GDB, the GNU debugger.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2016 Free Software Foundation, Inc.
This file is part of GDB.
#include "typeprint.h"
#include "cp-abi.h"
#include "jv-lang.h"
-#include <errno.h>
#include "cp-support.h"
static void c_type_print_varspec_prefix (struct type *,
static const char *
find_typedef_for_canonicalize (struct type *t, void *data)
{
- return find_typedef_in_hash (data, t);
+ return find_typedef_in_hash ((const struct type_print_options *) data, t);
}
/* Print NAME on STREAM. If the 'raw' field of FLAGS is not set,
const char *local_name;
if (show > 0)
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
local_name = find_typedef_in_hash (flags, type);
if (local_name != NULL)
struct symbol *new_symbol,
struct ui_file *stream)
{
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
fprintf_filtered (stream, "typedef ");
type_print (type, "", stream, 0);
if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
if (TYPE_RESTRICT (domain))
fprintf_filtered (stream, " restrict");
+
+ if (TYPE_ATOMIC (domain))
+ fprintf_filtered (stream, " _Atomic");
}
}
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 0, 0, flags);
- name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
+ name = type_name_no_tag (TYPE_SELF_TYPE (type));
if (name)
print_name_maybe_canonical (name, flags, stream);
else
- c_type_print_base (TYPE_DOMAIN_TYPE (type),
+ c_type_print_base (TYPE_SELF_TYPE (type),
stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 0, 0, flags);
fprintf_filtered (stream, "(");
- name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
+ name = type_name_no_tag (TYPE_SELF_TYPE (type));
if (name)
print_name_maybe_canonical (name, flags, stream);
else
- c_type_print_base (TYPE_DOMAIN_TYPE (type),
+ c_type_print_base (TYPE_SELF_TYPE (type),
stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
did_print_modifier = 1;
}
+ if (TYPE_ATOMIC (type))
+ {
+ if (did_print_modifier || need_pre_space)
+ fprintf_filtered (stream, " ");
+ fprintf_filtered (stream, "_Atomic");
+ did_print_modifier = 1;
+ }
+
address_space_id = address_space_int_to_name (get_type_arch (type),
TYPE_INSTANCE_FLAGS (type));
if (address_space_id)
some other way, feel free to rewrite this function. */
const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
- if (strncmp (name, "operator", 8) != 0)
+ if (!startswith (name, "operator"))
return 0;
name += 8;
/* If this doesn't look like the start of an identifier, then it
isn't a type conversion operator. */
return 0;
- else if (strncmp (name, "new", 3) == 0)
+ else if (startswith (name, "new"))
name += 3;
- else if (strncmp (name, "delete", 6) == 0)
+ else if (startswith (name, "delete"))
name += 6;
else
/* If it doesn't look like new or delete, it's a type conversion
return;
}
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
switch (TYPE_CODE (type))
{
enum}" tag for unnamed struct/union/enum's, which we don't
want to print. */
if (TYPE_TAG_NAME (type) != NULL
- && strncmp (TYPE_TAG_NAME (type), "{unnamed", 8))
+ && !startswith (TYPE_TAG_NAME (type), "{unnamed"))
{
/* When printing the tag name, we are still effectively
printing in the outer context, hence the use of FLAGS
tag for unnamed struct/union/enum's, which we don't
want to print. */
if (TYPE_TAG_NAME (type) != NULL
- && strncmp (TYPE_TAG_NAME (type), "{unnamed", 8))
+ && !startswith (TYPE_TAG_NAME (type), "{unnamed"))
{
print_name_maybe_canonical (TYPE_TAG_NAME (type), flags, stream);
if (show > 0)