diff options
author | Ed Schonberg <schonberg@adacore.com> | 2005-06-16 10:35:26 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2005-06-16 10:35:26 +0200 |
commit | edd63e9baccac484fcbeed6b082941a159c30244 (patch) | |
tree | 91e1755b20c022b6125eab58f540040f0dac13ed /gcc/ada/s-valwch.adb | |
parent | d4881d364f4a56a41ec47624f6c1076424c00179 (diff) | |
download | gcc-edd63e9baccac484fcbeed6b082941a159c30244.zip gcc-edd63e9baccac484fcbeed6b082941a159c30244.tar.gz gcc-edd63e9baccac484fcbeed6b082941a159c30244.tar.bz2 |
einfo.ads, einfo.adb (Is_Local_Anonymous_Access): New flag on anonymous access types...
2005-06-14 Ed Schonberg <schonberg@adacore.com>
Javier Miranda <miranda@adacore.com>
Thomas Quinot <quinot@adacore.com>
Robert Dewar <dewar@adacore.com>
Hristian Kirtchev <kirtchev@adacore.com>
Gary Dismukes <dismukes@adacore.com>
* einfo.ads, einfo.adb (Is_Local_Anonymous_Access): New flag on
anonymous access types, to indicate that the accessibility level of
the type is determined by that of the enclosing declaration.
(Has_Persistent_BSS): New flag
(Set_Is_Primitive_Wrapper): Upgrade the barrier to allow the usage
of this attribute with functions.
(Is_Primitive_Wrapper): Remove the barrier.
(Has_Specified_Stream_Input, Has_Specified_Stream_Output,
Has_Specified_Stream_Read, Has_Specified_Stream_Write):
New subprograms.
(Set_Has_Specified_Stream_Input, Set_Has_Specified_Stream_Output,
Set_Has_Specified_Stream_Read, Set_Has_Specified_Stream_Write):
New subprograms.
(Is_Pure_Unit_Access_Type): New flag
(Abstract_Interfaces): Complete the assertion to cover all usages.
(Set_Is_Interface): Complete the assertion to cover all usages.
(Is_Primitive_Wrapper): New attribute.
(Is_Obsolescent): Now applies to all entities (though it is only set
for subprograms currently)
New flag: Has_Constrained_Partial_View, to implemente Ada 2005 AI-363,
which solves various problems concerning access subtypes.
(Has_Persistent_BSS): New flag
(Is_Primitive_Wrapper, Set_Primitive_Wrapper): Code cleanup.
Remove these subprograms because this attribute is currently
not used.
New entity flags:
Has_Specified_Stream_Input (Flag190)
Has_Specified_Stream_Output (Flag191)
Has_Specified_Stream_Read (Flag192)
Has_Specified_Stream_Write (Flag193)
Present in all type and subtype entities. Set for a given view if the
corresponding stream-oriented attribute has been defined by an
attribute definition clause. When such a clause occurs, a TSS is set
on the underlying full view; the flags are used to track visibility of
the attribute definition clause for partial or incomplete views.
(Is_Pure_Unit_Access_Type): New flag
Clarify use of Is_Internal.
(Is_Primitive_Wrapper): New attribute present in primitive subprograms
internally generated to wrap the invocation of tasks and protected
types that implement interfaces.
(Implementation_Base_Type): Documentation correction
(Is_Obsolescent): Now applies to all entities (though it is only set
for subprograms currently)
New flag: Has_Constrained_Partial_View, to implement Ada 2005 AI-363,
which solves various problems concerning access subtypes.
* exp_ch9.adb (Type_Conformant_Parameters): Introduce mode conformance
for examined parameters. Identify unequal parameter list lengths as
non-conformant parameters.
(Overriding_Possible): Do not check for "All" qualifier in declaration
of controlling access parameter, following prescription of AI-404.
(Build_Entry_Wrapper_Spec, Build_Entry_Wrapper_Body): New subprograms
that build the procedure body that wraps an entry invocation
(Build_Corresponding_Record, Build_Protected_Sub_Specification,
Expand_N_Protected_Body, Expand_N_Protected_Type_Declaration,
Expand_N_Task_Body, Expand_N_Task_Type_Declaration): Modified to
give support to abstract interface types
* freeze.adb (Freeze_Entity): Issue error message if
Is_Pure_Unit_Access_Type set, unless we are in Ada 2005 mode and the
type has no storage pool (Ada 2005) AI-366.
Also modified to give support to abstract interface types
(Freeze_Subprogram): Issue an error for a dispatching subprogram with an
Inline_Always pragma.
* par-ch9.adb (P_Task_Items): Reserved words "not" or "overriding" may
now begin an entry declaration.
(P_Entry_Or_Subprogram_With_Indicator): New procedure in
P_Protected_Operation_Declaration_Opt. Parse an entry declaration or
a subprogram declaration preceded by an overriding indicator.
(P_Protected_Operation_Declaration_Opt): Add case for parsing entry
declarations or subprogram declarations preceded by reserved words
"not" or "overriding".
(P_Entry_Declaration): Update comment. Parse and check overriding
indicator, set semantic flags of entry declarations.
(P_Task): New error message in case of private applied
to a task type declaration.
(P_Protected): New error message in case of private applied
to a task type declaration.
* sem_ch7.adb (Preserve_Full_Attributes): Modified to handle the case
in which the full view of a type implementing an interface is a
concurrent type.
(Has_Overriding_Pragma): Remove obsolete implementation of AI-218.
Declare_Inherited_Private_Subprograms): If an explicit operation
overrides an operation that is inherited in the private part, mark the
explicit one as overriding, to enable overriding indicator checks.
(Preserve_Full_Attributes): Propagate Is_Unchecked_Union attribute from
full view to partial view, to simplify handling in back-end.
* sprint.adb: Print interface lists where needed: derived types,
protected types, task types.
output "is null" for null procedures. Part of implementation of
* sem_cat.adb (Validate_Access_Type_Declaration): Implement AI-366
relaxation of rules for access types in pure, shared passive partitions.
* exp_strm.adb (Build_Mutable_Record_Read_Procedure): Reorganize to
first read discriminants into temporary objects, performing checks on
the read values, then possibly performing discriminant checks on the
actual (if it is constrained), and only finally reading the components
into a constrained temporary object.
(Build_Elementary_Input_Call): Adjust the specific circuitry for the
case of reading discriminants of a mutable record type to recognize
the new form of the code generated by
Build_Mutable_Record_Read_Procedure.
* exp_tss.ads, exp_tss.adb (Make_Init_Proc_Name): Reimplement in terms
of a simple call to Make_TSS_Name.
(Make_TSS_Name_Local): Add the TSS name as the last thing in the name
buffer, in order for Is_TSS to work correctly on local TSS names.
* sem_attr.ads, sem_attr.adb (Resolve_Attribute, case 'Access): Use flag
Is_Local_Anonymous_Access to check legaliy of attributes in the
context of access components and stand-alone access objects.
(Stream_Attribute_Available): In Ada 95 mode, a stream attribute is
treated as available for a limited private type if there is an
attribute_definition_clause that applies to its full view, but not in
other cases where the attribute is available for the full view
(specifically, the sole fact that the full view is non-limited does not
make the attribute available for the partial view).
(Build_Access_Subprogram_Type): Diagnose attempt to apply 'access to a
non-overloaded intrinsic subprogram.
(Check_Stream_Attribute): Reject an attribute reference for an
unavailable stream attribute even if the prefix is not a limited type
(case of a 'Input attribute reference for an abstract, non-classwide
type)
(Stream_Attribute_Available): New function to determine whether a stream
attribute is available at a place.
(Check_Attribute): Use Stream_Attribute_Available instead of just
testing for TSS presence on the implementation base type.
(Analyze_Attribute): Modified to give support to task interfaces.
(Analyze_Access_Attribute): Add error check for use of an Access (or
Unrestricted_Access) attribute with a subprogram marked as
Inline_Always.
(Analyze_Attribute, case Attribute_Address): Add error check for use of
an Address attribute with a subprogram marked as Inline_Always.
Update Eval_Attribute to handle new value of Width from AI-395
* sem_ch13.adb (Analyze_Stream_TSS_Definition): New subprogram.
(Analyze_Attribute_Definition_Clause, cases Input, Output, Read, Write):
Factor common code across the stream-oriented attribute circcuits into
a new subprogram, Analyze_Stream_TSS_Definition. The new uniform
processing is functionally identical to the previous duplicated one,
except that an expression that denotes an abstract subprogram will now
be rejected, as mandated by AI-195 item 5.
* sem_util.ads, sem_util.adb (Type_Access_Level): Use flag
Is_Local_Anonymous_Access to apply accessibility checks to access
components and stand-alone access objects.
(Has_Discriminant_Dependent_Constraint): Moved to spec for use
elsewhere.
(Is_Potentially_Persistent_Type): New function
(Is_Dependent_Component_Of_Mutable_Object): If the enclosing object is
a heap-object whose type has a constrained partial view, the object is
unconstrained and the component may depend on a discriminant, making its
renaming illegal.
* sinfo.ads, sinfo.adb
(Must_Not_Override): Flag applicable to N_Entry_Declaration.
(Must_Override): Flag applicable to N_Entry_Declaration.
Indicate that interface_list can appear in single task and single
protected declarations.
Replace Is_Overriding and Not_Overriding with Must_Override and
Must_Not_Override, to better express intent of AI.
Is_Overriding, Not_Overriding: Ada2005 flags that indicate the presence
of an overriding indicator in a subprogram or instance.
Ada 2005 (AI-248) Null_Present can appear in a procedure specification.
Add the overriding indicator [[not] overriding] construct to the
following grammar productions:
ENTRY_DECLARATION
GENERIC_INSTANTIATION
SUBPROGRAM_SPECIFICATION
* par-ch10.adb (P_Compilation_Unit): Subprogram declaration or body
can start with an overriding indicator.
* par-ch6.adb (P_Subprogram): Recognize overriding indicator, and set
flags accordingly on subrogram specifications or instances.
* sem_ch8.adb:
(Analyze_Subprogram_Renaming): For a renaming_as_body, verify that the
overriding_indicator, if present, is consistent with status of spec.
Improve error message for null-excluding checks on controlling access
parameters.
(Check_In_Previous_With_Clause): Protect the frontend against
previously reported critical errors in the context clauses.
Save and restore Ada_Version_Explicit, for implementation of AI-362
(Analyze_Subprogram_Renaming): If the new entity is a dispatching
operation verify that controlling formals of the renamed entity that
are access parameters are explicitly non-null.
(Find_Expanded_Name): Improve error message when prefix is an illegal
reference to a private child unit.
* exp_imgv.adb, s-imgwch.ads, s-imgwch.adb, s-valwch.adb,
s-valwch.ads, s-widwch.adb, s-widwch.ads, s-wwdcha.adb, s-wwdwch.adb:
Rewrite to correspond to new wide character names in AI-395
* par-ch12.adb (P_Formal_Subprogram_Declaration): Recognize null
default procedures.
From-SVN: r101029
Diffstat (limited to 'gcc/ada/s-valwch.adb')
-rw-r--r-- | gcc/ada/s-valwch.adb | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/gcc/ada/s-valwch.adb b/gcc/ada/s-valwch.adb index 8d46045..6f2938f 100644 --- a/gcc/ada/s-valwch.adb +++ b/gcc/ada/s-valwch.adb @@ -33,8 +33,6 @@ with Interfaces; use Interfaces; with System.Val_Util; use System.Val_Util; -with System.WCh_Con; use System.WCh_Con; -with System.WCh_StW; use System.WCh_StW; package body System.Val_WChar is @@ -43,15 +41,14 @@ package body System.Val_WChar is -------------------------- function Value_Wide_Character - (Str : String; - EM : WC_Encoding_Method) return Wide_Character + (Str : String) return Wide_Character is - WWC : constant Wide_Wide_Character := - Value_Wide_Wide_Character (Str, EM); - WWV : constant Unsigned_32 := Wide_Wide_Character'Pos (WWC); + WWC : constant Wide_Wide_Character := Value_Wide_Wide_Character (Str); + WWV : constant Unsigned_32 := Wide_Wide_Character'Pos (WWC); begin if WWV > 16#FFFF# then - raise Constraint_Error; + raise Constraint_Error + with "out of range character for Value attribute"; else return Wide_Character'Val (WWV); end if; @@ -62,8 +59,7 @@ package body System.Val_WChar is ------------------------------- function Value_Wide_Wide_Character - (Str : String; - EM : System.WCh_Con.WC_Encoding_Method) return Wide_Wide_Character + (Str : String) return Wide_Wide_Character is F : Natural; L : Natural; @@ -81,48 +77,47 @@ package body System.Val_WChar is if L - F = 2 then return Wide_Wide_Character'Val (Character'Pos (S (F + 1))); - -- Otherwise must be a wide character in quotes. The easiest - -- thing is to convert the string to a wide wide string and then - -- pick up the single character that it should contain. + -- Otherwise something is very wrong else - declare - WS : constant Wide_Wide_String := - String_To_Wide_Wide_String (S (F + 1 .. L - 1), EM); - - begin - if WS'Length /= 1 then - raise Constraint_Error; - else - return WS (WS'First); - end if; - end; + raise Constraint_Error with "invalid string for Value attribute"; end if; - -- the last two values of the type have language-defined names: + -- Deal with Hex_hhhhhhhh cases for wide_[wide_]character cases - elsif S = "FFFE" then - return Wide_Wide_Character'Val (16#FFFE#); + elsif Str'Length = 12 and then Str (1 .. 4) = "Hex_" then + declare + W : Unsigned_32 := 0; - elsif S = "FFFF" then - return Wide_Wide_Character'Val (16#FFFF#); + begin + for J in 5 .. 12 loop + W := W * 16 + Character'Pos (Str (J)); - -- Otherwise must be a control character + if Str (J) in '0' .. '9' then + W := W - Character'Pos ('0'); + elsif Str (J) in 'A' .. 'F' then + W := W - Character'Pos ('A') + 10; + elsif Str (J) in 'a' .. 'f' then + W := W - Character'Pos ('a') + 10; + else + raise Constraint_Error + with "illegal hex character for Value attribute"; + end if; + end loop; - else - for C in Character'Val (16#00#) .. Character'Val (16#1F#) loop - if S (F .. L) = Character'Image (C) then - return Wide_Wide_Character'Val (Character'Pos (C)); + if W > 16#7FFF_FFFF# then + raise Constraint_Error + with "out of range value for Value attribute"; + else + return Wide_Wide_Character'Val (W); end if; - end loop; + end; - for C in Character'Val (16#7F#) .. Character'Val (16#9F#) loop - if S (F .. L) = Character'Image (C) then - return Wide_Wide_Character'Val (Character'Pos (C)); - end if; - end loop; + -- Otherwise must be one of the special names for Character - raise Constraint_Error; + else + return + Wide_Wide_Character'Val (Character'Pos (Character'Value (Str))); end if; end Value_Wide_Wide_Character; |