aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-01-18 11:10:42 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-01-18 11:10:42 +0000
commit7c775aca298673f95dddfb8605f11b0e2f236361 (patch)
tree0bffe85bad394e4bb7306e24515f3f47f8dfe5d1 /gcc/ada/gcc-interface/utils.c
parent3dd5f42e90fa6e296d233b0f05c3a760a45d1313 (diff)
downloadgcc-7c775aca298673f95dddfb8605f11b0e2f236361.zip
gcc-7c775aca298673f95dddfb8605f11b0e2f236361.tar.gz
gcc-7c775aca298673f95dddfb8605f11b0e2f236361.tar.bz2
ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename to
* 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. From-SVN: r232501
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 18d2106..aac39db 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)