]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/impunit.adb
2015-11-13 Hristian Kirtchev <kirtchev@adacore.com>
[thirdparty/gcc.git] / gcc / ada / impunit.adb
CommitLineData
83cce46b 1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- I M P U N I T --
6-- --
7-- B o d y --
8-- --
b85b7cb2 9-- Copyright (C) 2000-2015, Free Software Foundation, Inc. --
83cce46b 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- --
80df182a 13-- ware Foundation; either version 3, or (at your option) any later ver- --
83cce46b 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 --
80df182a 18-- Public License distributed with GNAT; see file COPYING3. If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license. --
83cce46b 20-- --
21-- GNAT was originally developed by the GNAT team at New York University. --
e78e8c8e 22-- Extensive contributions were provided by Ada Core Technologies Inc. --
83cce46b 23-- --
24------------------------------------------------------------------------------
25
0d12640b 26with Atree; use Atree;
7bc11884 27with Errout; use Errout;
0d12640b 28with Sinfo; use Sinfo;
29with Fname.UF; use Fname.UF;
30with Lib; use Lib;
31with Namet; use Namet;
288afea9 32with Opt; use Opt;
0d12640b 33with Uname; use Uname;
83cce46b 34
e2b6cdc8 35-- Note: this package body is used by GPS and GNATBench to supply a list of
36-- entries for help on available library routines.
37
83cce46b 38package body Impunit is
39
40 subtype File_Name_8 is String (1 .. 8);
288afea9 41
42 type File_Name_Record is record
43 Fname : File_Name_8;
44 -- 8 character name of unit
45
46 RMdef : Boolean;
47 -- True if unit is RM defined. False for any unit that is implementation
48 -- defined (and thus not with'able in No_Implementation_Units mode).
49 end record;
50
51 type File_List is array (Nat range <>) of File_Name_Record;
52
53 T : constant Boolean := True;
54 F : constant Boolean := False;
55 -- Short hand for RM_Defined values in lists below
83cce46b 56
7189d17f 57 ------------------
58 -- Ada 95 Units --
59 ------------------
83cce46b 60
549bcd91 61 -- The following is a giant string list containing the names of all non-
62 -- implementation internal files, i.e. the complete list of files for
7189d17f 63 -- internal units which a program may legitimately WITH when operating in
3ab42ff7 64 -- either Ada 95 or Ada 2005 mode.
83cce46b 65
7189d17f 66 -- Note that this list should match the list of units documented in the
549bcd91 67 -- "GNAT Library" section of the GNAT Reference Manual. A unit listed here
68 -- must either be documented in that section or described in the Ada RM.
83cce46b 69
7189d17f 70 Non_Imp_File_Names_95 : constant File_List := (
71
72 ------------------------------------------------------
6fcda3b9 73 -- Ada Hierarchy Units from Ada-95 Reference Manual --
7189d17f 74 ------------------------------------------------------
83cce46b 75
288afea9 76 ("a-astaco", T), -- Ada.Asynchronous_Task_Control
77 ("a-calend", T), -- Ada.Calendar
78 ("a-chahan", T), -- Ada.Characters.Handling
79 ("a-charac", T), -- Ada.Characters
80 ("a-chlat1", T), -- Ada.Characters.Latin_1
81 ("a-comlin", T), -- Ada.Command_Line
82 ("a-decima", T), -- Ada.Decimal
83 ("a-direio", T), -- Ada.Direct_IO
84 ("a-dynpri", T), -- Ada.Dynamic_Priorities
85 ("a-except", T), -- Ada.Exceptions
86 ("a-finali", T), -- Ada.Finalization
87 ("a-flteio", T), -- Ada.Float_Text_IO
88 ("a-fwteio", T), -- Ada.Float_Wide_Text_IO
89 ("a-inteio", T), -- Ada.Integer_Text_IO
90 ("a-interr", T), -- Ada.Interrupts
91 ("a-intnam", T), -- Ada.Interrupts.Names
92 ("a-ioexce", T), -- Ada.IO_Exceptions
93 ("a-iwteio", T), -- Ada.Integer_Wide_Text_IO
94 ("a-ncelfu", T), -- Ada.Numerics.Complex_Elementary_Functions
95 ("a-ngcefu", T), -- Ada.Numerics.Generic_Complex_Elementary_Functions
96 ("a-ngcoty", T), -- Ada.Numerics.Generic_Complex_Types
97 ("a-ngelfu", T), -- Ada.Numerics.Generic_Elementary_Functions
98 ("a-nucoty", T), -- Ada.Numerics.Complex_Types
99 ("a-nudira", T), -- Ada.Numerics.Discrete_Random
100 ("a-nuelfu", T), -- Ada.Numerics.Elementary_Functions
101 ("a-nuflra", T), -- Ada.Numerics.Float_Random
102 ("a-numeri", T), -- Ada.Numerics
103 ("a-reatim", T), -- Ada.Real_Time
104 ("a-sequio", T), -- Ada.Sequential_IO
105 ("a-stmaco", T), -- Ada.Strings.Maps.Constants
106 ("a-storio", T), -- Ada.Storage_IO
107 ("a-strbou", T), -- Ada.Strings.Bounded
108 ("a-stream", T), -- Ada.Streams
109 ("a-strfix", T), -- Ada.Strings.Fixed
110 ("a-string", T), -- Ada.Strings
111 ("a-strmap", T), -- Ada.Strings.Maps
112 ("a-strunb", T), -- Ada.Strings.Unbounded
113 ("a-ststio", T), -- Ada.Streams.Stream_IO
114 ("a-stwibo", T), -- Ada.Strings.Wide_Bounded
115 ("a-stwifi", T), -- Ada.Strings.Wide_Fixed
116 ("a-stwima", T), -- Ada.Strings.Wide_Maps
117 ("a-stwiun", T), -- Ada.Strings.Wide_Unbounded
118 ("a-swmwco", T), -- Ada.Strings.Wide_Maps.Wide_Constants
119 ("a-sytaco", T), -- Ada.Synchronous_Task_Control
120 ("a-tags ", T), -- Ada.Tags
121 ("a-tasatt", T), -- Ada.Task_Attributes
122 ("a-taside", T), -- Ada.Task_Identification
123 ("a-teioed", T), -- Ada.Text_IO.Editing
124 ("a-textio", T), -- Ada.Text_IO
125 ("a-ticoio", T), -- Ada.Text_IO.Complex_IO
126 ("a-titest", T), -- Ada.Text_IO.Text_Streams
127 ("a-unccon", T), -- Ada.Unchecked_Conversion
128 ("a-uncdea", T), -- Ada.Unchecked_Deallocation
129 ("a-witeio", T), -- Ada.Wide_Text_IO
130 ("a-wtcoio", T), -- Ada.Wide_Text_IO.Complex_IO
131 ("a-wtedit", T), -- Ada.Wide_Text_IO.Editing
132 ("a-wttest", T), -- Ada.Wide_Text_IO.Text_Streams
83cce46b 133
134 -------------------------------------------------
135 -- RM Required Additions to Ada for GNAT Types --
136 -------------------------------------------------
137
288afea9 138 -- Note: Long versions are considered RM defined, but not the Long Long,
139 -- Short, or Short_Short versions.
140
141 ("a-lfteio", T), -- Ada.Long_Float_Text_IO
142 ("a-lfwtio", T), -- Ada.Long_Float_Wide_Text_IO
143 ("a-liteio", T), -- Ada.Long_Integer_Text_IO
144 ("a-liwtio", T), -- Ada.Long_Integer_Wide_Text_IO
145 ("a-llftio", T), -- Ada.Long_Long_Float_Text_IO
146 ("a-llfwti", T), -- Ada.Long_Long_Float_Wide_Text_IO
147 ("a-llitio", T), -- Ada.Long_Long_Integer_Text_IO
148 ("a-lliwti", F), -- Ada.Long_Long_Integer_Wide_Text_IO
149 ("a-nlcefu", F), -- Ada.Long_Complex_Elementary_Functions
150 ("a-nlcoty", T), -- Ada.Numerics.Long_Complex_Types
151 ("a-nlelfu", T), -- Ada.Numerics.Long_Elementary_Functions
152 ("a-nllcef", F), -- Ada.Long_Long_Complex_Elementary_Functions
153 ("a-nllefu", F), -- Ada.Numerics.Long_Long_Elementary_Functions
154 ("a-nllcty", F), -- Ada.Numerics.Long_Long_Complex_Types
155 ("a-nscefu", F), -- Ada.Short_Complex_Elementary_Functions
156 ("a-nscoty", F), -- Ada.Numerics.Short_Complex_Types
157 ("a-nselfu", F), -- Ada.Numerics.Short_Elementary_Functions
158 ("a-sfteio", F), -- Ada.Short_Float_Text_IO
159 ("a-sfwtio", F), -- Ada.Short_Float_Wide_Text_IO
160 ("a-siteio", F), -- Ada.Short_Integer_Text_IO
161 ("a-siwtio", F), -- Ada.Short_Integer_Wide_Text_IO
162 ("a-ssitio", F), -- Ada.Short_Short_Integer_Text_IO
163 ("a-ssiwti", F), -- Ada.Short_Short_Integer_Wide_Text_IO
83cce46b 164
165 -----------------------------------
166 -- GNAT Defined Additions to Ada --
167 -----------------------------------
168
288afea9 169 ("a-calcon", F), -- Ada.Calendar.Conversions
170 ("a-chlat9", F), -- Ada.Characters.Latin_9
171 ("a-clrefi", F), -- Ada.Command_Line.Response_File
172 ("a-colien", F), -- Ada.Command_Line.Environment
173 ("a-colire", F), -- Ada.Command_Line.Remove
174 ("a-cwila1", F), -- Ada.Characters.Wide_Latin_1
175 ("a-cwila9", F), -- Ada.Characters.Wide_Latin_9
176 ("a-diocst", F), -- Ada.Direct_IO.C_Streams
177 ("a-einuoc", F), -- Ada.Exceptions.Is_Null_Occurrence
178 ("a-elchha", F), -- Ada.Exceptions.Last_Chance_Handler
179 ("a-exctra", F), -- Ada.Exceptions.Traceback
180 ("a-siocst", F), -- Ada.Sequential_IO.C_Streams
181 ("a-ssicst", F), -- Ada.Streams.Stream_IO.C_Streams
182 ("a-suteio", F), -- Ada.Strings.Unbounded.Text_IO
183 ("a-swuwti", F), -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
184 ("a-tiocst", F), -- Ada.Text_IO.C_Streams
185 ("a-wtcstr", F), -- Ada.Wide_Text_IO.C_Streams
83cce46b 186
26402741 187 -- Note: strictly the next two should be Ada 2005 units, but it seems
188 -- harmless (and useful) to make then available in Ada 95 mode, since
189 -- they only deal with Wide_Character, not Wide_Wide_Character.
190
288afea9 191 ("a-wichun", F), -- Ada.Wide_Characters.Unicode
192 ("a-widcha", F), -- Ada.Wide_Characters
26402741 193
325f3586 194 -- Note: strictly the following should be Ada 2012 units, but it seems
d73d4db0 195 -- harmless (and useful) to make then available in Ada 95 mode, since
325f3586 196 -- they do not deal with Wide_Wide_Character.
d73d4db0 197
288afea9 198 ("a-wichha", F), -- Ada.Wide_Characters.Handling
199 ("a-stuten", F), -- Ada.Strings.UTF_Encoding
200 ("a-suenco", F), -- Ada.Strings.UTF_Encoding.Conversions
201 ("a-suenst", F), -- Ada.Strings.UTF_Encoding.Strings
202 ("a-suewst", F), -- Ada.Strings.UTF_Encoding.Wide_Strings
d73d4db0 203
83cce46b 204 ---------------------------
205 -- GNAT Special IO Units --
206 ---------------------------
207
549bcd91 208 -- As further explained elsewhere (see Sem_Ch10), the internal packages of
209 -- Text_IO and Wide_Text_IO are actually implemented as separate children,
210 -- but this fact is intended to be hidden from the user completely. Any
211 -- attempt to WITH one of these units will be diagnosed as an error later
212 -- on, but for now we do not consider these internal implementation units
213 -- (if we did, then we would get a junk warning which would be confusing
27f48659 214 -- and unnecessary, given that we generate a clear error message).
83cce46b 215
288afea9 216 ("a-tideio", F), -- Ada.Text_IO.Decimal_IO
217 ("a-tienio", F), -- Ada.Text_IO.Enumeration_IO
218 ("a-tifiio", F), -- Ada.Text_IO.Fixed_IO
219 ("a-tiflio", F), -- Ada.Text_IO.Float_IO
220 ("a-tiinio", F), -- Ada.Text_IO.Integer_IO
221 ("a-tiinio", F), -- Ada.Text_IO.Integer_IO
222 ("a-timoio", F), -- Ada.Text_IO.Modular_IO
223 ("a-wtdeio", F), -- Ada.Wide_Text_IO.Decimal_IO
224 ("a-wtenio", F), -- Ada.Wide_Text_IO.Enumeration_IO
225 ("a-wtfiio", F), -- Ada.Wide_Text_IO.Fixed_IO
226 ("a-wtflio", F), -- Ada.Wide_Text_IO.Float_IO
227 ("a-wtinio", F), -- Ada.Wide_Text_IO.Integer_IO
228 ("a-wtmoio", F), -- Ada.Wide_Text_IO.Modular_IO
83cce46b 229
230 ------------------------
231 -- GNAT Library Units --
232 ------------------------
233
288afea9 234 ("g-altive", F), -- GNAT.Altivec
235 ("g-altcon", F), -- GNAT.Altivec.Conversions
236 ("g-alveop", F), -- GNAT.Altivec.Vector_Operations
237 ("g-alvety", F), -- GNAT.Altivec.Vector_Types
238 ("g-alvevi", F), -- GNAT.Altivec.Vector_Views
239 ("g-arrspl", F), -- GNAT.Array_Split
240 ("g-awk ", F), -- GNAT.AWK
d1cd1397 241 ("g-binenv", F), -- GNAT.Bind_Environment
288afea9 242 ("g-boubuf", F), -- GNAT.Bounded_Buffers
243 ("g-boumai", F), -- GNAT.Bounded_Mailboxes
244 ("g-bubsor", F), -- GNAT.Bubble_Sort
245 ("g-busora", F), -- GNAT.Bubble_Sort_A
246 ("g-busorg", F), -- GNAT.Bubble_Sort_G
247 ("g-byorma", F), -- GNAT.Byte_Order_Mark
248 ("g-bytswa", F), -- GNAT.Byte_Swapping
249 ("g-calend", F), -- GNAT.Calendar
250 ("g-catiio", F), -- GNAT.Calendar.Time_IO
251 ("g-casuti", F), -- GNAT.Case_Util
252 ("g-cgi ", F), -- GNAT.CGI
253 ("g-cgicoo", F), -- GNAT.CGI.Cookie
254 ("g-cgideb", F), -- GNAT.CGI.Debug
255 ("g-comlin", F), -- GNAT.Command_Line
256 ("g-comver", F), -- GNAT.Compiler_Version
3f778a00 257 ("g-cppexc", F), -- GNAT.CPP_Exceptions
288afea9 258 ("g-crc32 ", F), -- GNAT.CRC32
259 ("g-ctrl_c", F), -- GNAT.Ctrl_C
260 ("g-curexc", F), -- GNAT.Current_Exception
261 ("g-debpoo", F), -- GNAT.Debug_Pools
262 ("g-debuti", F), -- GNAT.Debug_Utilities
263 ("g-decstr", F), -- GNAT.Decode_String
264 ("g-deutst", F), -- GNAT.Decode_UTF8_String
265 ("g-dirope", F), -- GNAT.Directory_Operations
266 ("g-diopit", F), -- GNAT.Directory_Operations.Iteration
267 ("g-dynhta", F), -- GNAT.Dynamic_HTables
268 ("g-dyntab", F), -- GNAT.Dynamic_Tables
269 ("g-encstr", F), -- GNAT.Encode_String
270 ("g-enutst", F), -- GNAT.Encode_UTF8_String
271 ("g-excact", F), -- GNAT.Exception_Actions
272 ("g-except", F), -- GNAT.Exceptions
273 ("g-exctra", F), -- GNAT.Exception_Traces
274 ("g-expect", F), -- GNAT.Expect
57a06c2b 275 ("g-exptty", F), -- GNAT.Expect.TTY
288afea9 276 ("g-flocon", F), -- GNAT.Float_Control
294709fa 277 ("g-forstr", F), -- GNAT.Formatted_String
288afea9 278 ("g-heasor", F), -- GNAT.Heap_Sort
279 ("g-hesora", F), -- GNAT.Heap_Sort_A
280 ("g-hesorg", F), -- GNAT.Heap_Sort_G
281 ("g-htable", F), -- GNAT.Htable
282 ("g-io ", F), -- GNAT.IO
283 ("g-io_aux", F), -- GNAT.IO_Aux
284 ("g-locfil", F), -- GNAT.Lock_Files
285 ("g-mbdira", F), -- GNAT.MBBS_Discrete_Random
286 ("g-mbflra", F), -- GNAT.MBBS_Float_Random
287 ("g-md5 ", F), -- GNAT.MD5
288 ("g-memdum", F), -- GNAT.Memory_Dump
289 ("g-moreex", F), -- GNAT.Most_Recent_Exception
290 ("g-os_lib", F), -- GNAT.Os_Lib
291 ("g-pehage", F), -- GNAT.Perfect_Hash_Generators
292 ("g-rannum", F), -- GNAT.Random_Numbers
293 ("g-regexp", F), -- GNAT.Regexp
294 ("g-regist", F), -- GNAT.Registry
295 ("g-regpat", F), -- GNAT.Regpat
3c7edd99 296 ("g-rewdat", F), -- GNAT.Rewrite_Data
288afea9 297 ("g-semaph", F), -- GNAT.Semaphores
298 ("g-sercom", F), -- GNAT.Serial_Communications
299 ("g-sestin", F), -- GNAT.Secondary_Stack_Info
300 ("g-sha1 ", F), -- GNAT.SHA1
301 ("g-sha224", F), -- GNAT.SHA224
302 ("g-sha256", F), -- GNAT.SHA256
303 ("g-sha384", F), -- GNAT.SHA384
304 ("g-sha512", F), -- GNAT.SHA512
305 ("g-signal", F), -- GNAT.Signals
306 ("g-socket", F), -- GNAT.Sockets
307 ("g-souinf", F), -- GNAT.Source_Info
308 ("g-speche", F), -- GNAT.Spell_Checker
309 ("g-spchge", F), -- GNAT.Spell_Checker_Generic
310 ("g-spitbo", F), -- GNAT.Spitbol
311 ("g-spipat", F), -- GNAT.Spitbol.Patterns
312 ("g-sptabo", F), -- GNAT.Spitbol.Table_Boolean
313 ("g-sptain", F), -- GNAT.Spitbol.Table_Integer
314 ("g-sptavs", F), -- GNAT.Spitbol.Table_Vstring
315 ("g-string", F), -- GNAT.Strings
316 ("g-strspl", F), -- GNAT.String_Split
317 ("g-sse ", F), -- GNAT.SSE
318 ("g-ssvety", F), -- GNAT.SSE.Vector_Types
319 ("g-table ", F), -- GNAT.Table
320 ("g-tasloc", F), -- GNAT.Task_Lock
321 ("g-tastus", F), -- GNAT.Task_Stack_Usage
322 ("g-thread", F), -- GNAT.Threads
323 ("g-timsta", F), -- GNAT.Time_Stamp
324 ("g-traceb", F), -- GNAT.Traceback
325 ("g-trasym", F), -- GNAT.Traceback.Symbolic
57a06c2b 326 ("g-tty ", F), -- GNAT.TTY
288afea9 327 ("g-utf_32", F), -- GNAT.UTF_32
328 ("g-u3spch", F), -- GNAT.UTF_32_Spelling_Checker
329 ("g-wispch", F), -- GNAT.Wide_Spelling_Checker
330 ("g-wistsp", F), -- GNAT.Wide_String_Split
83cce46b 331
332 -----------------------------------------------------
333 -- Interface Hierarchy Units from Reference Manual --
334 -----------------------------------------------------
335
288afea9 336 ("i-c ", T), -- Interfaces.C
337 ("i-cobol ", T), -- Interfaces.Cobol
338 ("i-cpoint", T), -- Interfaces.C.Pointers
339 ("i-cstrin", T), -- Interfaces.C.Strings
340 ("i-fortra", T), -- Interfaces.Fortran
83cce46b 341
342 ------------------------------------------
343 -- GNAT Defined Additions to Interfaces --
344 ------------------------------------------
345
288afea9 346 ("i-cexten", F), -- Interfaces.C.Extensions
347 ("i-cil ", F), -- Interfaces.CIL
348 ("i-cilobj", F), -- Interfaces.CIL.Object
288afea9 349 ("i-cstrea", F), -- Interfaces.C.Streams
350 ("i-java ", F), -- Interfaces.Java
351 ("i-javjni", F), -- Interfaces.Java.JNI
352 ("i-pacdec", F), -- Interfaces.Packed_Decimal
353 ("i-vxwoio", F), -- Interfaces.VxWorks.IO
354 ("i-vxwork", F), -- Interfaces.VxWorks
83cce46b 355
356 --------------------------------------------------
357 -- System Hierarchy Units from Reference Manual --
358 --------------------------------------------------
359
288afea9 360 ("s-atacco", T), -- System.Address_To_Access_Conversions
361 ("s-maccod", T), -- System.Machine_Code
362 ("s-rpc ", T), -- System.Rpc
363 ("s-stoele", T), -- System.Storage_Elements
364 ("s-stopoo", T), -- System.Storage_Pools
83cce46b 365
366 --------------------------------------
367 -- GNAT Defined Additions to System --
368 --------------------------------------
369
288afea9 370 ("s-addima", F), -- System.Address_Image
d234ced5 371 ("s-atocou", F), -- System.Atomic_Counters
288afea9 372 ("s-assert", F), -- System.Assertions
70db3df9 373 ("s-diflio", F), -- System.Dim.Float_IO
374 ("s-diinio", F), -- System.Dim.Integer_IO
375 ("s-dimkio", F), -- System.Dim.Mks_IO
376 ("s-dimmks", F), -- System.Dim.Mks
377 ("s-dmotpr", F), -- System.Dim.Mks.Other_Prefixes
288afea9 378 ("s-memory", F), -- System.Memory
379 ("s-parint", F), -- System.Partition_Interface
380 ("s-pooglo", F), -- System.Pool_Global
381 ("s-pooloc", F), -- System.Pool_Local
382 ("s-restri", F), -- System.Restrictions
383 ("s-rident", F), -- System.Rident
384 ("s-ststop", F), -- System.Strings.Stream_Ops
385 ("s-tasinf", F), -- System.Task_Info
de0ea09b 386 ("s-unstyp", F), -- System.Unsigned_Types
72a21fdd 387 ("s-wchcnv", F), -- System.WCh_Cnv
388 ("s-wchcon", F), -- System.WCh_Con
cd0d5374 389
390 -- The following are strictly speaking Ada 2012 units, but we are allowed
391 -- to add children to system, so we consider them to be implementation
392 -- defined additions to System in earlier versions of Ada.
393
394 ("s-multip", T), -- System.Multiprocessors
395 ("s-mudido", T)); -- System.Multiprocessors.Dispatching_Domains
83cce46b 396
7189d17f 397 --------------------
398 -- Ada 2005 Units --
399 --------------------
400
401 -- The following units should be used only in Ada 05 mode
402
403 Non_Imp_File_Names_05 : constant File_List := (
404
405 --------------------------------------------------------
406 -- Ada Hierarchy Units from Ada 2005 Reference Manual --
407 --------------------------------------------------------
408
288afea9 409 ("a-assert", T), -- Ada.Assertions
410 ("a-calari", T), -- Ada.Calendar.Arithmetic
411 ("a-calfor", T), -- Ada.Calendar.Formatting
412 ("a-catizo", T), -- Ada.Calendar.Time_Zones
413 ("a-cdlili", T), -- Ada.Containers.Doubly_Linked_Lists
414 ("a-cgarso", T), -- Ada.Containers.Generic_Array_Sort
415 ("a-cgcaso", T), -- Ada.Containers.Generic_Constrained_Array_Sort
416 ("a-chacon", T), -- Ada.Characters.Conversions
417 ("a-cidlli", T), -- Ada.Containers.Indefinite_Doubly_Linked_Lists
418 ("a-cihama", T), -- Ada.Containers.Indefinite_Hashed_Maps
419 ("a-cihase", T), -- Ada.Containers.Indefinite_Hashed_Sets
420 ("a-ciorma", T), -- Ada.Containers.Indefinite_Ordered_Maps
421 ("a-ciorse", T), -- Ada.Containers.Indefinite_Ordered_Sets
422 ("a-cohama", T), -- Ada.Containers.Hashed_Maps
423 ("a-cohase", T), -- Ada.Containers.Hashed_Sets
424 ("a-coinve", T), -- Ada.Containers.Indefinite_Vectors
425 ("a-contai", T), -- Ada.Containers
426 ("a-convec", T), -- Ada.Containers.Vectors
427 ("a-coorma", T), -- Ada.Containers.Ordered_Maps
428 ("a-coorse", T), -- Ada.Containers.Ordered_Sets
429 ("a-coteio", T), -- Ada.Complex_Text_IO
430 ("a-direct", T), -- Ada.Directories
b85b7cb2 431 ("a-dinopr", T), -- Ada.Dispatching.Non_Preemptive
288afea9 432 ("a-diroro", T), -- Ada.Dispatching.Round_Robin
433 ("a-disedf", T), -- Ada.Dispatching.EDF
434 ("a-dispat", T), -- Ada.Dispatching
435 ("a-envvar", T), -- Ada.Environment_Variables
436 ("a-etgrbu", T), -- Ada.Execution_Time.Group_Budgets
437 ("a-exetim", T), -- Ada.Execution_Time
438 ("a-extiti", T), -- Ada.Execution_Time.Timers
439 ("a-izteio", T), -- Ada.Integer_Wide_Wide_Text_IO
440 ("a-rttiev", T), -- Ada.Real_Time.Timing_Events
441 ("a-ngcoar", T), -- Ada.Numerics.Generic_Complex_Arrays
442 ("a-ngrear", T), -- Ada.Numerics.Generic_Real_Arrays
443 ("a-nucoar", T), -- Ada.Numerics.Complex_Arrays
444 ("a-nurear", T), -- Ada.Numerics.Real_Arrays
445 ("a-stboha", T), -- Ada.Strings.Bounded.Hash
446 ("a-stfiha", T), -- Ada.Strings.Fixed.Hash
447 ("a-strhas", T), -- Ada.Strings.Hash
448 ("a-stunha", T), -- Ada.Strings.Unbounded.Hash
449 ("a-stwiha", T), -- Ada.Strings.Wide_Hash
450 ("a-stzbou", T), -- Ada.Strings.Wide_Wide_Bounded
451 ("a-stzfix", T), -- Ada.Strings.Wide_Wide_Fixed
452 ("a-stzhas", T), -- Ada.Strings.Wide_Wide_Hash
453 ("a-stzmap", T), -- Ada.Strings.Wide_Wide_Maps
454 ("a-stzunb", T), -- Ada.Strings.Wide_Wide_Unbounded
455 ("a-swbwha", T), -- Ada.Strings.Wide_Bounded.Wide_Hash
456 ("a-swfwha", T), -- Ada.Strings.Wide_Fixed.Wide_Hash
457 ("a-swuwha", T), -- Ada.Strings.Wide_Unbounded.Wide_Hash
458 ("a-szbzha", T), -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
459 ("a-szfzha", T), -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
460 ("a-szmzco", T), -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
461 ("a-szuzha", T), -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
462 ("a-taster", T), -- Ada.Task_Termination
463 ("a-tgdico", T), -- Ada.Tags.Generic_Dispatching_Constructor
464 ("a-tiboio", T), -- Ada.Text_IO.Bounded_IO
465 ("a-tiunio", T), -- Ada.Text_IO.Unbounded_IO
466 ("a-wichun", T), -- Ada.Wide_Characters.Unicode
467 ("a-wwboio", T), -- Ada.Wide_Text_IO.Wide_Bounded_IO
468 ("a-wwunio", T), -- Ada.Wide_Text_IO.Wide_Unbounded_IO
469 ("a-zchara", T), -- Ada.Wide_Wide_Characters
470 ("a-zchhan", T), -- Ada.Wide_Wide_Characters.Handling
471 ("a-ztcoio", T), -- Ada.Wide_Wide_Text_IO.Complex_IO
472 ("a-ztedit", T), -- Ada.Wide_Wide_Text_IO.Editing
473 ("a-zttest", T), -- Ada.Wide_Wide_Text_IO.Text_Streams
474 ("a-ztexio", T), -- Ada.Wide_Wide_Text_IO
475 ("a-zzboio", T), -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
476 ("a-zzunio", T), -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
7189d17f 477
478 ------------------------------------------------------
479 -- RM Required Additions to Ada 2005 for GNAT Types --
480 ------------------------------------------------------
481
288afea9 482 -- Note: Long versions are considered RM defined, but not the Long Long,
483 -- Short, or Short_Short versions.
484
485 ("a-lcteio", T), -- Ada.Long_Complex_Text_IO
486 ("a-lfztio", T), -- Ada.Long_Float_Wide_Wide_Text_IO
487 ("a-liztio", T), -- Ada.Long_Integer_Wide_Wide_Text_IO
488 ("a-llctio", T), -- Ada.Long_Long_Complex_Text_IO
489 ("a-llfzti", T), -- Ada.Long_Long_Float_Wide_Wide_Text_IO
490 ("a-llizti", T), -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
491 ("a-nlcoar", T), -- Ada.Numerics.Long_Complex_Arrays
492 ("a-nllcar", T), -- Ada.Numerics.Long_Long_Complex_Arrays
493 ("a-nllrar", T), -- Ada.Numerics.Long_Long_Real_Arrays
494 ("a-nlrear", T), -- Ada.Numerics.Long_Real_Arrays
495 ("a-scteio", F), -- Ada.Short_Complex_Text_IO
496 ("a-sfztio", F), -- Ada.Short_Float_Wide_Wide_Text_IO
497 ("a-siztio", F), -- Ada.Short_Integer_Wide_Wide_Text_IO
498 ("a-ssizti", F), -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
7189d17f 499
500 ----------------------------------------
501 -- GNAT Defined Additions to Ada 2005 --
502 ----------------------------------------
503
288afea9 504 ("a-cgaaso", F), -- Ada.Containers.Generic_Anonymous_Array_Sort
505 ("a-chzla1", F), -- Ada.Characters.Wide_Wide_Latin_1
506 ("a-chzla9", F), -- Ada.Characters.Wide_Wide_Latin_9
507 ("a-ciormu", F), -- Ada.Containers.Indefinite_Ordered_Multisets
508 ("a-coormu", F), -- Ada.Containers.Ordered_Multisets
509 ("a-crdlli", F), -- Ada.Containers.Restricted_Doubly_Linked_Lists
288afea9 510 ("a-szuzti", F), -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
511 ("a-zchuni", F), -- Ada.Wide_Wide_Characters.Unicode
512 ("a-ztcstr", F), -- Ada.Wide_Wide_Text_IO.C_Streams
83cce46b 513
d73d4db0 514 -- Note: strictly the following should be Ada 2012 units, but it seems
515 -- harmless (and useful) to make then available in Ada 2005 mode.
5779992c 516
4282d342 517 ("a-cogeso", T), -- Ada.Containers.Generic_Sort
6475ce8a 518 ("a-dhfina", T), -- Ada.Directories.Hierarchical_File_Names
37c52aaf 519 ("a-secain", T), -- Ada.Strings.Equal_Case_Insensitive
520 ("a-shcain", T), -- Ada.Strings.Hash_Case_Insensitive
521 ("a-slcain", T), -- Ada.Strings.Less_Case_Insensitive
522 ("a-sfecin", T), -- Ada.Strings.Fixed.Equal_Case_Insensitive
523 ("a-sfhcin", T), -- Ada.Strings.Fixed.Hash_Case_Insensitive
524 ("a-sflcin", T), -- Ada.Strings.Fixed.Less_Case_Insensitive
525 ("a-sbecin", T), -- Ada.Strings.Bounded.Equal_Case_Insensitive
526 ("a-sbhcin", T), -- Ada.Strings.Bounded.Hash_Case_Insensitive
527 ("a-sblcin", T), -- Ada.Strings.Bounded.Less_Case_Insensitive
528 ("a-suecin", T), -- Ada.Strings.Unbounded.Equal_Case_Insensitive
529 ("a-suhcin", T), -- Ada.Strings.Unbounded.Hash_Case_Insensitive
530 ("a-sulcin", T), -- Ada.Strings.Unbounded.Less_Case_Insensitive
288afea9 531 ("a-suezst", T), -- Ada.Strings.UTF_Encoding.Wide_Wide_Strings
5779992c 532
7189d17f 533 ---------------------------
534 -- GNAT Special IO Units --
535 ---------------------------
83cce46b 536
7189d17f 537 -- See Ada 95 section for further information. These packages are for the
538 -- implementation of the Wide_Wide_Text_IO generic packages.
83cce46b 539
288afea9 540 ("a-ztdeio", F), -- Ada.Wide_Wide_Text_IO.Decimal_IO
541 ("a-ztenio", F), -- Ada.Wide_Wide_Text_IO.Enumeration_IO
542 ("a-ztfiio", F), -- Ada.Wide_Wide_Text_IO.Fixed_IO
543 ("a-ztflio", F), -- Ada.Wide_Wide_Text_IO.Float_IO
544 ("a-ztinio", F), -- Ada.Wide_Wide_Text_IO.Integer_IO
545 ("a-ztmoio", F), -- Ada.Wide_Wide_Text_IO.Modular_IO
83cce46b 546
7189d17f 547 ------------------------
548 -- GNAT Library Units --
549 ------------------------
550
288afea9 551 ("g-zspche", F), -- GNAT.Wide_Wide_Spelling_Checker
552 ("g-zstspl", F)); -- GNAT.Wide_Wide_String_Split
7189d17f 553
ed8e5b83 554 --------------------
555 -- Ada 2012 Units --
556 --------------------
557
ebce244f 558 -- The following units should be used only in Ada 2012 mode
ed8e5b83 559
560 Non_Imp_File_Names_12 : constant File_List := (
288afea9 561 ("s-stposu", T), -- System.Storage_Pools.Subpools
562 ("a-cobove", T), -- Ada.Containers.Bounded_Vectors
563 ("a-cbdlli", T), -- Ada.Containers.Bounded_Doubly_Linked_Lists
564 ("a-cborse", T), -- Ada.Containers.Bounded_Ordered_Sets
565 ("a-cborma", T), -- Ada.Containers.Bounded_Ordered_Maps
566 ("a-cbhase", T), -- Ada.Containers.Bounded_Hashed_Sets
567 ("a-cbhama", T), -- Ada.Containers.Bounded_Hashed_Maps
568 ("a-coinho", T), -- Ada.Containers.Indefinite_Holders
569 ("a-comutr", T), -- Ada.Containers.Multiway_Trees
570 ("a-cimutr", T), -- Ada.Containers.Indefinite_Multiway_Trees
571 ("a-cbmutr", T), -- Ada.Containers.Bounded_Multiway_Trees
572 ("a-csquin", T), -- Ada.Containers.Synchronized_Queue_Interfaces
573 ("a-cusyqu", T), -- Ada.Containers.Unbounded_Synchronized_Queues
574 ("a-cuprqu", T), -- Ada.Containers.Unbounded_Priority_Queues
575 ("a-cbsyqu", T), -- Ada.Containers.Bounded_Synchronized_Queues
576 ("a-cbprqu", T), -- Ada.Containers.Bounded_Priority_Queues
577 ("a-extiin", T), -- Ada.Execution_Time.Interrupts
578 ("a-iteint", T), -- Ada.Iterator_Interfaces
4a9e7f0c 579 ("a-locale", T), -- Ada.Locales
a99d800a 580 ("a-stcoed", T), -- Ada.Synchronous_Task_Control.EDF
288afea9 581 ("a-synbar", T), -- Ada.Synchronous_Barriers
582 ("a-undesu", T), -- Ada.Unchecked_Deallocate_Subpool
a25bfc6b 583
1dceb63e 584 ----------------------------------------
585 -- GNAT Defined Additions to Ada 2012 --
586 ----------------------------------------
a25bfc6b 587
c59936c4 588 ("a-cfinve", F), -- Ada.Containers.Formal_Indefinite_Vectors
589 ("a-coboho", F), -- Ada.Containers.Bounded_Holders
288afea9 590 ("a-cofove", F), -- Ada.Containers.Formal_Vectors
591 ("a-cfdlli", F), -- Ada.Containers.Formal_Doubly_Linked_Lists
592 ("a-cforse", F), -- Ada.Containers.Formal_Ordered_Sets
593 ("a-cforma", F), -- Ada.Containers.Formal_Ordered_Maps
594 ("a-cfhase", F), -- Ada.Containers.Formal_Hashed_Sets
595 ("a-cfhama", F)); -- Ada.Containers.Formal_Hashed_Maps
ed8e5b83 596
7bc11884 597 -----------------------
598 -- Alternative Units --
599 -----------------------
600
601 -- For some implementation units, there is a unit in the GNAT library
602 -- that has identical functionality that is usable. If we have such a
603 -- case we record the appropriate Unit name in Error_Msg_String.
604
605 type Aunit_Record is record
606 Fname : String (1 .. 6);
cb388b10 607 Aname : String_Ptr_Const;
7bc11884 608 end record;
609
610 -- Array of alternative unit names
611
cb388b10 612 Scasuti : aliased constant String := "GNAT.Case_Util";
613 Scrc32 : aliased constant String := "GNAT.CRC32";
614 Shtable : aliased constant String := "GNAT.HTable";
615 Sos_lib : aliased constant String := "GNAT.OS_Lib";
616 Sregexp : aliased constant String := "GNAT.Regexp";
617 Sregpat : aliased constant String := "GNAT.Regpat";
618 Sstring : aliased constant String := "GNAT.Strings";
619 Sstusta : aliased constant String := "GNAT.Task_Stack_Usage";
620 Stasloc : aliased constant String := "GNAT.Task_Lock";
621 Sutf_32 : aliased constant String := "GNAT.UTF_32";
7bc11884 622
623 -- Array giving mapping
624
5f86d0ee 625 Map_Array : constant array (1 .. 10) of Aunit_Record := (
7bc11884 626 ("casuti", Scasuti'Access),
5f86d0ee 627 ("crc32 ", Scrc32 'Access),
628 ("htable", Shtable'Access),
7bc11884 629 ("os_lib", Sos_lib'Access),
630 ("regexp", Sregexp'Access),
631 ("regpat", Sregpat'Access),
632 ("string", Sstring'Access),
633 ("stusta", Sstusta'Access),
634 ("tasloc", Stasloc'Access),
635 ("utf_32", Sutf_32'Access));
636
7189d17f 637 ----------------------
e9c863fc 638 -- Get_Kind_Of_File --
7189d17f 639 ----------------------
640
e9c863fc 641 function Get_Kind_Of_File (File : String) return Kind_Of_Unit is
642 pragma Assert (File'First = 1);
643
644 Buffer : String (1 .. 8);
7189d17f 645
646 begin
7bc11884 647 Error_Msg_Strlen := 0;
648
288afea9 649 -- Ada/System/Interfaces are all Ada 95 units
83cce46b 650
e9c863fc 651 if File = "ada.ads"
e9c863fc 652 or else File = "interfac.ads"
fbc5a5a6 653 or else File = "system.ads"
288afea9 654 then
655 return Ada_95_Unit;
83cce46b 656 end if;
657
288afea9 658 -- If length of file name is greater than 12, not predefined. The value
659 -- 12 here is an 8 char name with extension .ads.
83cce46b 660
e9c863fc 661 if File'Length > 12 then
288afea9 662 return Not_Predefined_Unit;
663 end if;
83cce46b 664
7189d17f 665 -- Not predefined if file name does not start with a- g- s- i-
83cce46b 666
e9c863fc 667 if File'Length < 3
668 or else File (2) /= '-'
669 or else
670 (File (1) /= 'a'
671 and then File (1) /= 'g'
672 and then File (1) /= 'i'
673 and then File (1) /= 's')
83cce46b 674 then
7189d17f 675 return Not_Predefined_Unit;
83cce46b 676 end if;
677
27286d2b 678 -- To be considered predefined, the file name must end in .ads or .adb.
679 -- File names with other extensions (coming from the use of non-standard
680 -- file naming schemes) can never be predefined.
681
682 -- Note that in the context of a compiler, the .adb case will never
683 -- arise. However it can arise for other tools, e.g. gnatprove uses
684 -- this routine to detect when a construct comes from an instance of
685 -- a generic defined in a predefined unit.
d4f55b2a 686
e9c863fc 687 if File (File'Last - 3 .. File'Last) /= ".ads"
d4f55b2a 688 and then
e9c863fc 689 File (File'Last - 3 .. File'Last) /= ".adb"
d4f55b2a 690 then
7189d17f 691 return Not_Predefined_Unit;
83cce46b 692 end if;
693
694 -- Otherwise normalize file name to 8 characters
695
e9c863fc 696 Buffer (1 .. File'Length - 4) := File (1 .. File'Length - 4);
697
698 for J in File'Length - 3 .. 8 loop
699 Buffer (J) := ' ';
83cce46b 700 end loop;
701
7189d17f 702 -- See if name is in 95 list
83cce46b 703
7189d17f 704 for J in Non_Imp_File_Names_95'Range loop
e9c863fc 705 if Buffer = Non_Imp_File_Names_95 (J).Fname then
7189d17f 706 return Ada_95_Unit;
83cce46b 707 end if;
708 end loop;
709
ed8e5b83 710 -- See if name is in 2005 list
7189d17f 711
712 for J in Non_Imp_File_Names_05'Range loop
e9c863fc 713 if Buffer = Non_Imp_File_Names_05 (J).Fname then
de54c5ab 714 return Ada_2005_Unit;
7189d17f 715 end if;
716 end loop;
717
ed8e5b83 718 -- See if name is in 2012 list
719
720 for J in Non_Imp_File_Names_12'Range loop
e9c863fc 721 if Buffer = Non_Imp_File_Names_12 (J).Fname then
ad8b87c8 722 return Ada_2012_Unit;
ed8e5b83 723 end if;
724 end loop;
725
7189d17f 726 -- Only remaining special possibilities are children of System.RPC and
727 -- System.Garlic and special files of the form System.Aux...
83cce46b 728
fbc5a5a6 729 if File (1 .. 5) = "s-aux"
e9c863fc 730 or else File (1 .. 5) = "s-gar"
fbc5a5a6 731 or else File (1 .. 5) = "s-rpc"
83cce46b 732 then
7189d17f 733 return Ada_95_Unit;
83cce46b 734 end if;
735
7bc11884 736 -- All tests failed, this is definitely an implementation unit. See if
737 -- we have an alternative name.
738
e9c863fc 739 if File'Length in 11 .. 12
740 and then File (1 .. 2) = "s-"
741 and then File (File'Last - 3 .. File'Last) = ".ads"
7bc11884 742 then
743 for J in Map_Array'Range loop
e9c863fc 744 if (File'Length = 12 and then
745 File (3 .. 8) = Map_Array (J).Fname)
5f86d0ee 746 or else
e9c863fc 747 (File'Length = 11 and then
748 File (3 .. 7) = Map_Array (J).Fname (1 .. 5))
5f86d0ee 749 then
7bc11884 750 Error_Msg_Strlen := Map_Array (J).Aname'Length;
751 Error_Msg_String (1 .. Error_Msg_Strlen) :=
752 Map_Array (J).Aname.all;
753 end if;
754 end loop;
755 end if;
83cce46b 756
7189d17f 757 return Implementation_Unit;
e9c863fc 758 end Get_Kind_Of_File;
759
760 ----------------------
761 -- Get_Kind_Of_Unit --
762 ----------------------
763
764 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
765 begin
766 Get_Name_String (Unit_File_Name (U));
767 return Get_Kind_Of_File (Name_Buffer (1 .. Name_Len));
7189d17f 768 end Get_Kind_Of_Unit;
83cce46b 769
0d12640b 770 -------------------
771 -- Is_Known_Unit --
772 -------------------
773
774 function Is_Known_Unit (Nam : Node_Id) return Boolean is
775 Unam : Unit_Name_Type;
776 Fnam : File_Name_Type;
777
778 begin
779 -- If selector is not an identifier (e.g. it is a character literal or
780 -- some junk from a previous error), then definitely not a known unit.
781
782 if Nkind (Selector_Name (Nam)) /= N_Identifier then
783 return False;
784 end if;
785
786 -- Otherwise get corresponding file name
787
788 Unam := Get_Unit_Name (Nam);
789 Fnam := Get_File_Name (Unam, Subunit => False);
790 Get_Name_String (Fnam);
791
288afea9 792 Error_Msg_Strlen := 0;
793
794 -- Ada/System/Interfaces are all Ada 95 units
795
796 if (Name_Len = 7 and then Name_Buffer (1 .. 7) = "ada.ads")
797 or else
798 (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
799 or else
800 (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
801 then
802 return True;
803 end if;
804
0d12640b 805 -- Remove extension from file name
806
288afea9 807 if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb"
808 or else
809 Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
810 then
0d12640b 811 Name_Len := Name_Len - 4;
812 else
813 return False;
814 end if;
815
816 -- Pad name to 8 characters
817
818 while Name_Len < 8 loop
819 Name_Len := Name_Len + 1;
820 Name_Buffer (Name_Len) := ' ';
821 end loop;
822
823 -- If length more than 8, definitely not a match
824
825 if Name_Len /= 8 then
826 return False;
827 end if;
828
829 -- If length is 8, search our tables
830
831 for J in Non_Imp_File_Names_95'Range loop
288afea9 832 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
0d12640b 833 return True;
834 end if;
835 end loop;
836
837 for J in Non_Imp_File_Names_05'Range loop
288afea9 838 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
0d12640b 839 return True;
840 end if;
841 end loop;
842
9f469221 843 for J in Non_Imp_File_Names_12'Range loop
288afea9 844 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
9f469221 845 return True;
846 end if;
847 end loop;
848
0d12640b 849 -- If not found, not known
850
851 return False;
852
853 -- A safety guard, if we get an exception during this processing then it
854 -- is most likely the result of a previous error, or a peculiar case we
855 -- have not thought of. Since this routine is only used for error message
856 -- refinement, we will just return False.
857
858 exception
859 when others =>
860 return False;
861 end Is_Known_Unit;
862
b57be3aa 863 ---------------------------
864 -- Not_Impl_Defined_Unit --
865 ---------------------------
288afea9 866
b57be3aa 867 function Not_Impl_Defined_Unit (U : Unit_Number_Type) return Boolean is
288afea9 868 Fname : constant File_Name_Type := Unit_File_Name (U);
869
870 begin
871 Error_Msg_Strlen := 0;
872 Get_Name_String (Fname);
873
874 -- Ada/System/Interfaces are all RM-defined Ada 95 units
875
876 if (Name_Len = 7 and then Name_Buffer (1 .. 7) = "ada.ads")
877 or else
878 (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
879 or else
880 (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
881 then
882 return True;
883 end if;
884
b57be3aa 885 -- If length of file name is greater than 12, then it's a user unit
886 -- and not a GNAT implementation defined unit.
288afea9 887
888 if Name_Len > 12 then
b57be3aa 889 return True;
288afea9 890 end if;
891
b57be3aa 892 -- Implementation defined if unit in the gnat hierarchy
288afea9 893
b57be3aa 894 if (Name_Len = 8 and then Name_Buffer (1 .. 8) = "gnat.ads")
895 or else (Name_Len > 2 and then Name_Buffer (1 .. 2) = "g-")
896 then
288afea9 897 return False;
898 end if;
899
b57be3aa 900 -- Not implementation defined if file name does not start with a- s- i-
288afea9 901
902 if Name_Len < 3
903 or else Name_Buffer (2) /= '-'
904 or else (Name_Buffer (1) /= 'a'
905 and then
906 Name_Buffer (1) /= 'i'
907 and then
908 Name_Buffer (1) /= 's')
909 then
b57be3aa 910 return True;
288afea9 911 end if;
912
b57be3aa 913 -- Not impl-defined if file name does not end in .ads. This can happen
288afea9 914 -- when non-standard file names are being used.
915
916 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
b57be3aa 917 return True;
288afea9 918 end if;
919
920 -- Otherwise normalize file name to 8 characters
921
922 Name_Len := Name_Len - 4;
923 while Name_Len < 8 loop
924 Name_Len := Name_Len + 1;
925 Name_Buffer (Name_Len) := ' ';
926 end loop;
927
928 -- Check our lists of names, if we find a match, return corresponding
b57be3aa 929 -- indication of whether the file is RM defined, respecting the RM
930 -- version in which it is defined.
288afea9 931
932 for J in Non_Imp_File_Names_95'Range loop
933 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
934 return Non_Imp_File_Names_95 (J).RMdef;
935 end if;
936 end loop;
937
938 for J in Non_Imp_File_Names_05'Range loop
939 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
940 return Non_Imp_File_Names_05 (J).RMdef
941 and then Ada_Version >= Ada_2005;
942 end if;
943 end loop;
944
945 for J in Non_Imp_File_Names_12'Range loop
946 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
947 return Non_Imp_File_Names_95 (J).RMdef
948 and then Ada_Version >= Ada_2012;
949 end if;
950 end loop;
951
b57be3aa 952 -- If unit is in System, Ada or Interfaces hierarchies and did not match
953 -- any entry in the list, means it is an internal implementation defined
954 -- unit which the restriction should definition forbid.
288afea9 955
b57be3aa 956 return True;
957 end Not_Impl_Defined_Unit;
288afea9 958
83cce46b 959end Impunit;