aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 952f032..846d20a 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2020, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2021, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -784,7 +784,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
tree context = NULL_TREE;
struct deferred_decl_context_node *deferred_decl_context = NULL;
- /* If explicitely asked to make DECL global or if it's an imported nested
+ /* If explicitly asked to make DECL global or if it's an imported nested
object, short-circuit the regular Scope-based context computation. */
if (!((TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) || force_global == 1))
{
@@ -836,7 +836,8 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
if (!deferred_decl_context)
DECL_CONTEXT (decl) = context;
- TREE_NO_WARNING (decl) = (No (gnat_node) || Warnings_Off (gnat_node));
+ suppress_warning (decl, all_warnings,
+ No (gnat_node) || Warnings_Off (gnat_node));
/* Set the location of DECL and emit a declaration for it. */
if (Present (gnat_node) && !renaming_from_instantiation_p (gnat_node))
@@ -1276,7 +1277,7 @@ make_packable_type (tree type, bool in_record, unsigned int max_align)
finish_record_type (new_type, nreverse (new_field_list), 2, false);
relate_alias_sets (new_type, type, ALIAS_SET_COPY);
- if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
+ if (gnat_encodings != DWARF_GNAT_ENCODINGS_ALL)
SET_TYPE_DEBUG_TYPE (new_type, TYPE_DEBUG_TYPE (type));
else if (TYPE_STUB_DECL (type))
SET_DECL_PARALLEL_TYPE (TYPE_STUB_DECL (new_type),
@@ -1547,7 +1548,7 @@ maybe_pad_type (tree type, tree size, unsigned int align,
TYPE_SIZE (record) = size ? size : orig_size;
TYPE_SIZE_UNIT (record)
= convert (sizetype,
- size_binop (CEIL_DIV_EXPR, TYPE_SIZE (record),
+ size_binop (EXACT_DIV_EXPR, TYPE_SIZE (record),
bitsize_unit_node));
/* If we are changing the alignment and the input type is a record with
@@ -1609,7 +1610,7 @@ maybe_pad_type (tree type, tree size, unsigned int align,
}
/* Make the inner type the debug type of the padded type. */
- if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
+ if (gnat_encodings != DWARF_GNAT_ENCODINGS_ALL)
SET_TYPE_DEBUG_TYPE (record, maybe_debug_type (type));
/* Unless debugging information isn't being written for the input type,
@@ -1637,14 +1638,14 @@ maybe_pad_type (tree type, tree size, unsigned int align,
= create_var_decl (concat_name (name, "XVZ"), NULL_TREE, sizetype,
size_unit, true, global_bindings_p (),
!definition && global_bindings_p (), false,
- false, true, true, NULL, gnat_entity);
+ false, true, true, NULL, gnat_entity, false);
TYPE_SIZE_UNIT (record) = size_unit;
}
/* There is no need to show what we are a subtype of when outputting as
few encodings as possible: regular debugging infomation makes this
redundant. */
- if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
+ if (gnat_encodings == DWARF_GNAT_ENCODINGS_ALL)
{
tree marker = make_node (RECORD_TYPE);
tree orig_name = TYPE_IDENTIFIER (type);
@@ -1721,11 +1722,11 @@ built:
if (Comes_From_Source (gnat_entity))
{
if (is_component_type)
- post_error_ne_tree ("component of& padded{ by ^ bits}?",
+ post_error_ne_tree ("component of& padded{ by ^ bits}??",
gnat_entity, gnat_entity,
size_diffop (size, orig_size));
else if (Present (gnat_error_node))
- post_error_ne_tree ("{^ }bits of & unused?",
+ post_error_ne_tree ("{^ }bits of & unused??",
gnat_error_node, gnat_entity,
size_diffop (size, orig_size));
}
@@ -1970,7 +1971,6 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
{
const enum tree_code orig_code = TREE_CODE (record_type);
const bool had_size = TYPE_SIZE (record_type) != NULL_TREE;
- const bool had_size_unit = TYPE_SIZE_UNIT (record_type) != NULL_TREE;
const bool had_align = TYPE_ALIGN (record_type) > 0;
/* For all-repped records with a size specified, lay the QUAL_UNION_TYPE
out just like a UNION_TYPE, since the size will be fixed. */
@@ -1997,9 +1997,6 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
if (!had_size)
TYPE_SIZE (record_type) = bitsize_zero_node;
-
- if (!had_size_unit)
- TYPE_SIZE_UNIT (record_type) = size_zero_node;
}
else
{
@@ -2155,19 +2152,22 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
/* We need to set the regular sizes if REP_LEVEL is one. */
if (rep_level == 1)
{
+ /* We round TYPE_SIZE and TYPE_SIZE_UNIT up to TYPE_ALIGN separately
+ to avoid having very large masking constants in TYPE_SIZE_UNIT. */
+ const unsigned int align = TYPE_ALIGN (record_type);
+
/* If this is a padding record, we never want to make the size smaller
than what was specified in it, if any. */
- if (TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type))
+ if (TYPE_IS_PADDING_P (record_type) && had_size)
size = TYPE_SIZE (record_type);
-
- tree size_unit = had_size_unit
- ? TYPE_SIZE_UNIT (record_type)
- : convert (sizetype,
- size_binop (CEIL_DIV_EXPR, size,
- bitsize_unit_node));
- const unsigned int align = TYPE_ALIGN (record_type);
+ else
+ size = round_up (size, BITS_PER_UNIT);
TYPE_SIZE (record_type) = variable_size (round_up (size, align));
+
+ tree size_unit
+ = convert (sizetype,
+ size_binop (EXACT_DIV_EXPR, size, bitsize_unit_node));
TYPE_SIZE_UNIT (record_type)
= variable_size (round_up (size_unit, align / BITS_PER_UNIT));
}
@@ -2274,7 +2274,7 @@ rest_of_record_type_compilation (tree record_type)
/* If this record type is of variable size, make a parallel record type that
will tell the debugger how the former is laid out (see exp_dbug.ads). */
- if (var_size && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
+ if (var_size && gnat_encodings == DWARF_GNAT_ENCODINGS_ALL)
{
tree new_record_type
= make_node (TREE_CODE (record_type) == QUAL_UNION_TYPE
@@ -3543,9 +3543,6 @@ finish_subprog_decl (tree decl, tree asm_name, tree type)
DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (type);
DECL_RESULT (decl) = result_decl;
- /* Propagate the "const" property. */
- TREE_READONLY (decl) = TYPE_READONLY (type);
-
/* Propagate the "pure" property. */
DECL_PURE_P (decl) = TYPE_RESTRICT (type);
@@ -7016,8 +7013,7 @@ def_builtin_1 (enum built_in_function fncode,
return;
gcc_assert ((!both_p && !fallback_p)
- || !strncmp (name, "__builtin_",
- strlen ("__builtin_")));
+ || startswith (name, "__builtin_"));
libname = name + strlen ("__builtin_");
decl = add_builtin_function (name, fntype, fncode, fnclass,