From f62054146e86e792b6ce061bd418b9a2384ae9a5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 8 Feb 2012 11:04:46 +0100 Subject: [multiple changes] 2012-02-08 Yannick Moy * gnat_rm.texi: Minor reshuffling to place restriction at appropriate place. 2012-02-08 Bob Duff * warnsw.adb (Set_Warning_Switch): Set Warn_On_Suspicious_Modulus_Value False for '-gnatwA', to suppress these warnings. 2012-02-08 Vincent Celier * sinput-p.adb (Source_File_Is_Subunit): Check for BOM before starting to scan, so that UTF8 encoding is taken into account. 2012-02-08 Arnaud Charlet * s-tasren.adb, s-tasren.ads (Internal_Complete_Rendezvous): New function. (Complete_Rendezvous): Now call Internal_Complete_Rendezvous. (Exceptional_Complete_Rendezvous): Mark No_Return. 2012-02-08 Eric Botcazou * exp_aggr.adb (Compile_Time_Known_Composite_Value): New predicate to compute whether a composite value can be evaluated at compile time. (Component_Not_OK_For_Backend): Use Compile_Time_Known_Value for all expressions of elementary type and Compile_Time_Known_Composite_Value for all other expressions. (Expand_Record_Aggregate): Convert to assignments in the case of a type with mutable components if the aggregate cannot be built statically. 2012-02-08 Gary Dismukes * aspects.ads (type Aspect_Id): Add Simple_Storage_Pool_Type. (Impl_Defined_Aspects): Add association for Aspect_Simple_Storage_Pool_Type. (Aspect_Names): Add association for Aspect_Simple_Storage_Pool_Type. * aspects.adb: (Canonical_Aspect): Add association for Simple_Storage_Pool_Type. * exp_attr.adb (Expand_N_Attribute_Reference): Change name to Name_Simple_Storage_Pool_Type. * exp_ch4.adb (Expand_N_Allocator): Change name to Name_Simple_Storage_Pool_Type. * exp_intr.adb (Expand_Unc_Deallocation): Change name to Name_Simple_Storage_Pool_Type. * freeze.adb (Freeze_Entity): Change names to Name_Simple_Storage_Pool_Type. * par-prag.adb: Change names to Name_Simple_Storage_Pool_Type. * sem_attr.adb: (Analyze_Attribute): Change name to Name_Simple_Storage_Pool_Type. * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Change name to Name_Simple_Storage_Pool_Type. * sem_prag.adb: (Analyze_Pragma): Change name to Name_Simple_Storage_Pool_Type. (Sig_Flags): Change name to Name_Simple_Storage_Pool_Type. * sem_res.adb (Resolve_Allocator): Change name to Name_Simple_Storage_Pool_Type. * snames.ads-tmpl: (Name_Simple_Storage_Pool_Type): New name constant. (type Pragma_Id): Change name to Name_Simple_Storage_Pool_Type and move to main pragma section because it no longer matches the attribute name. * snames.adb-tmpl (Get_Pragma_Id): Remove test for Name_Simple_Storage_Pool. (Is_Pragma_Name): Remove test for Name_Simple_Storage_Pool. 2012-02-08 Robert Dewar * gnat_ugn.texi: Add some clarification to -gnatwA and -gnatws. From-SVN: r184003 --- gcc/ada/sinput-p.adb | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'gcc/ada/sinput-p.adb') diff --git a/gcc/ada/sinput-p.adb b/gcc/ada/sinput-p.adb index 156f036..f8ea812 100644 --- a/gcc/ada/sinput-p.adb +++ b/gcc/ada/sinput-p.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, 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- -- @@ -26,10 +26,15 @@ with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; +with GNAT.Byte_Order_Mark; use GNAT.Byte_Order_Mark; + +with Opt; use Opt; +with Output; use Output; with Prj.Err; with Sinput.C; with System; +with System.WCh_Con; use System.WCh_Con; package body Sinput.P is @@ -164,6 +169,46 @@ package body Sinput.P is Prj.Err.Scanner.Set_Special_Character ('#'); Prj.Err.Scanner.Set_Special_Character ('$'); + -- Check for BOM + + declare + BOM : BOM_Kind; + Len : Natural; + Tst : String (1 .. 5); + + begin + for J in 1 .. 5 loop + Tst (J) := Source (Scan_Ptr + Source_Ptr (J) - 1); + end loop; + + Read_BOM (Tst, Len, BOM, False); + + case BOM is + when UTF8_All => + Scan_Ptr := Scan_Ptr + Source_Ptr (Len); + Wide_Character_Encoding_Method := WCEM_UTF8; + Upper_Half_Encoding := True; + + when UTF16_LE | UTF16_BE => + Set_Standard_Error; + Write_Line ("UTF-16 encoding format not recognized"); + Set_Standard_Output; + raise Unrecoverable_Error; + + when UTF32_LE | UTF32_BE => + Set_Standard_Error; + Write_Line ("UTF-32 encoding format not recognized"); + Set_Standard_Output; + raise Unrecoverable_Error; + + when Unknown => + null; + + when others => + raise Program_Error; + end case; + end; + -- We scan past junk to the first interesting compilation unit token, to -- see if it is SEPARATE. We ignore WITH keywords during this and also -- PRIVATE. The reason for ignoring PRIVATE is that it handles some -- cgit v1.1