* sh.h (REG_CLASS_FROM_LETTER): Change to:
[official-gcc.git] / gcc / ada / sem_ch2.adb
blobcfe2e784cf02dd03ae79450db4811e1ec6722f23
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ C H 2 --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 with Atree; use Atree;
28 with Errout; use Errout;
29 with Opt; use Opt;
30 with Restrict; use Restrict;
31 with Sem_Ch8; use Sem_Ch8;
32 with Sinfo; use Sinfo;
33 with Stand; use Stand;
35 package body Sem_Ch2 is
37 -------------------------------
38 -- Analyze_Character_Literal --
39 -------------------------------
41 procedure Analyze_Character_Literal (N : Node_Id) is
42 begin
44 -- The type is eventually inherited from the context. If expansion
45 -- has already established the proper type, do not modify it.
47 if No (Etype (N)) then
48 Set_Etype (N, Any_Character);
49 end if;
51 Set_Is_Static_Expression (N);
53 if Comes_From_Source (N)
54 and then not In_Character_Range (Char_Literal_Value (N))
55 then
56 Check_Restriction (No_Wide_Characters, N);
57 end if;
58 end Analyze_Character_Literal;
60 ------------------------
61 -- Analyze_Identifier --
62 ------------------------
64 procedure Analyze_Identifier (N : Node_Id) is
65 begin
66 -- Ignore call if prior errors, and identifier has no name, since
67 -- this is the result of some kind of previous error generating a
68 -- junk identifier.
70 if Chars (N) in Error_Name_Or_No_Name
71 and then Total_Errors_Detected /= 0
72 then
73 return;
74 else
75 Find_Direct_Name (N);
76 end if;
77 end Analyze_Identifier;
79 -----------------------------
80 -- Analyze_Integer_Literal --
81 -----------------------------
83 procedure Analyze_Integer_Literal (N : Node_Id) is
84 begin
85 Set_Etype (N, Universal_Integer);
86 Set_Is_Static_Expression (N);
87 end Analyze_Integer_Literal;
89 --------------------------
90 -- Analyze_Real_Literal --
91 --------------------------
93 procedure Analyze_Real_Literal (N : Node_Id) is
94 begin
95 Set_Etype (N, Universal_Real);
96 Set_Is_Static_Expression (N);
97 end Analyze_Real_Literal;
99 ----------------------------
100 -- Analyze_String_Literal --
101 ----------------------------
103 procedure Analyze_String_Literal (N : Node_Id) is
104 begin
106 -- The type is eventually inherited from the context. If expansion
107 -- has already established the proper type, do not modify it.
109 if No (Etype (N)) then
110 Set_Etype (N, Any_String);
111 end if;
113 -- String literals are static in Ada 95. Note that if the subtype
114 -- turns out to be non-static, then the Is_Static_Expression flag
115 -- will be reset in Eval_String_Literal.
117 if Ada_95 then
118 Set_Is_Static_Expression (N);
119 end if;
121 if Comes_From_Source (N) and then Has_Wide_Character (N) then
122 Check_Restriction (No_Wide_Characters, N);
123 end if;
124 end Analyze_String_Literal;
126 end Sem_Ch2;