aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-18 11:10:42 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-18 11:10:42 +0000
commitea780bd9a3efa19223e03d48d37b490204f2da92 (patch)
tree0bffe85bad394e4bb7306e24515f3f47f8dfe5d1
parent131468370faeb6ea8a1d21081d7e6a593bf40170 (diff)
* gcc-interface/ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename to
(TYPE_IMPL_PACKED_ARRAY_P): ...this. (TYPE_CAN_HAVE_DEBUG_TYPE_P): Do not test TYPE_DEBUG_TYPE. * gcc-interface/decl.c (gnat_to_gnu_entity): Simplify NULL_TREE tests and tweak gnat_encodings tests throughout. (initial_value_needs_conversion): Likewise. (intrin_arglists_compatible_p): Likewise. * gcc-interface/misc.c (gnat_print_type): Likewise. (gnat_get_debug_type): Likewise. (gnat_get_fixed_point_type_info): Likewise. (gnat_get_array_descr_info): Likewise. (get_array_bit_stride): Likewise. (gnat_get_type_bias): Fix formatting. (enumerate_modes): Likewise. * gcc-interface/trans.c (gnat_to_gnu): Likewise. (add_decl_expr): Simplify NULL_TREE test. (end_stmt_group): Likewise. (build_binary_op_trapv): Fix formatting. (get_exception_label): Use switch statement. (init_code_table): Move around. * gcc-interface/utils.c (global_bindings_p): Simplify NULL_TREE test. (gnat_poplevel): Likewise. (gnat_set_type_context): Likewise. (defer_or_set_type_context): Fix formatting. (gnat_pushdecl): Simplify NULL_TREE test. (maybe_pad_type): Likewise. (add_parallel_type): Likewise. (create_range_type): Likewise. (process_deferred_decl_context): Likewise. (convert): Likewise. (def_builtin_1): Likewise. * gcc-interface/utils2.c (find_common_type): Likewise. (build_binary_op): Likewise. (gnat_rewrite_reference): Likewise. (get_inner_constant_reference): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232501 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog38
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h16
-rw-r--r--gcc/ada/gcc-interface/decl.c42
-rw-r--r--gcc/ada/gcc-interface/misc.c93
-rw-r--r--gcc/ada/gcc-interface/trans.c68
-rw-r--r--gcc/ada/gcc-interface/utils.c77
-rw-r--r--gcc/ada/gcc-interface/utils2.c23
7 files changed, 198 insertions, 159 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 01025b2cca7..0c280d82ff6 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,43 @@
2016-01-18 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename to
+ (TYPE_IMPL_PACKED_ARRAY_P): ...this.
+ (TYPE_CAN_HAVE_DEBUG_TYPE_P): Do not test TYPE_DEBUG_TYPE.
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Simplify NULL_TREE tests
+ and tweak gnat_encodings tests throughout.
+ (initial_value_needs_conversion): Likewise.
+ (intrin_arglists_compatible_p): Likewise.
+ * gcc-interface/misc.c (gnat_print_type): Likewise.
+ (gnat_get_debug_type): Likewise.
+ (gnat_get_fixed_point_type_info): Likewise.
+ (gnat_get_array_descr_info): Likewise.
+ (get_array_bit_stride): Likewise.
+ (gnat_get_type_bias): Fix formatting.
+ (enumerate_modes): Likewise.
+ * gcc-interface/trans.c (gnat_to_gnu): Likewise.
+ (add_decl_expr): Simplify NULL_TREE test.
+ (end_stmt_group): Likewise.
+ (build_binary_op_trapv): Fix formatting.
+ (get_exception_label): Use switch statement.
+ (init_code_table): Move around.
+ * gcc-interface/utils.c (global_bindings_p): Simplify NULL_TREE test.
+ (gnat_poplevel): Likewise.
+ (gnat_set_type_context): Likewise.
+ (defer_or_set_type_context): Fix formatting.
+ (gnat_pushdecl): Simplify NULL_TREE test.
+ (maybe_pad_type): Likewise.
+ (add_parallel_type): Likewise.
+ (create_range_type): Likewise.
+ (process_deferred_decl_context): Likewise.
+ (convert): Likewise.
+ (def_builtin_1): Likewise.
+ * gcc-interface/utils2.c (find_common_type): Likewise.
+ (build_binary_op): Likewise.
+ (gnat_rewrite_reference): Likewise.
+ (get_inner_constant_reference): Likewise.
+
+2016-01-18 Eric Botcazou <ebotcazou@adacore.com>
+
PR ada/69219
* gcc-interface/trans.c (check_inlining_for_nested_subprog): Consider
the parent function instead of the current function in order to issue
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index 715fbadc968..ceabd175ae4 100644
--- a/gcc/ada/gcc-interface/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1992-2015, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2016, 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- *
@@ -189,14 +189,12 @@ do { \
/* True for types that implement a packed array and for original packed array
types. */
-#define TYPE_IMPLEMENTS_PACKED_ARRAY_P(NODE) \
- ((TREE_CODE (NODE) == ARRAY_TYPE && TYPE_PACKED (NODE)) \
- || (TREE_CODE (NODE) == INTEGER_TYPE && TYPE_PACKED_ARRAY_TYPE_P (NODE))) \
+#define TYPE_IMPL_PACKED_ARRAY_P(NODE) \
+ ((TREE_CODE (NODE) == ARRAY_TYPE && TYPE_PACKED (NODE)) \
+ || (TREE_CODE (NODE) == INTEGER_TYPE && TYPE_PACKED_ARRAY_TYPE_P (NODE)))
/* True for types that can hold a debug type. */
-#define TYPE_CAN_HAVE_DEBUG_TYPE_P(NODE) \
- (!TYPE_IMPLEMENTS_PACKED_ARRAY_P (NODE) \
- && TYPE_DEBUG_TYPE (NODE) != NULL_TREE)
+#define TYPE_CAN_HAVE_DEBUG_TYPE_P(NODE) (!TYPE_IMPL_PACKED_ARRAY_P (NODE))
/* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
template and the object.
@@ -385,8 +383,8 @@ do { \
#define SET_TYPE_DEBUG_TYPE(NODE, X) \
SET_TYPE_LANG_SPECIFIC2 (NODE, X)
-/* For types with TYPE_IMPLEMENTS_PACKED_ARRAY_P, this is the original packed
- array type. Note that this predicate is trou for original packed array
+/* For types with TYPE_IMPL_PACKED_ARRAY_P, this is the original packed
+ array type. Note that this predicate is true for original packed array
types, so these cannot have a debug type. */
#define TYPE_ORIGINAL_PACKED_ARRAY(NODE) \
GET_TYPE_LANG_SPECIFIC2 (NODE)
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 0b1cd6f18bf..34e9e91f6ea 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2015, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2016, 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- *
@@ -1002,7 +1002,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* We cannot evaluate the first arm of a COMPOUND_EXPR in the
correct place for this case, hence the above test. */
- gcc_assert (init == NULL_TREE);
+ gcc_assert (!init);
/* No DECL_EXPR will be created so the expression needs to be
marked manually because it will likely be shared. */
@@ -2551,14 +2551,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
types, are biased or are wider than sizetype. These are GNAT
encodings, so we have to include them only when all encodings
are requested. */
- if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL
- && (TREE_CODE (gnu_orig_min) != INTEGER_CST
- || TREE_CODE (gnu_orig_max) != INTEGER_CST
- || TREE_CODE (gnu_index_type) != INTEGER_TYPE
- || (TREE_TYPE (gnu_index_type)
- && TREE_CODE (TREE_TYPE (gnu_index_type))
- != INTEGER_TYPE)
- || TYPE_BIASED_REPRESENTATION_P (gnu_index_type)))
+ if ((TREE_CODE (gnu_orig_min) != INTEGER_CST
+ || TREE_CODE (gnu_orig_max) != INTEGER_CST
+ || TREE_CODE (gnu_index_type) != INTEGER_TYPE
+ || (TREE_TYPE (gnu_index_type)
+ && TREE_CODE (TREE_TYPE (gnu_index_type))
+ != INTEGER_TYPE)
+ || TYPE_BIASED_REPRESENTATION_P (gnu_index_type))
+ && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
need_index_type_struct = true;
}
@@ -2621,8 +2621,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
}
/* Strip the ___XP suffix for standard DWARF. */
- if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL
- && Is_Packed_Array_Impl_Type (gnat_entity))
+ if (Is_Packed_Array_Impl_Type (gnat_entity)
+ && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
{
Entity_Id gnat_original_array_type
= Underlying_Type (Original_Array_Type (gnat_entity));
@@ -2717,8 +2717,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{
tree gnu_base_decl
= gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, 0);
- if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL
- && !DECL_ARTIFICIAL (gnu_base_decl))
+ if (!DECL_ARTIFICIAL (gnu_base_decl)
+ && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
add_parallel_type (gnu_type,
TREE_TYPE (TREE_TYPE (gnu_base_decl)));
}
@@ -4279,7 +4279,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& Present (gnat_renamed)
&& (Ekind (gnat_renamed) == E_Function
|| Ekind (gnat_renamed) == E_Procedure)
- && gnu_decl != NULL_TREE
+ && gnu_decl
&& TREE_CODE (gnu_decl) == FUNCTION_DECL)
{
tree decl = build_decl (input_location, IMPORTED_DECL,
@@ -4306,7 +4306,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
to let developers be notified on demand without risking false
positives with common default sets of options. */
- if (gnu_builtin_decl == NULL_TREE && warn_shadow)
+ if (!gnu_builtin_decl && warn_shadow)
post_error ("?gcc intrinsic not found for&!", gnat_entity);
}
@@ -6171,8 +6171,8 @@ initial_value_needs_conversion (tree gnu_type, tree gnu_expr)
without one, to keep the object simpler. */
if (TREE_CODE (gnu_type) == RECORD_TYPE
&& TREE_CODE (TREE_TYPE (gnu_expr)) == RECORD_TYPE
- && get_variant_part (gnu_type) != NULL_TREE
- && get_variant_part (TREE_TYPE (gnu_expr)) == NULL_TREE)
+ && get_variant_part (gnu_type)
+ && !get_variant_part (TREE_TYPE (gnu_expr)))
return false;
/* In all the other cases, convert the expression to the object's type. */
@@ -8527,17 +8527,17 @@ intrin_arglists_compatible_p (intrin_binding_t * inb)
/* Sequence position of the last argument we checked. */
int argpos = 0;
- while (1)
+ while (true)
{
tree ada_type = function_args_iter_cond (&ada_iter);
tree btin_type = function_args_iter_cond (&btin_iter);
/* If we've exhausted both lists simultaneously, we're done. */
- if (ada_type == NULL_TREE && btin_type == NULL_TREE)
+ if (!ada_type && !btin_type)
break;
/* If one list is shorter than the other, they fail to match. */
- if (ada_type == NULL_TREE || btin_type == NULL_TREE)
+ if (!ada_type || !btin_type)
return false;
/* If we're done with the Ada args and not with the internal builtin
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index adaea7f6465..f051c0c0acf 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2015, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2016, 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- *
@@ -112,8 +112,8 @@ gnat_parse_file (void)
/* ??? Call the SEH initialization routine. This is to workaround
a bootstrap path problem. The call below should be removed at some
- point and the SEH pointer passed to __gnat_initialize() above. */
- __gnat_install_SEH_handler((void *)seh);
+ point and the SEH pointer passed to __gnat_initialize above. */
+ __gnat_install_SEH_handler ((void *)seh);
/* Call the front-end elaboration procedures. */
adainit ();
@@ -528,10 +528,10 @@ gnat_print_type (FILE *file, tree node, int indent)
break;
}
- if (TYPE_CAN_HAVE_DEBUG_TYPE_P (node) && TYPE_DEBUG_TYPE (node) != NULL_TREE)
+ if (TYPE_CAN_HAVE_DEBUG_TYPE_P (node) && TYPE_DEBUG_TYPE (node))
print_node_brief (file, "debug type", TYPE_DEBUG_TYPE (node), indent + 4);
- else if (TYPE_IMPLEMENTS_PACKED_ARRAY_P (node)
- && TYPE_ORIGINAL_PACKED_ARRAY (node) != NULL_TREE)
+
+ if (TYPE_IMPL_PACKED_ARRAY_P (node) && TYPE_ORIGINAL_PACKED_ARRAY (node))
print_node_brief (file, "original packed array",
TYPE_ORIGINAL_PACKED_ARRAY (node), indent + 4);
}
@@ -575,23 +575,25 @@ gnat_descriptive_type (const_tree type)
return NULL_TREE;
}
-/* Return the type to used for debugging information instead of TYPE, if any.
+/* Return the type to be used for debugging information instead of TYPE or
NULL_TREE if TYPE is fine. */
static tree
gnat_get_debug_type (const_tree type)
{
- if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type))
+ if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) && TYPE_DEBUG_TYPE (type))
{
type = TYPE_DEBUG_TYPE (type);
- /* ??? Kludge: the get_debug_type language hook is processed after the
- array descriptor language hook, so if there is an array behind this
- type, the latter is supposed to handle it. Still, we can get here
- with a type we are not supposed to handle (when the DWARF back-end
+
+ /* ??? The get_debug_type language hook is processed after the array
+ descriptor language hook, so if there is an array behind this type,
+ the latter is supposed to handle it. Still, we can get here with
+ a type we are not supposed to handle (e.g. when the DWARF back-end
processes the type of a variable), so keep this guard. */
- if (type != NULL_TREE && !TYPE_IMPLEMENTS_PACKED_ARRAY_P (type))
+ if (type && TYPE_CAN_HAVE_DEBUG_TYPE_P (type))
return const_cast<tree> (type);
}
+
return NULL_TREE;
}
@@ -606,8 +608,8 @@ gnat_get_fixed_point_type_info (const_tree type,
/* GDB cannot handle fixed-point types yet, so rely on GNAT encodings
instead for it. */
- if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL
- || !TYPE_IS_FIXED_POINT_P (type))
+ if (!TYPE_IS_FIXED_POINT_P (type)
+ || gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
return false;
scale_factor = TYPE_SCALE_FACTOR (type);
@@ -640,6 +642,7 @@ gnat_get_fixed_point_type_info (const_tree type,
gcc_assert (num == integer_one_node
&& TREE_CODE (base) == INTEGER_CST
&& TREE_CODE (exponent) == INTEGER_CST);
+
switch (tree_to_shwi (base))
{
case 2:
@@ -661,6 +664,7 @@ gnat_get_fixed_point_type_info (const_tree type,
expect N / D with constant operands. */
gcc_assert (TREE_CODE (num) == INTEGER_CST
&& TREE_CODE (den) == INTEGER_CST);
+
info->scale_factor_kind = fixed_point_scale_factor_arbitrary;
info->scale_factor.arbitrary.numerator = tree_to_uhwi (num);
info->scale_factor.arbitrary.denominator = tree_to_shwi (den);
@@ -746,7 +750,7 @@ gnat_type_max_size (const_tree gnu_type)
return max_unitsize;
}
-static tree get_array_bit_stride (tree comp_type);
+static tree get_array_bit_stride (tree);
/* Provide information in INFO for debug output about the TYPE array type.
Return whether TYPE is handled. */
@@ -759,9 +763,7 @@ gnat_get_array_descr_info (const_tree const_type,
bool is_array = false;
bool is_fat_ptr = false;
bool is_packed_array = false;
-
tree type = const_cast<tree> (const_type);
-
const_tree first_dimen = NULL_TREE;
const_tree last_dimen = NULL_TREE;
const_tree dimen;
@@ -774,18 +776,16 @@ gnat_get_array_descr_info (const_tree const_type,
tree thinptr_template_expr = NULL_TREE;
tree thinptr_bound_field = NULL_TREE;
- /* ??? Kludge: see gnat_get_debug_type. */
- if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
- && TYPE_DEBUG_TYPE (type) != NULL_TREE)
+ /* ??? See gnat_get_debug_type. */
+ if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) && TYPE_DEBUG_TYPE (type))
type = TYPE_DEBUG_TYPE (type);
/* If we have an implementation type for a packed array, get the orignial
array type. */
- if (TYPE_IMPLEMENTS_PACKED_ARRAY_P (type)
- && TYPE_ORIGINAL_PACKED_ARRAY (type) != NULL_TREE)
+ if (TYPE_IMPL_PACKED_ARRAY_P (type) && TYPE_ORIGINAL_PACKED_ARRAY (type))
{
- is_packed_array = true;
type = TYPE_ORIGINAL_PACKED_ARRAY (type);
+ is_packed_array = true;
}
/* First pass: gather all information about this array except everything
@@ -801,8 +801,8 @@ gnat_get_array_descr_info (const_tree const_type,
info->data_location = NULL_TREE;
}
- else if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL
- && TYPE_IS_FAT_POINTER_P (type))
+ else if (TYPE_IS_FAT_POINTER_P (type)
+ && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
{
const tree ua_type = TYPE_UNCONSTRAINED_ARRAY (type);
@@ -828,9 +828,9 @@ gnat_get_array_descr_info (const_tree const_type,
them to appear in the debug info as pointers to an array type. That's why
we match only the RECORD_TYPE here instead of the POINTER_TYPE with the
TYPE_IS_THIN_POINTER_P predicate. */
- else if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL
- && TREE_CODE (type) == RECORD_TYPE
- && TYPE_CONTAINS_TEMPLATE_P (type))
+ else if (TREE_CODE (type) == RECORD_TYPE
+ && TYPE_CONTAINS_TEMPLATE_P (type)
+ && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
{
/* This will be our base object address. Note that we assume that
pointers to these will actually point to the array field (thin
@@ -910,9 +910,7 @@ gnat_get_array_descr_info (const_tree const_type,
structure. */
for (i = (convention_fortran_p ? info->ndimensions - 1 : 0),
dimen = first_dimen;
-
0 <= i && i < info->ndimensions;
-
i += (convention_fortran_p ? -1 : 1),
dimen = TREE_TYPE (dimen))
{
@@ -927,12 +925,10 @@ gnat_get_array_descr_info (const_tree const_type,
there are two cases where we generate self-referencial bound
expressions: arrays that are constrained by record discriminants
and XUA types. */
- const bool is_xua_type =
- (TYPE_CONTEXT (first_dimen) != NULL_TREE
- && TREE_CODE (TYPE_CONTEXT (first_dimen)) != RECORD_TYPE
- && contains_placeholder_p (TYPE_MIN_VALUE (index_type)));
-
- if (is_xua_type && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
+ if (TYPE_CONTEXT (first_dimen)
+ && TREE_CODE (TYPE_CONTEXT (first_dimen)) != RECORD_TYPE
+ && contains_placeholder_p (TYPE_MIN_VALUE (index_type))
+ && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
{
info->dimen[i].lower_bound = NULL_TREE;
info->dimen[i].upper_bound = NULL_TREE;
@@ -960,9 +956,10 @@ gnat_get_array_descr_info (const_tree const_type,
/* The DWARF back-end will output exactly INDEX_TYPE as the array index'
"root" type, so pell subtypes when possible. */
- while (TREE_TYPE (index_type) != NULL_TREE
+ while (TREE_TYPE (index_type)
&& !subrange_type_for_debug_p (index_type, NULL, NULL))
index_type = TREE_TYPE (index_type);
+
info->dimen[i].bounds_type = index_type;
info->dimen[i].stride = NULL_TREE;
}
@@ -980,9 +977,9 @@ gnat_get_array_descr_info (const_tree const_type,
element. This is why we emit a stride in such situations. */
tree source_element_type = info->element_type;
- while (1)
+ while (true)
{
- if (TYPE_DEBUG_TYPE (source_element_type) != NULL_TREE)
+ if (TYPE_DEBUG_TYPE (source_element_type))
source_element_type = TYPE_DEBUG_TYPE (source_element_type);
else if (TYPE_IS_PADDING_P (source_element_type))
source_element_type
@@ -1024,11 +1021,9 @@ get_array_bit_stride (tree comp_type)
if (INTEGRAL_TYPE_P (comp_type))
return TYPE_RM_SIZE (comp_type);
- /* Otherwise, see if this is an array we can analyze. */
+ /* Otherwise, see if this is an array we can analyze; if it's not, punt. */
memset (&info, 0, sizeof (info));
- if (!gnat_get_array_descr_info (comp_type, &info)
- || info.stride == NULL_TREE)
- /* If it's not, give it up. */
+ if (!gnat_get_array_descr_info (comp_type, &info) || !info.stride)
return NULL_TREE;
/* Otherwise, the array stride is the inner array's stride multiplied by the
@@ -1047,8 +1042,7 @@ get_array_bit_stride (tree comp_type)
{
tree count;
- if (info.dimen[i].lower_bound == NULL_TREE
- || info.dimen[i].upper_bound == NULL_TREE)
+ if (!info.dimen[i].lower_bound || !info.dimen[i].upper_bound)
return NULL_TREE;
/* Put in count an expression that computes the length of this
@@ -1080,13 +1074,16 @@ gnat_get_subrange_bounds (const_tree gnu_type, tree *lowval, tree *highval)
*highval = TYPE_MAX_VALUE (gnu_type);
}
+/* Return the bias of GNU_TYPE, if any. */
+
static tree
gnat_get_type_bias (const_tree gnu_type)
{
if (TREE_CODE (gnu_type) == INTEGER_TYPE
&& TYPE_BIASED_REPRESENTATION_P (gnu_type)
&& gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
- return TYPE_RM_MIN_VALUE(gnu_type);
+ return TYPE_RM_MIN_VALUE (gnu_type);
+
return NULL_TREE;
}
@@ -1240,7 +1237,7 @@ enumerate_modes (void (*f) (const char *, int, int, int, int, int, int, int))
digs = fmt->p;
else
- gcc_unreachable();
+ gcc_unreachable ();
}
/* First register any C types for this mode that the front end
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 8f8778e7a35..10136e8888b 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2015, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2016, 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- *
@@ -6027,7 +6027,7 @@ gnat_to_gnu (Node_Id gnat_node)
full view since the clause is on the partial view and we cannot have
2 different GCC trees for the object. The only bits of the full view
we will use is the initializer, but it will be directly fetched. */
- if (Ekind(gnat_temp) == E_Constant
+ if (Ekind (gnat_temp) == E_Constant
&& Present (Address_Clause (gnat_temp))
&& Present (Full_View (gnat_temp)))
save_gnu_tree (Full_View (gnat_temp), error_mark_node, true);
@@ -8035,7 +8035,7 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
/* If this is a variable and an initializer is attached to it, it must be
valid for the context. Similar to init_const in create_var_decl. */
if (TREE_CODE (gnu_decl) == VAR_DECL
- && (gnu_init = DECL_INITIAL (gnu_decl)) != NULL_TREE
+ && (gnu_init = DECL_INITIAL (gnu_decl))
&& (!gnat_types_compatible_p (type, TREE_TYPE (gnu_init))
|| (TREE_STATIC (gnu_decl)
&& !initializer_constant_valid_p (gnu_init,
@@ -8128,7 +8128,7 @@ end_stmt_group (void)
are cleanups, make a TRY_FINALLY_EXPR. Last, if there is a BLOCK,
make a BIND_EXPR. Note that we nest in that because the cleanup may
reference variables in the block. */
- if (gnu_retval == NULL_TREE)
+ if (!gnu_retval)
gnu_retval = alloc_stmt_list ();
if (group->cleanups)
@@ -9023,7 +9023,7 @@ build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left,
break;
default:
- gcc_unreachable();
+ gcc_unreachable ();
}
check = fold_build3 (COND_EXPR, boolean_type_node, rhs_lt_zero, check_neg,
@@ -10083,7 +10083,39 @@ post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t,
Error_Msg_Uint_2 = UI_From_Int (num);
post_error_ne_tree (msg, node, ent, t);
}
-
+
+/* Return a label to branch to for the exception type in KIND or NULL_TREE
+ if none. */
+
+tree
+get_exception_label (char kind)
+{
+ switch (kind)
+ {
+ case N_Raise_Constraint_Error:
+ return gnu_constraint_error_label_stack->last ();
+
+ case N_Raise_Storage_Error:
+ return gnu_storage_error_label_stack->last ();
+
+ case N_Raise_Program_Error:
+ return gnu_program_error_label_stack->last ();
+
+ default:
+ break;
+ }
+
+ return NULL_TREE;
+}
+
+/* Return the decl for the current elaboration procedure. */
+
+tree
+get_elaboration_procedure (void)
+{
+ return gnu_elab_proc_stack->last ();
+}
+
/* Initialize the table that maps GNAT codes to GCC codes for simple
binary and unary operations. */
@@ -10117,28 +10149,4 @@ init_code_table (void)
gnu_codes[N_Op_Shift_Right_Arithmetic] = RSHIFT_EXPR;
}
-/* Return a label to branch to for the exception type in KIND or NULL_TREE
- if none. */
-
-tree
-get_exception_label (char kind)
-{
- if (kind == N_Raise_Constraint_Error)
- return gnu_constraint_error_label_stack->last ();
- else if (kind == N_Raise_Storage_Error)
- return gnu_storage_error_label_stack->last ();
- else if (kind == N_Raise_Program_Error)
- return gnu_program_error_label_stack->last ();
- else
- return NULL_TREE;
-}
-
-/* Return the decl for the current elaboration procedure. */
-
-tree
-get_elaboration_procedure (void)
-{
- return gnu_elab_proc_stack->last ();
-}
-
#include "gt-ada-trans.h"
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 18d2106771f..aac39db2c57 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -429,7 +429,7 @@ build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, tree gnu_desig_type)
bool
global_bindings_p (void)
{
- return force_global || current_function_decl == NULL_TREE;
+ return force_global || !current_function_decl;
}
/* Enter a new binding level. */
@@ -515,7 +515,7 @@ gnat_poplevel (void)
parent block. Otherwise, add it to the list of its parent. */
if (TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL)
;
- else if (BLOCK_VARS (block) == NULL_TREE)
+ else if (!BLOCK_VARS (block))
{
BLOCK_SUBBLOCKS (level->chain->block)
= block_chainon (BLOCK_SUBBLOCKS (block),
@@ -570,9 +570,9 @@ gnat_set_type_context (tree type, tree context)
/* Give a context to the parallel types and their stub decl, if any.
Some parallel types seems to be present in multiple parallel type
chains, so don't mess with their context if they already have one. */
- if (TYPE_CONTEXT (parallel_type) == NULL_TREE)
+ if (!TYPE_CONTEXT (parallel_type))
{
- if (TYPE_STUB_DECL (parallel_type) != NULL_TREE)
+ if (TYPE_STUB_DECL (parallel_type))
DECL_CONTEXT (TYPE_STUB_DECL (parallel_type)) = context;
TYPE_CONTEXT (parallel_type) = context;
}
@@ -625,17 +625,18 @@ get_debug_scope (Node_Id gnat_node, bool *is_subprogram)
the outer one. */
break;
}
+
gnat_entity = Scope (gnat_entity);
}
+
return Empty;
}
-/* If N is NULL, set TYPE's context to CONTEXT. Defer this to the processing of
- N otherwise. */
+/* If N is NULL, set TYPE's context to CONTEXT. Defer this to the processing
+ of N otherwise. */
static void
-defer_or_set_type_context (tree type,
- tree context,
+defer_or_set_type_context (tree type, tree context,
struct deferred_decl_context_node *n)
{
if (n)
@@ -644,7 +645,7 @@ defer_or_set_type_context (tree type,
gnat_set_type_context (type, context);
}
-/* Return global_context. Create it if needed, first. */
+/* Return global_context, but create it first if need be. */
static tree
get_global_context (void)
@@ -654,6 +655,7 @@ get_global_context (void)
global_context = build_translation_unit_decl (NULL_TREE);
debug_hooks->register_main_translation_unit (global_context);
}
+
return global_context;
}
@@ -694,14 +696,14 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
/* External declarations (when force_global > 0) may not be in a
local context. */
- else if (current_function_decl != NULL_TREE && force_global == 0)
+ else if (current_function_decl && force_global == 0)
context = current_function_decl;
}
/* If either we are forced to be in global mode or if both the GNAT scope and
- the current_function_decl did not help determining the context, use the
+ the current_function_decl did not help in determining the context, use the
global scope. */
- if (!deferred_decl_context && context == NULL_TREE)
+ if (!deferred_decl_context && !context)
context = get_global_context ();
/* Functions imported in another function are not really nested.
@@ -710,9 +712,9 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
lower_nested_functions will then recompute it. */
if (TREE_CODE (decl) == FUNCTION_DECL
&& !TREE_PUBLIC (decl)
- && context != NULL_TREE
+ && context
&& (TREE_CODE (context) == FUNCTION_DECL
- || decl_function_context (context) != NULL_TREE))
+ || decl_function_context (context)))
DECL_STATIC_CHAIN (decl) = 1;
if (!deferred_decl_context)
@@ -1281,16 +1283,15 @@ maybe_pad_type (tree type, tree size, unsigned int align,
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
SET_TYPE_DEBUG_TYPE (record, type);
- /* ??? Kludge: padding types around packed array implementation types will be
+ /* ??? Padding types around packed array implementation types will be
considered as root types in the array descriptor language hook (see
gnat_get_array_descr_info). Give them the original packed array type
name so that the one coming from sources appears in the debugging
information. */
- if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL
- && TYPE_IMPLEMENTS_PACKED_ARRAY_P (type)
- && TYPE_ORIGINAL_PACKED_ARRAY (type) != NULL_TREE)
- TYPE_NAME (record)
- = TYPE_NAME (TYPE_ORIGINAL_PACKED_ARRAY (type));
+ if (TYPE_IMPL_PACKED_ARRAY_P (type)
+ && TYPE_ORIGINAL_PACKED_ARRAY (type)
+ && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
+ TYPE_NAME (record) = TYPE_NAME (TYPE_ORIGINAL_PACKED_ARRAY (type));
else if (Present (gnat_entity))
TYPE_NAME (record) = create_concat_name (gnat_entity, "PAD");
@@ -1855,17 +1856,17 @@ add_parallel_type (tree type, tree parallel_type)
SET_DECL_PARALLEL_TYPE (decl, parallel_type);
/* If PARALLEL_TYPE already has a context, we are done. */
- if (TYPE_CONTEXT (parallel_type) != NULL_TREE)
+ if (TYPE_CONTEXT (parallel_type))
return;
- /* Otherwise, try to get one from TYPE's context. */
- if (TYPE_CONTEXT (type) != NULL_TREE)
- /* TYPE already has a context, so simply propagate it to PARALLEL_TYPE. */
+ /* Otherwise, try to get one from TYPE's context. If so, simply propagate
+ it to PARALLEL_TYPE. */
+ if (TYPE_CONTEXT (type))
gnat_set_type_context (parallel_type, TYPE_CONTEXT (type));
- /* ... otherwise TYPE has not context yet. We know it will thanks to
- gnat_pushdecl, and then its context will be propagated to PARALLEL_TYPE.
- So we have nothing to do in this case. */
+ /* Otherwise TYPE has not context yet. We know it will have one thanks to
+ gnat_pushdecl and then its context will be propagated to PARALLEL_TYPE,
+ so we have nothing to do in this case. */
}
/* Return true if TYPE has a parallel type. */
@@ -2269,7 +2270,7 @@ create_range_type (tree type, tree min, tree max)
{
tree range_type;
- if (type == NULL_TREE)
+ if (!type)
type = sizetype;
/* First build a type with the base range. */
@@ -2905,32 +2906,30 @@ process_deferred_decl_context (bool force)
while (Present (gnat_scope))
{
context = compute_deferred_decl_context (gnat_scope);
- if (!force || context != NULL_TREE)
+ if (!force || context)
break;
gnat_scope = get_debug_scope (gnat_scope, NULL);
}
/* Imported declarations must not be in a local context (i.e. not inside
a function). */
- if (context != NULL_TREE && node->force_global > 0)
+ if (context && node->force_global > 0)
{
tree ctx = context;
- while (ctx != NULL_TREE)
+ while (ctx)
{
gcc_assert (TREE_CODE (ctx) != FUNCTION_DECL);
- ctx = (DECL_P (ctx))
- ? DECL_CONTEXT (ctx)
- : TYPE_CONTEXT (ctx);
+ ctx = DECL_P (ctx) ? DECL_CONTEXT (ctx) : TYPE_CONTEXT (ctx);
}
}
/* If FORCE, we want to get rid of all nodes in the queue: in case there
was no elaborated scope, use the global context. */
- if (force && context == NULL_TREE)
+ if (force && !context)
context = get_global_context ();
- if (context != NULL_TREE)
+ if (context)
{
tree t;
int i;
@@ -4514,11 +4513,11 @@ convert (tree type, tree expr)
if (TYPE_IS_THIN_POINTER_P (etype) && TYPE_IS_THIN_POINTER_P (type))
{
tree etype_pos
- = TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (etype)) != NULL_TREE
+ = TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (etype))
? byte_position (DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (etype))))
: size_zero_node;
tree type_pos
- = TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)) != NULL_TREE
+ = TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))
? byte_position (DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (type))))
: size_zero_node;
tree byte_diff = size_diffop (type_pos, etype_pos);
@@ -6107,7 +6106,7 @@ def_builtin_1 (enum built_in_function fncode,
/* Preserve an already installed decl. It most likely was setup in advance
(e.g. as part of the internal builtins) for specific reasons. */
- if (builtin_decl_explicit (fncode) != NULL_TREE)
+ if (builtin_decl_explicit (fncode))
return;
gcc_assert ((!both_p && !fallback_p)
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index feed1cb0175..803a243c5c5 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2015, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2016, 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- *
@@ -223,8 +223,8 @@ find_common_type (tree t1, tree t2)
|| (TYPE_SIZE (t1) == TYPE_SIZE (t2)
&& !(TREE_CODE (t1) == RECORD_TYPE
&& TREE_CODE (t2) == RECORD_TYPE
- && get_variant_part (t1) != NULL_TREE
- && get_variant_part (t2) == NULL_TREE))))
+ && get_variant_part (t1)
+ && !get_variant_part (t2)))))
return t1;
/* Otherwise, if the lhs type is non-BLKmode, use it. Note that we know
@@ -852,7 +852,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
{
case INIT_EXPR:
case MODIFY_EXPR:
- gcc_checking_assert (result_type == NULL_TREE);
+ gcc_checking_assert (!result_type);
/* If there were integral or pointer conversions on the LHS, remove
them; we'll be putting them back below if needed. Likewise for
@@ -2408,7 +2408,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
}
/* Indicate that we need to take the address of T and that it therefore
- should not be allocated in a register. Returns true if successful. */
+ should not be allocated in a register. Return true if successful. */
bool
gnat_mark_addressable (tree t)
@@ -2704,7 +2704,7 @@ gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, tree *init)
break;
case COMPOUND_EXPR:
- gcc_assert (*init == NULL_TREE);
+ gcc_assert (!*init);
*init = TREE_OPERAND (ref, 0);
/* We expect only the pattern built in Call_to_gnu. */
gcc_assert (DECL_P (TREE_OPERAND (ref, 1))
@@ -2778,7 +2778,7 @@ get_inner_constant_reference (tree exp)
break;
case COMPONENT_REF:
- if (TREE_OPERAND (exp, 2) != NULL_TREE)
+ if (TREE_OPERAND (exp, 2))
return NULL_TREE;
if (!TREE_CONSTANT (DECL_FIELD_OFFSET (TREE_OPERAND (exp, 1))))
@@ -2788,8 +2788,7 @@ get_inner_constant_reference (tree exp)
case ARRAY_REF:
case ARRAY_RANGE_REF:
{
- if (TREE_OPERAND (exp, 2) != NULL_TREE
- || TREE_OPERAND (exp, 3) != NULL_TREE)
+ if (TREE_OPERAND (exp, 2) || TREE_OPERAND (exp, 3))
return NULL_TREE;
tree array_type = TREE_TYPE (TREE_OPERAND (exp, 0));
@@ -2917,7 +2916,7 @@ gnat_invariant_expr (tree expr)
switch (TREE_CODE (t))
{
case COMPONENT_REF:
- if (TREE_OPERAND (t, 2) != NULL_TREE)
+ if (TREE_OPERAND (t, 2))
return NULL_TREE;
invariant_p |= DECL_INVARIANT_P (TREE_OPERAND (t, 1));
break;
@@ -2925,8 +2924,8 @@ gnat_invariant_expr (tree expr)
case ARRAY_REF:
case ARRAY_RANGE_REF:
if (!TREE_CONSTANT (TREE_OPERAND (t, 1))
- || TREE_OPERAND (t, 2) != NULL_TREE
- || TREE_OPERAND (t, 3) != NULL_TREE)
+ || TREE_OPERAND (t, 2)
+ || TREE_OPERAND (t, 3))
return NULL_TREE;
break;