From 985cf20a828de32b1c6791a5df3b8ba13abbabe6 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sat, 19 Oct 2013 11:03:34 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203851 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 9 +++++++++ gcc/ada/gcc-interface/cuintp.c | 45 +++++++++++++++++------------------------- gcc/ada/gcc-interface/trans.c | 24 ++++++++++++++-------- 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 + * 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 + * 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 '^'. */ -- 2.7.4