470cd9e998
2007-12-06 Robert Dewar <dewar@adacore.com> Ed Schonberg <schonberg@adacore.com> * a-ngcoty.adb: New pragma Fast_Math * opt.adb: New pragma Fast_Math * par-prag.adb: Add Implemented_By_Entry to the list of pragmas which do not require any special processing. (Favor_Top_Level): New pragma. New pragma Fast_Math * exp_attr.adb: Move Wide_[Wide_]Image routines to Exp_Imgv (Expand_N_Attribute_Reference, Displace_Allocator_Pointer, Expand_Allocator_Expression): Take into account VM_Target (Expand_Attribute, case 'Identity): Handle properly the case where the prefix is a task interface. New pragma Fast_Math * par.adb (Next_Token_Is): New function (P_Pragma): Add Skipping parameter (U_Left_Paren): New procedure (U_Right_Paren): New procedure New pragma Fast_Math * par-ch10.adb (P_Subunit): Unconditional msg for missing ) after subunit New pragma Fast_Math * sem_prag.adb: Add significance value to table Sig_Flag for pragma Implemented_By_Entry. (Analyze_Pragma): Add case for Ada 2005 pragma Implemented_By_Entry. (Set_Inline_Flags): Do not try to link pragma Inline onto chain of rep items, since it can apply to more than one overloadable entity. Set new flag Has_Pragma_Inline_Always for Inline_Always case. (Analyze_Pragma, case Complex_Representation): Improve error message. (Analyze_Pragma, case Assert): When assertions are disabled build the rewritten code with Sloc of expression rather than pragma, so new warning about failing is not deleted. (Analyze_Pragma): Allow pragma Preelaborable_Initialization to apply to protected types and update error message to reflect that. Test whether the protected type is allowed for the pragma (an error is issued if the type has any entries, or components that do not have preelaborable initialization). New pragma Fast_Math (Analyze_Pragma, case No_Return): Handle generic instance * snames.h, snames.ads, snames.adb: Add new predefined name for interface primitive _Disp_Requeue. New pragma Fast_Math * a-tags.ads, a-tags.adb: New calling sequence for String_To_Wide_[Wide_]String (Secondary_Tag): New subprogram. * exp_imgv.ads, exp_imgv.adb: Move Wide_[Wide_]Image routines here from Exp_Attr New calling sequence for String_To_Wide_[Wide_]String (Expand_Image_Attribute): Major rewrite. New calling sequence avoids the use of the secondary stack for image routines. * a-except-2005.adb, s-wchstw.ads, s-wchstw.adb, s-wwdenu.adb: New calling sequence for String_To_Wide_[Wide_]String * par-ch3.adb (P_Declarative_Items): Recognize use of Overriding in Ada 95 mode (P_Unknown_Discriminant_Part_Opt): Handle missing parens gracefully Remove Atree.Delete_Tree/Delete_Node and Nlist.Delete_List * par-ch6.adb (P_Subprogram): Recognize use of Overriding in Ada 95 mode (P_Formal_Part): Use Skipping parameter in P_Pragma call to improve error recovery * par-util.adb (Next_Token_Is): New function (Signal_Bad_Attribute): Use new Namet.Is_Bad_Spelling_Of function * par-ch2.adb (Skip_Pragma_Semicolon): Do not resynchronize to semicolon if missing (P_Pragma): Implement new Skipping parameter Remove Atree.Delete_Tree/Delete_Node and Nlist.Delete_List Fix location of flag for unrecognized pragma message * par-tchk.adb (U_Left_Paren): New procedure (U_Right_Paren): New procedure From-SVN: r130818
97 lines
4.8 KiB
Ada
97 lines
4.8 KiB
Ada
------------------------------------------------------------------------------
|
|
-- --
|
|
-- GNAT COMPILER COMPONENTS --
|
|
-- --
|
|
-- E X P _ I M G V --
|
|
-- --
|
|
-- S p e c --
|
|
-- --
|
|
-- Copyright (C) 2000-2007, 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- --
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
|
-- for more details. You should have received a copy of the GNU General --
|
|
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
|
-- --
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
-- --
|
|
------------------------------------------------------------------------------
|
|
|
|
-- Expand routines for Image, Value and Width attributes. These are the
|
|
-- attributes that make use of enumeration type image tables.
|
|
|
|
with Types; use Types;
|
|
|
|
package Exp_Imgv is
|
|
|
|
procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id);
|
|
-- Build the enumeration image tables for E, which is an enumeration
|
|
-- base type. The node N is the point in the tree where the resulting
|
|
-- declarations are to be inserted.
|
|
--
|
|
-- The form of the tables generated is as follows:
|
|
--
|
|
-- xxxS : string := "chars";
|
|
-- xxxI : array (0 .. N) of Natural_8/16/32 := (1, n, .., n);
|
|
--
|
|
-- Here xxxS is a string obtained by concatenating all the names
|
|
-- of the enumeration literals in sequence, representing any wide
|
|
-- characters according to the current wide character encoding
|
|
-- method, and with all letters forced to upper case.
|
|
--
|
|
-- The array xxxI is an array of ones origin indexes to the start
|
|
-- of each name, with one extra entry at the end, which is the index
|
|
-- to the character just past the end of the last literal, i.e. it is
|
|
-- the length of xxxS + 1. The element type is the shortest of the
|
|
-- possible types that will hold all the values.
|
|
--
|
|
-- For example, for the type
|
|
--
|
|
-- type x is (hello,'!',goodbye);
|
|
--
|
|
-- the generated tables would consist of
|
|
--
|
|
-- xxxS : String := "hello'!'goodbye";
|
|
-- xxxI : array (0 .. 3) of Natural_8 := (1, 6, 9, 16);
|
|
--
|
|
-- Here Natural_8 is used since 16 < 2**(8-1)
|
|
--
|
|
-- If the entity E needs the tables constructing, the necessary
|
|
-- declarations are constructed, and the fields Lit_Strings and
|
|
-- Lit_Indexes of E are set to point to the corresponding entities.
|
|
-- If no tables are needed (E is not a user defined enumeration
|
|
-- root type, or pragma Discard_Names is in effect, then the
|
|
-- declarations are not constructed, and the fields remain Empty.
|
|
|
|
procedure Expand_Image_Attribute (N : Node_Id);
|
|
-- This procedure is called from Exp_Attr to expand an occurrence
|
|
-- of the attribute Image.
|
|
|
|
procedure Expand_Wide_Image_Attribute (N : Node_Id);
|
|
-- This procedure is called from Exp_Attr to expand an occurrence
|
|
-- of the attribute Wide_Image.
|
|
|
|
procedure Expand_Wide_Wide_Image_Attribute (N : Node_Id);
|
|
-- This procedure is called from Exp_Attr to expand an occurrence
|
|
-- of the attribute Wide_Wide_Image.
|
|
|
|
procedure Expand_Value_Attribute (N : Node_Id);
|
|
-- This procedure is called from Exp_Attr to expand an occurrence
|
|
-- of the attribute Value.
|
|
|
|
type Atype is (Normal, Wide, Wide_Wide);
|
|
-- Type of attribute in call to Expand_Width_Attribute
|
|
|
|
procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal);
|
|
-- This procedure is called from Exp_Attr to expand an occurrence of the
|
|
-- attributes Width (Attr = Normal), or Wide_Width (Attr Wide), or
|
|
-- Wide_Wide_Width (Attr = Wide_Wide).
|
|
|
|
end Exp_Imgv;
|