Merge from mainline (163495:164578).
[official-gcc/graphite-test-results.git] / gcc / ada / impunit.adb
blobfe89924333e281593c7bcfb77127cf39a5fbff4e
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- I M P U N I T --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2000-2010, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 with Atree; use Atree;
27 with Errout; use Errout;
28 with Sinfo; use Sinfo;
29 with Fname.UF; use Fname.UF;
30 with Lib; use Lib;
31 with Namet; use Namet;
32 with Uname; use Uname;
34 -- Note: this package body is used by GPS and GNATBench to supply a list of
35 -- entries for help on available library routines.
37 package body Impunit is
39 subtype File_Name_8 is String (1 .. 8);
40 type File_List is array (Nat range <>) of File_Name_8;
42 ------------------
43 -- Ada 95 Units --
44 ------------------
46 -- The following is a giant string list containing the names of all non-
47 -- implementation internal files, i.e. the complete list of files for
48 -- internal units which a program may legitimately WITH when operating in
49 -- either Ada 95 or Ada 05 mode.
51 -- Note that this list should match the list of units documented in the
52 -- "GNAT Library" section of the GNAT Reference Manual. A unit listed here
53 -- must either be documented in that section or described in the Ada RM.
55 Non_Imp_File_Names_95 : constant File_List := (
57 ------------------------------------------------------
58 -- Ada Hierarchy Units from Ada-95 Reference Manual --
59 ------------------------------------------------------
61 "a-astaco", -- Ada.Asynchronous_Task_Control
62 "a-calend", -- Ada.Calendar
63 "a-chahan", -- Ada.Characters.Handling
64 "a-charac", -- Ada.Characters
65 "a-chlat1", -- Ada.Characters.Latin_1
66 "a-comlin", -- Ada.Command_Line
67 "a-decima", -- Ada.Decimal
68 "a-direio", -- Ada.Direct_IO
69 "a-dynpri", -- Ada.Dynamic_Priorities
70 "a-except", -- Ada.Exceptions
71 "a-finali", -- Ada.Finalization
72 "a-flteio", -- Ada.Float_Text_IO
73 "a-fwteio", -- Ada.Float_Wide_Text_IO
74 "a-inteio", -- Ada.Integer_Text_IO
75 "a-interr", -- Ada.Interrupts
76 "a-intnam", -- Ada.Interrupts.Names
77 "a-ioexce", -- Ada.IO_Exceptions
78 "a-iwteio", -- Ada.Integer_Wide_Text_IO
79 "a-ncelfu", -- Ada.Numerics.Complex_Elementary_Functions
80 "a-ngcefu", -- Ada.Numerics.Generic_Complex_Elementary_Functions
81 "a-ngcoty", -- Ada.Numerics.Generic_Complex_Types
82 "a-ngelfu", -- Ada.Numerics.Generic_Elementary_Functions
83 "a-nucoty", -- Ada.Numerics.Complex_Types
84 "a-nudira", -- Ada.Numerics.Discrete_Random
85 "a-nuelfu", -- Ada.Numerics.Elementary_Functions
86 "a-nuflra", -- Ada.Numerics.Float_Random
87 "a-numeri", -- Ada.Numerics
88 "a-reatim", -- Ada.Real_Time
89 "a-sequio", -- Ada.Sequential_IO
90 "a-stmaco", -- Ada.Strings.Maps.Constants
91 "a-storio", -- Ada.Storage_IO
92 "a-strbou", -- Ada.Strings.Bounded
93 "a-stream", -- Ada.Streams
94 "a-strfix", -- Ada.Strings.Fixed
95 "a-string", -- Ada.Strings
96 "a-strmap", -- Ada.Strings.Maps
97 "a-strunb", -- Ada.Strings.Unbounded
98 "a-ststio", -- Ada.Streams.Stream_IO
99 "a-stwibo", -- Ada.Strings.Wide_Bounded
100 "a-stwifi", -- Ada.Strings.Wide_Fixed
101 "a-stwima", -- Ada.Strings.Wide_Maps
102 "a-stwiun", -- Ada.Strings.Wide_Unbounded
103 "a-swmwco", -- Ada.Strings.Wide_Maps.Wide_Constants
104 "a-sytaco", -- Ada.Synchronous_Task_Control
105 "a-tags ", -- Ada.Tags
106 "a-tasatt", -- Ada.Task_Attributes
107 "a-taside", -- Ada.Task_Identification
108 "a-teioed", -- Ada.Text_IO.Editing
109 "a-textio", -- Ada.Text_IO
110 "a-ticoio", -- Ada.Text_IO.Complex_IO
111 "a-titest", -- Ada.Text_IO.Text_Streams
112 "a-unccon", -- Ada.Unchecked_Conversion
113 "a-uncdea", -- Ada.Unchecked_Deallocation
114 "a-witeio", -- Ada.Wide_Text_IO
115 "a-wtcoio", -- Ada.Wide_Text_IO.Complex_IO
116 "a-wtedit", -- Ada.Wide_Text_IO.Editing
117 "a-wttest", -- Ada.Wide_Text_IO.Text_Streams
119 -------------------------------------------------
120 -- RM Required Additions to Ada for GNAT Types --
121 -------------------------------------------------
123 "a-lfteio", -- Ada.Long_Float_Text_IO
124 "a-lfwtio", -- Ada.Long_Float_Wide_Text_IO
125 "a-liteio", -- Ada.Long_Integer_Text_IO
126 "a-liwtio", -- Ada.Long_Integer_Wide_Text_IO
127 "a-llftio", -- Ada.Long_Long_Float_Text_IO
128 "a-llfwti", -- Ada.Long_Long_Float_Wide_Text_IO
129 "a-llitio", -- Ada.Long_Long_Integer_Text_IO
130 "a-lliwti", -- Ada.Long_Long_Integer_Wide_Text_IO
131 "a-nlcefu", -- Ada.Long_Complex_Elementary_Functions
132 "a-nlcoty", -- Ada.Numerics.Long_Complex_Types
133 "a-nlelfu", -- Ada.Numerics.Long_Elementary_Functions
134 "a-nllcef", -- Ada.Long_Long_Complex_Elementary_Functions
135 "a-nllefu", -- Ada.Numerics.Long_Long_Elementary_Functions
136 "a-nllcty", -- Ada.Numerics.Long_Long_Complex_Types
137 "a-nscefu", -- Ada.Short_Complex_Elementary_Functions
138 "a-nscoty", -- Ada.Numerics.Short_Complex_Types
139 "a-nselfu", -- Ada.Numerics.Short_Elementary_Functions
140 "a-sfteio", -- Ada.Short_Float_Text_IO
141 "a-sfwtio", -- Ada.Short_Float_Wide_Text_IO
142 "a-siteio", -- Ada.Short_Integer_Text_IO
143 "a-siwtio", -- Ada.Short_Integer_Wide_Text_IO
144 "a-ssitio", -- Ada.Short_Short_Integer_Text_IO
145 "a-ssiwti", -- Ada.Short_Short_Integer_Wide_Text_IO
147 -----------------------------------
148 -- GNAT Defined Additions to Ada --
149 -----------------------------------
151 "a-calcon", -- Ada.Calendar.Conversions
152 "a-chlat9", -- Ada.Characters.Latin_9
153 "a-clrefi", -- Ada.Command_Line.Response_File
154 "a-colien", -- Ada.Command_Line.Environment
155 "a-colire", -- Ada.Command_Line.Remove
156 "a-cwila1", -- Ada.Characters.Wide_Latin_1
157 "a-cwila9", -- Ada.Characters.Wide_Latin_9
158 "a-diocst", -- Ada.Direct_IO.C_Streams
159 "a-einuoc", -- Ada.Exceptions.Is_Null_Occurrence
160 "a-elchha", -- Ada.Exceptions.Last_Chance_Handler
161 "a-exctra", -- Ada.Exceptions.Traceback
162 "a-siocst", -- Ada.Sequential_IO.C_Streams
163 "a-ssicst", -- Ada.Streams.Stream_IO.C_Streams
164 "a-suteio", -- Ada.Strings.Unbounded.Text_IO
165 "a-swuwti", -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
166 "a-tiocst", -- Ada.Text_IO.C_Streams
167 "a-wtcstr", -- Ada.Wide_Text_IO.C_Streams
169 -- Note: strictly the next two should be Ada 2005 units, but it seems
170 -- harmless (and useful) to make then available in Ada 95 mode, since
171 -- they only deal with Wide_Character, not Wide_Wide_Character.
173 "a-wichun", -- Ada.Wide_Characters.Unicode
174 "a-widcha", -- Ada.Wide_Characters
176 -- Note: strictly the following should be Ada 2012 units, but it seems
177 -- harmless (and useful) to make then available in Ada 95 mode, since
178 -- they do not deal with Wide_Wide_Character.
180 "a-stuten", -- Ada.Strings.UTF_Encoding
181 "a-suenco", -- Ada.Strings.UTF_Encoding.Conversions
182 "a-suesen", -- Ada.Strings.UTF_Encoding.String_Encoding
183 "a-suewse", -- Ada.Strings.UTF_Encoding.Wide_String_Encoding
185 ---------------------------
186 -- GNAT Special IO Units --
187 ---------------------------
189 -- As further explained elsewhere (see Sem_Ch10), the internal packages of
190 -- Text_IO and Wide_Text_IO are actually implemented as separate children,
191 -- but this fact is intended to be hidden from the user completely. Any
192 -- attempt to WITH one of these units will be diagnosed as an error later
193 -- on, but for now we do not consider these internal implementation units
194 -- (if we did, then we would get a junk warning which would be confusing
195 -- and unnecessary, given that we generate a clear error message).
197 "a-tideio", -- Ada.Text_IO.Decimal_IO
198 "a-tienio", -- Ada.Text_IO.Enumeration_IO
199 "a-tifiio", -- Ada.Text_IO.Fixed_IO
200 "a-tiflio", -- Ada.Text_IO.Float_IO
201 "a-tiinio", -- Ada.Text_IO.Integer_IO
202 "a-tiinio", -- Ada.Text_IO.Integer_IO
203 "a-timoio", -- Ada.Text_IO.Modular_IO
204 "a-wtdeio", -- Ada.Wide_Text_IO.Decimal_IO
205 "a-wtenio", -- Ada.Wide_Text_IO.Enumeration_IO
206 "a-wtfiio", -- Ada.Wide_Text_IO.Fixed_IO
207 "a-wtflio", -- Ada.Wide_Text_IO.Float_IO
208 "a-wtinio", -- Ada.Wide_Text_IO.Integer_IO
209 "a-wtmoio", -- Ada.Wide_Text_IO.Modular_IO
211 ------------------------
212 -- GNAT Library Units --
213 ------------------------
215 "g-altive", -- GNAT.Altivec
216 "g-altcon", -- GNAT.Altivec.Conversions
217 "g-alveop", -- GNAT.Altivec.Vector_Operations
218 "g-alvety", -- GNAT.Altivec.Vector_Types
219 "g-alvevi", -- GNAT.Altivec.Vector_Views
220 "g-arrspl", -- GNAT.Array_Split
221 "g-awk ", -- GNAT.AWK
222 "g-boubuf", -- GNAT.Bounded_Buffers
223 "g-boumai", -- GNAT.Bounded_Mailboxes
224 "g-bubsor", -- GNAT.Bubble_Sort
225 "g-busora", -- GNAT.Bubble_Sort_A
226 "g-busorg", -- GNAT.Bubble_Sort_G
227 "g-byorma", -- GNAT.Byte_Order_Mark
228 "g-bytswa", -- GNAT.Byte_Swapping
229 "g-calend", -- GNAT.Calendar
230 "g-catiio", -- GNAT.Calendar.Time_IO
231 "g-casuti", -- GNAT.Case_Util
232 "g-cgi ", -- GNAT.CGI
233 "g-cgicoo", -- GNAT.CGI.Cookie
234 "g-cgideb", -- GNAT.CGI.Debug
235 "g-comlin", -- GNAT.Command_Line
236 "g-comver", -- GNAT.Compiler_Version
237 "g-crc32 ", -- GNAT.CRC32
238 "g-ctrl_c", -- GNAT.Ctrl_C
239 "g-curexc", -- GNAT.Current_Exception
240 "g-debpoo", -- GNAT.Debug_Pools
241 "g-debuti", -- GNAT.Debug_Utilities
242 "g-decstr", -- GNAT.Decode_String
243 "g-deutst", -- GNAT.Decode_UTF8_String
244 "g-dirope", -- GNAT.Directory_Operations
245 "g-diopit", -- GNAT.Directory_Operations.Iteration
246 "g-dynhta", -- GNAT.Dynamic_HTables
247 "g-dyntab", -- GNAT.Dynamic_Tables
248 "g-encstr", -- GNAT.Encode_String
249 "g-enutst", -- GNAT.Encode_UTF8_String
250 "g-excact", -- GNAT.Exception_Actions
251 "g-except", -- GNAT.Exceptions
252 "g-exctra", -- GNAT.Exception_Traces
253 "g-expect", -- GNAT.Expect
254 "g-flocon", -- GNAT.Float_Control
255 "g-heasor", -- GNAT.Heap_Sort
256 "g-hesora", -- GNAT.Heap_Sort_A
257 "g-hesorg", -- GNAT.Heap_Sort_G
258 "g-htable", -- GNAT.Htable
259 "g-io ", -- GNAT.IO
260 "g-io_aux", -- GNAT.IO_Aux
261 "g-locfil", -- GNAT.Lock_Files
262 "g-mbdira", -- GNAT.MBBS_Discrete_Random
263 "g-mbflra", -- GNAT.MBBS_Float_Random
264 "g-md5 ", -- GNAT.MD5
265 "g-memdum", -- GNAT.Memory_Dump
266 "g-moreex", -- GNAT.Most_Recent_Exception
267 "g-os_lib", -- GNAT.Os_Lib
268 "g-pehage", -- GNAT.Perfect_Hash_Generators
269 "g-rannum", -- GNAT.Random_Numbers
270 "g-regexp", -- GNAT.Regexp
271 "g-regist", -- GNAT.Registry
272 "g-regpat", -- GNAT.Regpat
273 "g-semaph", -- GNAT.Semaphores
274 "g-sercom", -- GNAT.Serial_Communications
275 "g-sestin", -- GNAT.Secondary_Stack_Info
276 "g-sha1 ", -- GNAT.SHA1
277 "g-sha224", -- GNAT.SHA224
278 "g-sha256", -- GNAT.SHA256
279 "g-sha384", -- GNAT.SHA384
280 "g-sha512", -- GNAT.SHA512
281 "g-signal", -- GNAT.Signals
282 "g-socket", -- GNAT.Sockets
283 "g-souinf", -- GNAT.Source_Info
284 "g-speche", -- GNAT.Spell_Checker
285 "g-spchge", -- GNAT.Spell_Checker_Generic
286 "g-spitbo", -- GNAT.Spitbol
287 "g-spipat", -- GNAT.Spitbol.Patterns
288 "g-sptabo", -- GNAT.Spitbol.Table_Boolean
289 "g-sptain", -- GNAT.Spitbol.Table_Integer
290 "g-sptavs", -- GNAT.Spitbol.Table_Vstring
291 "g-string", -- GNAT.Strings
292 "g-strspl", -- GNAT.String_Split
293 "g-sse ", -- GNAT.SSE
294 "g-ssvety", -- GNAT.SSE.Vector_Types
295 "g-table ", -- GNAT.Table
296 "g-tasloc", -- GNAT.Task_Lock
297 "g-thread", -- GNAT.Threads
298 "g-timsta", -- GNAT.Time_Stamp
299 "g-traceb", -- GNAT.Traceback
300 "g-trasym", -- GNAT.Traceback.Symbolic
301 "g-utf_32", -- GNAT.UTF_32
302 "g-u3spch", -- GNAT.UTF_32_Spelling_Checker
303 "g-wispch", -- GNAT.Wide_Spelling_Checker
304 "g-wistsp", -- GNAT.Wide_String_Split
306 -----------------------------------------------------
307 -- Interface Hierarchy Units from Reference Manual --
308 -----------------------------------------------------
310 "i-c ", -- Interfaces.C
311 "i-cobol ", -- Interfaces.Cobol
312 "i-cpoint", -- Interfaces.C.Pointers
313 "i-cstrin", -- Interfaces.C.Strings
314 "i-fortra", -- Interfaces.Fortran
316 ------------------------------------------
317 -- GNAT Defined Additions to Interfaces --
318 ------------------------------------------
320 "i-cexten", -- Interfaces.C.Extensions
321 "i-cil ", -- Interfaces.CIL
322 "i-cilobj", -- Interfaces.CIL.Object
323 "i-cpp ", -- Interfaces.CPP
324 "i-cstrea", -- Interfaces.C.Streams
325 "i-java ", -- Interfaces.Java
326 "i-javjni", -- Interfaces.Java.JNI
327 "i-pacdec", -- Interfaces.Packed_Decimal
328 "i-vxwoio", -- Interfaces.VxWorks.IO
329 "i-vxwork", -- Interfaces.VxWorks
331 --------------------------------------------------
332 -- System Hierarchy Units from Reference Manual --
333 --------------------------------------------------
335 "s-atacco", -- System.Address_To_Access_Conversions
336 "s-maccod", -- System.Machine_Code
337 "s-rpc ", -- System.Rpc
338 "s-stoele", -- System.Storage_Elements
339 "s-stopoo", -- System.Storage_Pools
341 --------------------------------------
342 -- GNAT Defined Additions to System --
343 --------------------------------------
345 "s-addima", -- System.Address_Image
346 "s-assert", -- System.Assertions
347 "s-memory", -- System.Memory
348 "s-parint", -- System.Partition_Interface
349 "s-pooglo", -- System.Pool_Global
350 "s-pooloc", -- System.Pool_Local
351 "s-restri", -- System.Restrictions
352 "s-rident", -- System.Rident
353 "s-ststop", -- System.Strings.Stream_Ops
354 "s-tasinf", -- System.Task_Info
355 "s-wchcnv", -- System.Wch_Cnv
356 "s-wchcon"); -- System.Wch_Con
358 --------------------
359 -- Ada 2005 Units --
360 --------------------
362 -- The following units should be used only in Ada 05 mode
364 Non_Imp_File_Names_05 : constant File_List := (
366 --------------------------------------------------------
367 -- Ada Hierarchy Units from Ada 2005 Reference Manual --
368 --------------------------------------------------------
370 "a-assert", -- Ada.Assertions
371 "a-calari", -- Ada.Calendar.Arithmetic
372 "a-calfor", -- Ada.Calendar.Formatting
373 "a-catizo", -- Ada.Calendar.Time_Zones
374 "a-cdlili", -- Ada.Containers.Doubly_Linked_Lists
375 "a-cgarso", -- Ada.Containers.Generic_Array_Sort
376 "a-cgcaso", -- Ada.Containers.Generic_Constrained_Array_Sort
377 "a-chacon", -- Ada.Characters.Conversions
378 "a-cidlli", -- Ada.Containers.Indefinite_Doubly_Linked_Lists
379 "a-cihama", -- Ada.Containers.Indefinite_Hashed_Maps
380 "a-cihase", -- Ada.Containers.Indefinite_Hashed_Sets
381 "a-ciorma", -- Ada.Containers.Indefinite_Ordered_Maps
382 "a-ciorse", -- Ada.Containers.Indefinite_Ordered_Sets
383 "a-cohama", -- Ada.Containers.Hashed_Maps
384 "a-cohase", -- Ada.Containers.Hashed_Sets
385 "a-coinve", -- Ada.Containers.Indefinite_Vectors
386 "a-contai", -- Ada.Containers
387 "a-convec", -- Ada.Containers.Vectors
388 "a-coorma", -- Ada.Containers.Ordered_Maps
389 "a-coorse", -- Ada.Containers.Ordered_Sets
390 "a-coteio", -- Ada.Complex_Text_IO
391 "a-direct", -- Ada.Directories
392 "a-diroro", -- Ada.Dispatching.Round_Robin
393 "a-disedf", -- Ada.Dispatching.EDF
394 "a-dispat", -- Ada.Dispatching
395 "a-envvar", -- Ada.Environment_Variables
396 "a-exetim", -- Ada.Execution_Time
397 "a-extiti", -- Ada.Execution_Time.Timers
398 "a-izteio", -- Ada.Integer_Wide_Wide_Text_IO
399 "a-rttiev", -- Ada.Real_Time.Timing_Events
400 "a-ngcoar", -- Ada.Numerics.Generic_Complex_Arrays
401 "a-ngrear", -- Ada.Numerics.Generic_Real_Arrays
402 "a-nucoar", -- Ada.Numerics.Complex_Arrays
403 "a-nurear", -- Ada.Numerics.Real_Arrays
404 "a-stboha", -- Ada.Strings.Bounded.Hash
405 "a-stfiha", -- Ada.Strings.Fixed.Hash
406 "a-strhas", -- Ada.Strings.Hash
407 "a-stunha", -- Ada.Strings.Unbounded.Hash
408 "a-stwiha", -- Ada.Strings.Wide_Hash
409 "a-stzbou", -- Ada.Strings.Wide_Wide_Bounded
410 "a-stzfix", -- Ada.Strings.Wide_Wide_Fixed
411 "a-stzhas", -- Ada.Strings.Wide_Wide_Hash
412 "a-stzmap", -- Ada.Strings.Wide_Wide_Maps
413 "a-stzunb", -- Ada.Strings.Wide_Wide_Unbounded
414 "a-swbwha", -- Ada.Strings.Wide_Bounded.Wide_Hash
415 "a-swfwha", -- Ada.Strings.Wide_Fixed.Wide_Hash
416 "a-swuwha", -- Ada.Strings.Wide_Unbounded.Wide_Hash
417 "a-szbzha", -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
418 "a-szfzha", -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
419 "a-szmzco", -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
420 "a-szuzha", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
421 "a-taster", -- Ada.Task_Termination
422 "a-tgdico", -- Ada.Tags.Generic_Dispatching_Constructor
423 "a-tiboio", -- Ada.Text_IO.Bounded_IO
424 "a-tiunio", -- Ada.Text_IO.Unbounded_IO
425 "a-wichun", -- Ada.Wide_Characters.Unicode
426 "a-wwboio", -- Ada.Wide_Text_IO.Wide_Bounded_IO
427 "a-wwunio", -- Ada.Wide_Text_IO.Wide_Unbounded_IO
428 "a-zchara", -- Ada.Wide_Wide_Characters
429 "a-ztcoio", -- Ada.Wide_Wide_Text_IO.Complex_IO
430 "a-ztedit", -- Ada.Wide_Wide_Text_IO.Editing
431 "a-zttest", -- Ada.Wide_Wide_Text_IO.Text_Streams
432 "a-ztexio", -- Ada.Wide_Wide_Text_IO
433 "a-zzboio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
434 "a-zzunio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
436 ------------------------------------------------------
437 -- RM Required Additions to Ada 2005 for GNAT Types --
438 ------------------------------------------------------
440 "a-lcteio", -- Ada.Long_Complex_Text_IO
441 "a-lfztio", -- Ada.Long_Float_Wide_Wide_Text_IO
442 "a-liztio", -- Ada.Long_Integer_Wide_Wide_Text_IO
443 "a-llctio", -- Ada.Long_Long_Complex_Text_IO
444 "a-llfzti", -- Ada.Long_Long_Float_Wide_Wide_Text_IO
445 "a-llizti", -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
446 "a-nlcoar", -- Ada.Numerics.Long_Complex_Arrays
447 "a-nllcar", -- Ada.Numerics.Long_Long_Complex_Arrays
448 "a-nllrar", -- Ada.Numerics.Long_Long_Real_Arrays
449 "a-nlrear", -- Ada.Numerics.Long_Real_Arrays
450 "a-scteio", -- Ada.Short_Complex_Text_IO
451 "a-sfztio", -- Ada.Short_Float_Wide_Wide_Text_IO
452 "a-siztio", -- Ada.Short_Integer_Wide_Wide_Text_IO
453 "a-ssizti", -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
454 "a-ztcstr", -- Ada.Wide_Wide_Text_IO.C_Streams
456 ----------------------------------------
457 -- GNAT Defined Additions to Ada 2005 --
458 ----------------------------------------
460 "a-cgaaso", -- Ada.Containers.Generic_Anonymous_Array_Sort
461 "a-chzla1", -- Ada.Characters.Wide_Wide_Latin_1
462 "a-chzla9", -- Ada.Characters.Wide_Wide_Latin_9
463 "a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
464 "a-coormu", -- Ada.Containers.Ordered_Multisets
465 "a-crdlli", -- Ada.Containers.Restricted_Doubly_Linked_Lists
466 "a-secain", -- Ada.Strings.Equal_Case_Insensitive
467 "a-shcain", -- Ada.Strings.Hash_Case_Insensitive
468 "a-slcain", -- Ada.Strings.Less_Case_Insensitive
469 "a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
470 "a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
472 -- Note: strictly the following should be Ada 2012 units, but it seems
473 -- harmless (and useful) to make then available in Ada 2005 mode.
475 "a-suezse", -- Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding
477 ---------------------------
478 -- GNAT Special IO Units --
479 ---------------------------
481 -- See Ada 95 section for further information. These packages are for the
482 -- implementation of the Wide_Wide_Text_IO generic packages.
484 "a-ztdeio", -- Ada.Wide_Wide_Text_IO.Decimal_IO
485 "a-ztenio", -- Ada.Wide_Wide_Text_IO.Enumeration_IO
486 "a-ztfiio", -- Ada.Wide_Wide_Text_IO.Fixed_IO
487 "a-ztflio", -- Ada.Wide_Wide_Text_IO.Float_IO
488 "a-ztinio", -- Ada.Wide_Wide_Text_IO.Integer_IO
489 "a-ztmoio", -- Ada.Wide_Wide_Text_IO.Modular_IO
491 ------------------------
492 -- GNAT Library Units --
493 ------------------------
495 "g-zspche", -- GNAT.Wide_Wide_Spelling_Checker
496 "g-zstspl"); -- GNAT.Wide_Wide_String_Split
498 -----------------------
499 -- Alternative Units --
500 -----------------------
502 -- For some implementation units, there is a unit in the GNAT library
503 -- that has identical functionality that is usable. If we have such a
504 -- case we record the appropriate Unit name in Error_Msg_String.
506 type Aunit_Record is record
507 Fname : String (1 .. 6);
508 Aname : String_Ptr;
509 end record;
511 -- Array of alternative unit names
513 Scasuti : aliased String := "GNAT.Case_Util";
514 Scrc32 : aliased String := "GNAT.CRC32";
515 Shtable : aliased String := "GNAT.HTable";
516 Sos_lib : aliased String := "GNAT.OS_Lib";
517 Sregexp : aliased String := "GNAT.Regexp";
518 Sregpat : aliased String := "GNAT.Regpat";
519 Sstring : aliased String := "GNAT.Strings";
520 Sstusta : aliased String := "GNAT.Task_Stack_Usage";
521 Stasloc : aliased String := "GNAT.Task_Lock";
522 Sutf_32 : aliased String := "GNAT.UTF_32";
524 -- Array giving mapping
526 Map_Array : constant array (1 .. 10) of Aunit_Record := (
527 ("casuti", Scasuti'Access),
528 ("crc32 ", Scrc32 'Access),
529 ("htable", Shtable'Access),
530 ("os_lib", Sos_lib'Access),
531 ("regexp", Sregexp'Access),
532 ("regpat", Sregpat'Access),
533 ("string", Sstring'Access),
534 ("stusta", Sstusta'Access),
535 ("tasloc", Stasloc'Access),
536 ("utf_32", Sutf_32'Access));
538 ----------------------
539 -- Get_Kind_Of_Unit --
540 ----------------------
542 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
543 Fname : constant File_Name_Type := Unit_File_Name (U);
545 begin
546 Error_Msg_Strlen := 0;
548 -- If length of file name is greater than 12, not predefined.
549 -- The value 12 here is an 8 char name with extension .ads.
551 if Length_Of_Name (Fname) > 12 then
552 return Not_Predefined_Unit;
553 end if;
555 -- Otherwise test file name
557 Get_Name_String (Fname);
559 -- Not predefined if file name does not start with a- g- s- i-
561 if Name_Len < 3
562 or else Name_Buffer (2) /= '-'
563 or else (Name_Buffer (1) /= 'a'
564 and then
565 Name_Buffer (1) /= 'g'
566 and then
567 Name_Buffer (1) /= 'i'
568 and then
569 Name_Buffer (1) /= 's')
570 then
571 return Not_Predefined_Unit;
572 end if;
574 -- Not predefined if file name does not end in .ads. This can
575 -- happen when non-standard file names are being used.
577 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
578 return Not_Predefined_Unit;
579 end if;
581 -- Otherwise normalize file name to 8 characters
583 Name_Len := Name_Len - 4;
584 while Name_Len < 8 loop
585 Name_Len := Name_Len + 1;
586 Name_Buffer (Name_Len) := ' ';
587 end loop;
589 -- See if name is in 95 list
591 for J in Non_Imp_File_Names_95'Range loop
592 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
593 return Ada_95_Unit;
594 end if;
595 end loop;
597 -- See if name is in 05 list
599 for J in Non_Imp_File_Names_05'Range loop
600 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
601 return Ada_05_Unit;
602 end if;
603 end loop;
605 -- Only remaining special possibilities are children of System.RPC and
606 -- System.Garlic and special files of the form System.Aux...
608 Get_Name_String (Unit_Name (U));
610 if Name_Len > 12
611 and then Name_Buffer (1 .. 11) = "system.rpc."
612 then
613 return Ada_95_Unit;
614 end if;
616 if Name_Len > 15
617 and then Name_Buffer (1 .. 14) = "system.garlic."
618 then
619 return Ada_95_Unit;
620 end if;
622 if Name_Len > 11
623 and then Name_Buffer (1 .. 10) = "system.aux"
624 then
625 return Ada_95_Unit;
626 end if;
628 -- All tests failed, this is definitely an implementation unit. See if
629 -- we have an alternative name.
631 Get_Name_String (Fname);
633 if Name_Len in 11 .. 12
634 and then Name_Buffer (1 .. 2) = "s-"
635 and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
636 then
637 for J in Map_Array'Range loop
638 if (Name_Len = 12 and then
639 Name_Buffer (3 .. 8) = Map_Array (J).Fname)
640 or else
641 (Name_Len = 11 and then
642 Name_Buffer (3 .. 7) = Map_Array (J).Fname (1 .. 5))
643 then
644 Error_Msg_Strlen := Map_Array (J).Aname'Length;
645 Error_Msg_String (1 .. Error_Msg_Strlen) :=
646 Map_Array (J).Aname.all;
647 end if;
648 end loop;
649 end if;
651 return Implementation_Unit;
652 end Get_Kind_Of_Unit;
654 -------------------
655 -- Is_Known_Unit --
656 -------------------
658 function Is_Known_Unit (Nam : Node_Id) return Boolean is
659 Unam : Unit_Name_Type;
660 Fnam : File_Name_Type;
662 begin
663 -- If selector is not an identifier (e.g. it is a character literal or
664 -- some junk from a previous error), then definitely not a known unit.
666 if Nkind (Selector_Name (Nam)) /= N_Identifier then
667 return False;
668 end if;
670 -- Otherwise get corresponding file name
672 Unam := Get_Unit_Name (Nam);
673 Fnam := Get_File_Name (Unam, Subunit => False);
674 Get_Name_String (Fnam);
676 -- Remove extension from file name
678 if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then
679 Name_Len := Name_Len - 4;
680 else
681 return False;
682 end if;
684 -- Pad name to 8 characters
686 while Name_Len < 8 loop
687 Name_Len := Name_Len + 1;
688 Name_Buffer (Name_Len) := ' ';
689 end loop;
691 -- If length more than 8, definitely not a match
693 if Name_Len /= 8 then
694 return False;
695 end if;
697 -- If length is 8, search our tables
699 for J in Non_Imp_File_Names_95'Range loop
700 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
701 return True;
702 end if;
703 end loop;
705 for J in Non_Imp_File_Names_05'Range loop
706 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
707 return True;
708 end if;
709 end loop;
711 -- If not found, not known
713 return False;
715 -- A safety guard, if we get an exception during this processing then it
716 -- is most likely the result of a previous error, or a peculiar case we
717 -- have not thought of. Since this routine is only used for error message
718 -- refinement, we will just return False.
720 exception
721 when others =>
722 return False;
723 end Is_Known_Unit;
725 end Impunit;