cuintp.c: Remove useless include directives.

* gcc-interface/cuintp.c: Remove useless include directives.
	(build_cst_from_int): Use standard predicate.
	(UI_To_gnu): Simplify.
	(UI_From_gnu): Fix formatting.
	* gcc-interface/trans.c (post_error): Likewise.
	(post_error_ne): Likewise.

From-SVN: r203851
This commit is contained in:
Eric Botcazou 2013-10-19 11:03:34 +00:00 committed by Eric Botcazou
parent 4708440c7c
commit 457f72ac38
3 changed files with 43 additions and 35 deletions

View File

@ -1,3 +1,12 @@
2013-10-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/cuintp.c: Remove useless include directives.
(build_cst_from_int): Use standard predicate.
(UI_To_gnu): Simplify.
(UI_From_gnu): Fix formatting.
* gcc-interface/trans.c (post_error): Likewise.
(post_error_ne): Likewise.
2013-10-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (gnat_set_type_context): New function.

View File

@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
* Copyright (C) 1992-2012, Free Software Foundation, Inc. *
* Copyright (C) 1992-2013, 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- *
@ -23,8 +23,8 @@
* *
****************************************************************************/
/* This file corresponds to the Ada package body Uintp. It was created
manually from the files uintp.ads and uintp.adb. */
/* This file corresponds to the Ada package body Uintp. It was created
manually from the files uintp.ads and uintp.adb. */
#include "config.h"
#include "system.h"
@ -35,11 +35,6 @@
#include "ada.h"
#include "types.h"
#include "uintp.h"
#include "atree.h"
#include "elists.h"
#include "nlists.h"
#include "stringt.h"
#include "fe.h"
#include "ada-tree.h"
#include "gigi.h"
@ -53,13 +48,13 @@
the integer value itself. The origin of the Uints_Ptr table is adjusted so
that a Uint value of Uint_Bias indexes the first element.
First define a utility function that operates like build_int_cst for
integral types and does a conversion to floating-point for real types. */
First define a utility function that operates like build_int_cst_type for
integral types and does a conversion for floating-point types. */
static tree
build_cst_from_int (tree type, HOST_WIDE_INT low)
{
if (TREE_CODE (type) == REAL_TYPE)
if (SCALAR_FLOAT_TYPE_P (type))
return convert (type, build_int_cst (NULL_TREE, low));
else
return build_int_cst_type (type, low);
@ -73,20 +68,15 @@ build_cst_from_int (tree type, HOST_WIDE_INT low)
tree
UI_To_gnu (Uint Input, tree type)
{
/* We might have a TYPE with biased representation and be passed an unbiased
value that doesn't fit. We always use an unbiased type to be able to hold
any such possible value for intermediate computations and then rely on a
conversion back to TYPE to perform the bias adjustment when need be. */
tree comp_type
= TREE_CODE (type) == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)
? get_base_type (type) : type;
tree gnu_ret;
/* We might have a TYPE with biased representation and be passed an
unbiased value that doesn't fit. We always use an unbiased type able
to hold any such possible value for intermediate computations, and
then rely on a conversion back to TYPE to perform the bias adjustment
when need be. */
int biased_type_p
= (TREE_CODE (type) == INTEGER_TYPE
&& TYPE_BIASED_REPRESENTATION_P (type));
tree comp_type = biased_type_p ? get_base_type (type) : type;
if (Input <= Uint_Direct_Last)
gnu_ret = build_cst_from_int (comp_type, Input - Uint_Direct_Bias);
else
@ -188,12 +178,13 @@ UI_From_gnu (tree Input)
{
v[i] = tree_low_cst (fold_build1 (ABS_EXPR, gnu_type,
fold_build2 (TRUNC_MOD_EXPR, gnu_type,
gnu_temp, gnu_base)),
0);
gnu_temp, gnu_base)), 0);
gnu_temp = fold_build2 (TRUNC_DIV_EXPR, gnu_type, gnu_temp, gnu_base);
}
temp.Low_Bound = 1, temp.High_Bound = Max_For_Dint;
vec.Array = v, vec.Bounds = &temp;
temp.Low_Bound = 1;
temp.High_Bound = Max_For_Dint;
vec.Bounds = &temp;
vec.Array = v;
return Vector_To_Uint (vec, tree_int_cst_sgn (Input) < 0);
}

View File

@ -9221,10 +9221,14 @@ post_error (const char *msg, Node_Id node)
String_Template temp;
Fat_Pointer fp;
temp.Low_Bound = 1, temp.High_Bound = strlen (msg);
fp.Array = msg, fp.Bounds = &temp;
if (Present (node))
Error_Msg_N (fp, node);
if (No (node))
return;
temp.Low_Bound = 1;
temp.High_Bound = strlen (msg);
fp.Bounds = &temp;
fp.Array = msg;
Error_Msg_N (fp, node);
}
/* Similar to post_error, but NODE is the node at which to post the error and
@ -9236,10 +9240,14 @@ post_error_ne (const char *msg, Node_Id node, Entity_Id ent)
String_Template temp;
Fat_Pointer fp;
temp.Low_Bound = 1, temp.High_Bound = strlen (msg);
fp.Array = msg, fp.Bounds = &temp;
if (Present (node))
Error_Msg_NE (fp, node, ent);
if (No (node))
return;
temp.Low_Bound = 1;
temp.High_Bound = strlen (msg);
fp.Bounds = &temp;
fp.Array = msg;
Error_Msg_NE (fp, node, ent);
}
/* Similar to post_error_ne, but NUM is the number to use for the '^'. */