aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2013-10-19 11:03:34 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2013-10-19 11:03:34 +0000
commit457f72ac38955335c4b3f20e353bc9891681d805 (patch)
tree05abbf795b9b521ad13fafbf7f1c41eaa4ad795a /gcc
parent4708440c7c3e49438684e33c6aa045336112567c (diff)
downloadgcc-457f72ac38955335c4b3f20e353bc9891681d805.zip
gcc-457f72ac38955335c4b3f20e353bc9891681d805.tar.gz
gcc-457f72ac38955335c4b3f20e353bc9891681d805.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/gcc-interface/cuintp.c45
-rw-r--r--gcc/ada/gcc-interface/trans.c24
3 files changed, 43 insertions, 35 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 68e0cb9..f67ab1f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,14 @@
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.
(gnat_pushdecl): Use it to set the context of the type.
diff --git a/gcc/ada/gcc-interface/cuintp.c b/gcc/ada/gcc-interface/cuintp.c
index e077d9c..9b58b0e 100644
--- a/gcc/ada/gcc-interface/cuintp.c
+++ b/gcc/ada/gcc-interface/cuintp.c
@@ -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);
}
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 388345f..7eef8aa 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -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 '^'. */