annotate gcc/ada/sem_ch2.adb @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S E M _ C H 2 --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- B o d y --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 with Atree; use Atree;
kono
parents:
diff changeset
27 with Namet; use Namet;
kono
parents:
diff changeset
28 with Opt; use Opt;
kono
parents:
diff changeset
29 with Restrict; use Restrict;
kono
parents:
diff changeset
30 with Rident; use Rident;
kono
parents:
diff changeset
31 with Sem_Ch8; use Sem_Ch8;
kono
parents:
diff changeset
32 with Sem_Dim; use Sem_Dim;
kono
parents:
diff changeset
33 with Sinfo; use Sinfo;
kono
parents:
diff changeset
34 with Stand; use Stand;
kono
parents:
diff changeset
35 with Uintp; use Uintp;
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 package body Sem_Ch2 is
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 -------------------------------
kono
parents:
diff changeset
40 -- Analyze_Character_Literal --
kono
parents:
diff changeset
41 -------------------------------
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 procedure Analyze_Character_Literal (N : Node_Id) is
kono
parents:
diff changeset
44 begin
kono
parents:
diff changeset
45 -- The type is eventually inherited from the context. If expansion
kono
parents:
diff changeset
46 -- has already established the proper type, do not modify it.
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 if No (Etype (N)) then
kono
parents:
diff changeset
49 Set_Etype (N, Any_Character);
kono
parents:
diff changeset
50 end if;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 Set_Is_Static_Expression (N);
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 if Comes_From_Source (N)
kono
parents:
diff changeset
55 and then not In_Character_Range (UI_To_CC (Char_Literal_Value (N)))
kono
parents:
diff changeset
56 then
kono
parents:
diff changeset
57 Check_Restriction (No_Wide_Characters, N);
kono
parents:
diff changeset
58 end if;
kono
parents:
diff changeset
59 end Analyze_Character_Literal;
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 ------------------------
kono
parents:
diff changeset
62 -- Analyze_Identifier --
kono
parents:
diff changeset
63 ------------------------
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 procedure Analyze_Identifier (N : Node_Id) is
kono
parents:
diff changeset
66 begin
kono
parents:
diff changeset
67 -- Ignore call if prior errors, and identifier has no name, since
kono
parents:
diff changeset
68 -- this is the result of some kind of previous error generating a
kono
parents:
diff changeset
69 -- junk identifier.
kono
parents:
diff changeset
70
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
71 if not Is_Valid_Name (Chars (N)) and then Total_Errors_Detected /= 0 then
111
kono
parents:
diff changeset
72 return;
kono
parents:
diff changeset
73 else
kono
parents:
diff changeset
74 Find_Direct_Name (N);
kono
parents:
diff changeset
75 end if;
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 Analyze_Dimension (N);
kono
parents:
diff changeset
78 end Analyze_Identifier;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 -----------------------------
kono
parents:
diff changeset
81 -- Analyze_Integer_Literal --
kono
parents:
diff changeset
82 -----------------------------
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 procedure Analyze_Integer_Literal (N : Node_Id) is
kono
parents:
diff changeset
85 begin
kono
parents:
diff changeset
86 Set_Etype (N, Universal_Integer);
kono
parents:
diff changeset
87 Set_Is_Static_Expression (N);
kono
parents:
diff changeset
88 end Analyze_Integer_Literal;
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 --------------------------
kono
parents:
diff changeset
91 -- Analyze_Real_Literal --
kono
parents:
diff changeset
92 --------------------------
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 procedure Analyze_Real_Literal (N : Node_Id) is
kono
parents:
diff changeset
95 begin
kono
parents:
diff changeset
96 Set_Etype (N, Universal_Real);
kono
parents:
diff changeset
97 Set_Is_Static_Expression (N);
kono
parents:
diff changeset
98 end Analyze_Real_Literal;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 ----------------------------
kono
parents:
diff changeset
101 -- Analyze_String_Literal --
kono
parents:
diff changeset
102 ----------------------------
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 procedure Analyze_String_Literal (N : Node_Id) is
kono
parents:
diff changeset
105 begin
kono
parents:
diff changeset
106 -- The type is eventually inherited from the context. If expansion
kono
parents:
diff changeset
107 -- has already established the proper type, do not modify it.
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 if No (Etype (N)) then
kono
parents:
diff changeset
110 Set_Etype (N, Any_String);
kono
parents:
diff changeset
111 end if;
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 -- String literals are static in Ada 95. Note that if the subtype
kono
parents:
diff changeset
114 -- turns out to be non-static, then the Is_Static_Expression flag
kono
parents:
diff changeset
115 -- will be reset in Eval_String_Literal.
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 if Ada_Version >= Ada_95 then
kono
parents:
diff changeset
118 Set_Is_Static_Expression (N);
kono
parents:
diff changeset
119 end if;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 if Comes_From_Source (N) and then Has_Wide_Character (N) then
kono
parents:
diff changeset
122 Check_Restriction (No_Wide_Characters, N);
kono
parents:
diff changeset
123 end if;
kono
parents:
diff changeset
124 end Analyze_String_Literal;
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 end Sem_Ch2;