From 825da0d20f71cd82fa58e16e92099879e9a8b8f2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 20 Jan 2016 09:01:34 +0000 Subject: exp_ch2.adb (Expand_Current_Value): Make an appropriate character literal if the entity is of a character type. * exp_ch2.adb (Expand_Current_Value): Make an appropriate character literal if the entity is of a character type. * gcc-interface/lang.opt (fsigned-char): New option. * gcc-interface/misc.c (gnat_handle_option): Accept it. (gnat_init): Adjust comment. * gcc-interface/gigi.h (finish_character_type): New prototype. (maybe_character_type): New inline function. (maybe_character_value): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity) : For a character of CHAR_TYPE_SIZE, make a signed type if flag_signed_char. Set TYPE_ARTIFICIAL early and call finish_character_type on the type. : For a subtype of character with RM_Size and Esize equal to CHAR_TYPE_SIZE, make a signed type if flag_signed_char. Copy TYPE_STRING_FLAG from type to subtype. : Deal with character index types. : Likewise. * gcc-interface/trans.c (gigi): Replace unsigned_char_type_node with char_type_node throughout. (build_raise_check): Likewise. (get_type_length): Deal with character types. (Attribute_to_gnu) : Likewise. Remove obsolete range check code. Minor tweak. : Likewise. (Loop_Statement_to_gnu): Likewise. (Raise_Error_to_gnu): Likewise. : Deal with character index types. Remove obsolete code. : Likewise. : Deal with character types. Minor tweak. : Likewise. : Likewise. : Likewise. (emit_index_check): Delete. * gcc-interface/utils.c (finish_character_type): New function. (gnat_signed_or_unsigned_type_for): Deal with built-in character types. * gcc-interface/utils2.c (expand_sloc): Replace unsigned_char_type_node with char_type_node. (build_call_raise): Likewise. (build_call_raise_column): Likewise. (build_call_raise_range): Likewise. From-SVN: r232604 --- gcc/ada/exp_ch2.adb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/ada/exp_ch2.adb') diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb index b926e10..88dc824 100644 --- a/gcc/ada/exp_ch2.adb +++ b/gcc/ada/exp_ch2.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- 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- -- @@ -193,7 +193,16 @@ package body Exp_Ch2 is Unchecked_Convert_To (T, New_Occurrence_Of (Entity (Val), Loc))); - -- If constant is of an integer type, just make an appropriately + -- If constant is of a character type, just make an appropriate + -- character literal, which will get the proper type. + + elsif Is_Character_Type (T) then + Rewrite (N, + Make_Character_Literal (Loc, + Chars => Chars (Val), + Char_Literal_Value => Expr_Rep_Value (Val))); + + -- If constant is of an integer type, just make an appropriate -- integer literal, which will get the proper type. elsif Is_Integer_Type (T) then -- cgit v1.1