Merged with mainline at revision 128810.
[official-gcc.git] / gcc / ada / impunit.adb
blob9680a90129557e92c06aec878ffefe29cb5c70a8
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-2007, 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 Sinfo; use Sinfo;
28 with Fname.UF; use Fname.UF;
29 with Lib; use Lib;
30 with Namet; use Namet;
31 with Uname; use Uname;
33 package body Impunit is
35 subtype File_Name_8 is String (1 .. 8);
36 type File_List is array (Nat range <>) of File_Name_8;
38 ------------------
39 -- Ada 95 Units --
40 ------------------
42 -- The following is a giant string list containing the names of all
43 -- non-implementation internal files, i.e. the complete list of files for
44 -- internal units which a program may legitimately WITH when operating in
45 -- either Ada 95 or Ada 05 mode.
47 -- Note that this list should match the list of units documented in the
48 -- "GNAT Library" section of the GNAT Reference Manual.
50 Non_Imp_File_Names_95 : constant File_List := (
52 ------------------------------------------------------
53 -- Ada Hierarchy Units from Ada-83 Reference Manual --
54 ------------------------------------------------------
56 "a-astaco", -- Ada.Asynchronous_Task_Control
57 "a-calend", -- Ada.Calendar
58 "a-chahan", -- Ada.Characters.Handling
59 "a-charac", -- Ada.Characters
60 "a-chlat1", -- Ada.Characters.Latin_1
61 "a-comlin", -- Ada.Command_Line
62 "a-decima", -- Ada.Decimal
63 "a-direio", -- Ada.Direct_IO
64 "a-dynpri", -- Ada.Dynamic_Priorities
65 "a-except", -- Ada.Exceptions
66 "a-finali", -- Ada.Finalization
67 "a-flteio", -- Ada.Float_Text_IO
68 "a-fwteio", -- Ada.Float_Wide_Text_IO
69 "a-inteio", -- Ada.Integer_Text_IO
70 "a-interr", -- Ada.Interrupts
71 "a-intnam", -- Ada.Interrupts.Names
72 "a-ioexce", -- Ada.IO_Exceptions
73 "a-iwteio", -- Ada.Integer_Wide_Text_IO
74 "a-ncelfu", -- Ada.Numerics.Complex_Elementary_Functions
75 "a-ngcefu", -- Ada.Numerics.Generic_Complex_Elementary_Functions
76 "a-ngcoty", -- Ada.Numerics.Generic_Complex_Types
77 "a-ngelfu", -- Ada.Numerics.Generic_Elementary_Functions
78 "a-nucoty", -- Ada.Numerics.Complex_Types
79 "a-nudira", -- Ada.Numerics.Discrete_Random
80 "a-nuelfu", -- Ada.Numerics.Elementary_Functions
81 "a-nuflra", -- Ada.Numerics.Float_Random
82 "a-numeri", -- Ada.Numerics
83 "a-reatim", -- Ada.Real_Time
84 "a-sequio", -- Ada.Sequential_IO
85 "a-stmaco", -- Ada.Strings.Maps.Constants
86 "a-storio", -- Ada.Storage_IO
87 "a-strbou", -- Ada.Strings.Bounded
88 "a-stream", -- Ada.Streams
89 "a-strfix", -- Ada.Strings.Fixed
90 "a-string", -- Ada.Strings
91 "a-strmap", -- Ada.Strings.Maps
92 "a-strunb", -- Ada.Strings.Unbounded
93 "a-ststio", -- Ada.Streams.Stream_IO
94 "a-stwibo", -- Ada.Strings.Wide_Bounded
95 "a-stwifi", -- Ada.Strings.Wide_Fixed
96 "a-stwima", -- Ada.Strings.Wide_Maps
97 "a-stwiun", -- Ada.Strings.Wide_Unbounded
98 "a-swmwco", -- Ada.Strings.Wide_Maps.Wide_Constants
99 "a-sytaco", -- Ada.Synchronous_Task_Control
100 "a-tags ", -- Ada.Tags
101 "a-tasatt", -- Ada.Task_Attributes
102 "a-taside", -- Ada.Task_Identification
103 "a-teioed", -- Ada.Text_IO.Editing
104 "a-textio", -- Ada.Text_IO
105 "a-ticoio", -- Ada.Text_IO.Complex_IO
106 "a-titest", -- Ada.Text_IO.Text_Streams
107 "a-unccon", -- Ada.Unchecked_Conversion
108 "a-uncdea", -- Ada.Unchecked_Deallocation
109 "a-witeio", -- Ada.Wide_Text_IO
110 "a-wtcoio", -- Ada.Wide_Text_IO.Complex_IO
111 "a-wtedit", -- Ada.Wide_Text_IO.Editing
112 "a-wttest", -- Ada.Wide_Text_IO.Text_Streams
114 -------------------------------------------------
115 -- RM Required Additions to Ada for GNAT Types --
116 -------------------------------------------------
118 "a-lfteio", -- Ada.Long_Float_Text_IO
119 "a-lfwtio", -- Ada.Long_Float_Wide_Text_IO
120 "a-liteio", -- Ada.Long_Integer_Text_IO
121 "a-liwtio", -- Ada.Long_Integer_Wide_Text_IO
122 "a-llftio", -- Ada.Long_Long_Float_Text_IO
123 "a-llfwti", -- Ada.Long_Long_Float_Wide_Text_IO
124 "a-llitio", -- Ada.Long_Long_Integer_Text_IO
125 "a-lliwti", -- Ada.Long_Long_Integer_Wide_Text_IO
126 "a-nlcefu", -- Ada.Long_Complex_Elementary_Functions
127 "a-nlcoty", -- Ada.Numerics.Long_Complex_Types
128 "a-nlelfu", -- Ada.Numerics.Long_Elementary_Functions
129 "a-nllcef", -- Ada.Long_Long_Complex_Elementary_Functions
130 "a-nllefu", -- Ada.Numerics.Long_Long_Elementary_Functions
131 "a-nllcty", -- Ada.Numerics.Long_Long_Complex_Types
132 "a-nscefu", -- Ada.Short_Complex_Elementary_Functions
133 "a-nscoty", -- Ada.Numerics.Short_Complex_Types
134 "a-nselfu", -- Ada.Numerics.Short_Elementary_Functions
135 "a-sfteio", -- Ada.Short_Float_Text_IO
136 "a-sfwtio", -- Ada.Short_Float_Wide_Text_IO
137 "a-siteio", -- Ada.Short_Integer_Text_IO
138 "a-siwtio", -- Ada.Short_Integer_Wide_Text_IO
139 "a-ssitio", -- Ada.Short_Short_Integer_Text_IO
140 "a-ssiwti", -- Ada.Short_Short_Integer_Wide_Text_IO
142 -----------------------------------
143 -- GNAT Defined Additions to Ada --
144 -----------------------------------
146 "a-chlat9", -- Ada.Characters.Latin_9
147 "a-clrefi", -- Ada.Command_Line.Response_File
148 "a-colien", -- Ada.Command_Line.Environment
149 "a-colire", -- Ada.Command_Line.Remove
150 "a-cwila1", -- Ada.Characters.Wide_Latin_1
151 "a-cwila9", -- Ada.Characters.Wide_Latin_9
152 "a-diocst", -- Ada.Direct_IO.C_Streams
153 "a-einuoc", -- Ada.Exceptions.Is_Null_Occurrence
154 "a-elchha", -- Ada.Exceptions.Last_Chance_Handler
155 "a-exctra", -- Ada.Exceptions.Traceback
156 "a-siocst", -- Ada.Sequential_IO.C_Streams
157 "a-ssicst", -- Ada.Streams.Stream_IO.C_Streams
158 "a-suteio", -- Ada.Strings.Unbounded.Text_IO
159 "a-swuwti", -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
160 "a-taidim", -- Ada.Task_Identification.Image
161 "a-tiocst", -- Ada.Text_IO.C_Streams
162 "a-wtcstr", -- Ada.Wide_Text_IO.C_Streams
164 -- Note: strictly the next two should be Ada 2005 units, but it seems
165 -- harmless (and useful) to make then available in Ada 95 mode, since
166 -- they only deal with Wide_Character, not Wide_Wide_Character.
168 "a-wichun", -- Ada.Wide_Characters.Unicode
169 "a-widcha", -- Ada.Wide_Characters
171 ---------------------------
172 -- GNAT Special IO Units --
173 ---------------------------
175 -- As further explained elsewhere (see Sem_Ch10), the internal
176 -- packages of Text_IO and Wide_Text_IO are actually implemented
177 -- as separate children, but this fact is intended to be hidden
178 -- from the user completely. Any attempt to WITH one of these
179 -- units will be diagnosed as an error later on, but for now we
180 -- do not consider these internal implementation units (if we did,
181 -- then we would get a junk warning which would be confusing and
182 -- unecessary, given that we generate a clear error message).
184 "a-tideio", -- Ada.Text_IO.Decimal_IO
185 "a-tienio", -- Ada.Text_IO.Enumeration_IO
186 "a-tifiio", -- Ada.Text_IO.Fixed_IO
187 "a-tiflio", -- Ada.Text_IO.Float_IO
188 "a-tiinio", -- Ada.Text_IO.Integer_IO
189 "a-tiinio", -- Ada.Text_IO.Integer_IO
190 "a-timoio", -- Ada.Text_IO.Modular_IO
191 "a-wtdeio", -- Ada.Wide_Text_IO.Decimal_IO
192 "a-wtenio", -- Ada.Wide_Text_IO.Enumeration_IO
193 "a-wtfiio", -- Ada.Wide_Text_IO.Fixed_IO
194 "a-wtflio", -- Ada.Wide_Text_IO.Float_IO
195 "a-wtinio", -- Ada.Wide_Text_IO.Integer_IO
196 "a-wtmoio", -- Ada.Wide_Text_IO.Modular_IO
198 ------------------------
199 -- GNAT Library Units --
200 ------------------------
202 "g-altive", -- GNAT.Altivec
203 "g-alvety", -- GNAT.Altivec.Vector_Types
204 "g-alvevi", -- GNAT.Altivec.Vector_Views
205 "g-alveop", -- GNAT.Altivec.Vector_Operations
206 "g-altcon", -- GNAT.Altivec.Conversions
207 "g-arrspl", -- GNAT.Array_Split
208 "g-awk ", -- GNAT.AWK
209 "g-boubuf", -- GNAT.Bounded_Buffers
210 "g-boumai", -- GNAT.Bounded_Mailboxes
211 "g-bubsor", -- GNAT.Bubble_Sort
212 "g-busora", -- GNAT.Bubble_Sort_A
213 "g-busorg", -- GNAT.Bubble_Sort_G
214 "g-bytswa", -- Gnat.Byte_Swapping
215 "g-calend", -- GNAT.Calendar
216 "g-casuti", -- GNAT.Case_Util
217 "g-catiio", -- GNAT.Calendar.Time_IO
218 "g-cgi ", -- GNAT.CGI
219 "g-cgicoo", -- GNAT.CGI.Cookie
220 "g-cgideb", -- GNAT.CGI.Debug
221 "g-comlin", -- GNAT.Command_Line
222 "g-comver", -- GNAT.Compiler_Version
223 "g-crc32 ", -- GNAT.CRC32
224 "g-ctrl_c", -- GNAT.Ctrl_C
225 "g-curexc", -- GNAT.Current_Exception
226 "g-debpoo", -- GNAT.Debug_Pools
227 "g-debuti", -- GNAT.Debug_Utilities
228 "g-diopit", -- GNAT.Directory_Operations.Iteration
229 "g-dirope", -- GNAT.Directory_Operations
230 "g-dynhta", -- GNAT.Dynamic_HTables
231 "g-dyntab", -- GNAT.Dynamic_Tables
232 "g-excact", -- GNAT.Exception_Actions
233 "g-except", -- GNAT.Exceptions
234 "g-exctra", -- GNAT.Exception_Traces
235 "g-expect", -- GNAT.Expect
236 "g-flocon", -- GNAT.Float_Control
237 "g-heasor", -- GNAT.Heap_Sort
238 "g-hesora", -- GNAT.Heap_Sort_A
239 "g-hesorg", -- GNAT.Heap_Sort_G
240 "g-htable", -- GNAT.Htable
241 "g-io ", -- GNAT.IO
242 "g-io_aux", -- GNAT.IO_Aux
243 "g-locfil", -- GNAT.Lock_Files
244 "g-md5 ", -- GNAT.MD5
245 "g-memdum", -- GNAT.Memory_Dump
246 "g-moreex", -- GNAT.Most_Recent_Exception
247 "g-os_lib", -- GNAT.Os_Lib
248 "g-pehage", -- GNAT.Perfect_Hash_Generators
249 "g-rannum", -- GNAT.Random_Numbers
250 "g-regexp", -- GNAT.Regexp
251 "g-regist", -- GNAT.Registry
252 "g-regpat", -- GNAT.Regpat
253 "g-semaph", -- GNAT.Semaphores
254 "g-sestin", -- GNAT.Secondary_Stack_Info
255 "g-sha1 ", -- GNAT.SHA1
256 "g-signal", -- GNAT.Signals
257 "g-socket", -- GNAT.Sockets
258 "g-souinf", -- GNAT.Source_Info
259 "g-speche", -- GNAT.Spell_Checker
260 "g-spipat", -- GNAT.Spitbol.Patterns
261 "g-spitbo", -- GNAT.Spitbol
262 "g-sptabo", -- GNAT.Spitbol.Table_Boolean
263 "g-sptain", -- GNAT.Spitbol.Table_Integer
264 "g-sptavs", -- GNAT.Spitbol.Table_Vstring
265 "g-string", -- GNAT.Strings
266 "g-strspl", -- GNAT.String_Split
267 "g-table ", -- GNAT.Table
268 "g-tasloc", -- GNAT.Task_Lock
269 "g-thread", -- GNAT.Threads
270 "g-traceb", -- GNAT.Traceback
271 "g-trasym", -- GNAT.Traceback.Symbolic
272 "g-utf_32", -- GNAT.UTF_32
273 "g-wistsp", -- GNAT.Wide_String_Split
275 -----------------------------------------------------
276 -- Interface Hierarchy Units from Reference Manual --
277 -----------------------------------------------------
279 "i-c ", -- Interfaces.C
280 "i-cobol ", -- Interfaces.Cobol
281 "i-cpoint", -- Interfaces.C.Pointers
282 "i-cstrin", -- Interfaces.C.Strings
283 "i-fortra", -- Interfaces.Fortran
285 ------------------------------------------
286 -- GNAT Defined Additions to Interfaces --
287 ------------------------------------------
289 "i-cexten", -- Interfaces.C.Extensions
290 "i-cpp ", -- Interfaces.CPP
291 "i-cstrea", -- Interfaces.C.Streams
292 "i-java ", -- Interfaces.Java
293 "i-pacdec", -- Interfaces.Packed_Decimal
294 "i-vxwoio", -- Interfaces.VxWorks.IO
295 "i-vxwork", -- Interfaces.VxWorks
297 --------------------------------------------------
298 -- System Hierarchy Units from Reference Manual --
299 --------------------------------------------------
301 "s-atacco", -- System.Address_To_Access_Conversions
302 "s-maccod", -- System.Machine_Code
303 "s-rpc ", -- System.Rpc
304 "s-stoele", -- System.Storage_Elements
305 "s-stopoo", -- System.Storage_Pools
307 --------------------------------------
308 -- GNAT Defined Additions to System --
309 --------------------------------------
311 "s-addima", -- System.Address_Image
312 "s-assert", -- System.Assertions
313 "s-memory", -- System.Memory
314 "s-os_lib", -- System.Os_Lib
315 "s-parint", -- System.Partition_Interface
316 "s-pooglo", -- System.Pool_Global
317 "s-pooloc", -- System.Pool_Local
318 "s-restri", -- System.Restrictions
319 "s-rident", -- System.Rident
320 "s-tasinf", -- System.Task_Info
321 "s-wchcnv", -- System.Wch_Cnv
322 "s-wchcon"); -- System.Wch_Con
324 --------------------
325 -- Ada 2005 Units --
326 --------------------
328 -- The following units should be used only in Ada 05 mode
330 Non_Imp_File_Names_05 : constant File_List := (
332 --------------------------------------------------------
333 -- Ada Hierarchy Units from Ada 2005 Reference Manual --
334 --------------------------------------------------------
336 "a-assert", -- Ada.Assertions
337 "a-calari", -- Ada.Calendar.Arithmetic
338 "a-calfor", -- Ada.Calendar.Formatting
339 "a-catizo", -- Ada.Calendar.Time_Zones
340 "a-cdlili", -- Ada.Containers.Doubly_Linked_Lists
341 "a-cgarso", -- Ada.Containers.Generic_Array_Sort
342 "a-cgcaso", -- Ada.Containers.Generic_Constrained_Array_Sort
343 "a-chacon", -- Ada.Characters.Conversions
344 "a-cidlli", -- Ada.Containers.Indefinite_Doubly_Linked_Lists
345 "a-cihama", -- Ada.Containers.Indefinite_Hashed_Maps
346 "a-cihase", -- Ada.Containers.Indefinite_Hashed_Sets
347 "a-ciorma", -- Ada.Containers.Indefinite_Ordered_Maps
348 "a-ciorse", -- Ada.Containers.Indefinite_Ordered_Sets
349 "a-cohama", -- Ada.Containers.Hashed_Maps
350 "a-cohase", -- Ada.Containers.Hashed_Sets
351 "a-coinve", -- Ada.Containers.Indefinite_Vectors
352 "a-contai", -- Ada.Containers
353 "a-convec", -- Ada.Containers.Vectors
354 "a-coorma", -- Ada.Containers.Ordered_Maps
355 "a-coorse", -- Ada.Containers.Ordered_Sets
356 "a-coteio", -- Ada.Complex_Text_IO
357 "a-direct", -- Ada.Directories
358 "a-diroro", -- Ada.Dispatching.Round_Robin
359 "a-dispat", -- Ada.Dispatching
360 "a-envvar", -- Ada.Environment_Variables
361 "a-exetim", -- Ada.Execution_Time
362 "a-extiti", -- Ada.Execution_Time.Timers
363 "a-rttiev", -- Ada.Real_Time.Timing_Events
364 "a-ngcoar", -- Ada.Numerics.Generic_Complex_Arrays
365 "a-ngrear", -- Ada.Numerics.Generic_Real_Arrays
366 "a-nucoar", -- Ada.Numerics.Complex_Arrays
367 "a-nurear", -- Ada.Numerics.Real_Arrays
368 "a-stboha", -- Ada.Strings.Bounded.Hash
369 "a-stfiha", -- Ada.Strings.Fixed.Hash
370 "a-strhas", -- Ada.Strings.Hash
371 "a-stunha", -- Ada.Strings.Unbounded.Hash
372 "a-stwiha", -- Ada.Strings.Wide_Hash
373 "a-stzbou", -- Ada.Strings.Wide_Wide_Bounded
374 "a-stzfix", -- Ada.Strings.Wide_Wide_Fixed
375 "a-stzhas", -- Ada.Strings.Wide_Wide_Hash
376 "a-stzmap", -- Ada.Strings.Wide_Wide_Maps
377 "a-stzunb", -- Ada.Strings.Wide_Wide_Unbounded
378 "a-swbwha", -- Ada.Strings.Wide_Bounded.Wide_Hash
379 "a-swfwha", -- Ada.Strings.Wide_Fixed.Wide_Hash
380 "a-swuwha", -- Ada.Strings.Wide_Unbounded.Wide_Hash
381 "a-szbzha", -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
382 "a-szfzha", -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
383 "a-szmzco", -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
384 "a-szuzha", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
385 "a-taster", -- Ada.Task_Termination
386 "a-tgdico", -- Ada.Tags.Generic_Dispatching_Constructor
387 "a-tiboio", -- Ada.Text_IO.Bounded_IO
388 "a-tiunio", -- Ada.Text_IO.Unbounded_IO
389 "a-wichun", -- Ada.Wide_Characters.Unicode
390 "a-wwboio", -- Ada.Wide_Text_IO.Wide_Bounded_IO
391 "a-wwunio", -- Ada.Wide_Text_IO.Wide_Unbounded_IO
392 "a-zchara", -- Ada.Wide_Wide_Characters
393 "a-ztcoio", -- Ada.Wide_Wide_Text_IO.Complex_IO
394 "a-ztedit", -- Ada.Wide_Wide_Text_IO.Editing
395 "a-zttest", -- Ada.Wide_Wide_Text_IO.Text_Streams
396 "a-ztexio", -- Ada.Wide_Wide_Text_IO
397 "a-zzboio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
398 "a-zzunio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
400 ------------------------------------------------------
401 -- RM Required Additions to Ada 2005 for GNAT Types --
402 ------------------------------------------------------
404 "a-lcteio", -- Ada.Long_Complex_Text_IO
405 "a-lfztio", -- Ada.Long_Float_Wide_Wide_Text_IO
406 "a-liztio", -- Ada.Long_Integer_Wide_Wide_Text_IO
407 "a-llctio", -- Ada.Long_Long_Complex_Text_IO
408 "a-llfzti", -- Ada.Long_Long_Float_Wide_Wide_Text_IO
409 "a-llizti", -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
410 "a-nlcoar", -- Ada.Numerics.Long_Complex_Arrays
411 "a-nllcar", -- Ada.Numerics.Long_Long_Complex_Arrays
412 "a-nllrar", -- Ada.Numerics.Long_Long_Real_Arrays
413 "a-nlrear", -- Ada.Numerics.Long_Real_Arrays
414 "a-scteio", -- Ada.Short_Complex_Text_IO
415 "a-sfztio", -- Ada.Short_Float_Wide_Wide_Text_IO
416 "a-siztio", -- Ada.Short_Integer_Wide_Wide_Text_IO
417 "a-ssizti", -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
418 "a-ztcstr", -- Ada.Wide_Wide_Text_IO.C_Streams
420 ----------------------------------------
421 -- GNAT Defined Additions to Ada 2005 --
422 ----------------------------------------
424 "a-cgaaso", -- Ada.Containers.Generic_Anonymous_Array_Sort
425 "a-chzla1", -- Ada.Characters.Wide_Wide_Latin_1
426 "a-chzla9", -- Ada.Characters.Wide_Wide_Latin_9
427 "a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
428 "a-coormu", -- Ada.Containers.Ordered_Multisets
429 "a-crdlli", -- Ada.Containers.Restricted_Doubly_Linked_Lists
430 "a-secain", -- Ada.Strings.Equal_Case_Insensitive
431 "a-shcain", -- Ada.Strings.Hash_Case_Insensitive
432 "a-slcain", -- Ada.Strings.Less_Case_Insensitive
433 "a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
434 "a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
436 ---------------------------
437 -- GNAT Special IO Units --
438 ---------------------------
440 -- See Ada 95 section for further information. These packages are for the
441 -- implementation of the Wide_Wide_Text_IO generic packages.
443 "a-ztdeio", -- Ada.Wide_Wide_Text_IO.Decimal_IO
444 "a-ztenio", -- Ada.Wide_Wide_Text_IO.Enumeration_IO
445 "a-ztfiio", -- Ada.Wide_Wide_Text_IO.Fixed_IO
446 "a-ztflio", -- Ada.Wide_Wide_Text_IO.Float_IO
447 "a-ztinio", -- Ada.Wide_Wide_Text_IO.Integer_IO
448 "a-ztmoio", -- Ada.Wide_Wide_Text_IO.Modular_IO
450 ------------------------
451 -- GNAT Library Units --
452 ------------------------
454 "g-zstspl"); -- GNAT.Wide_Wide_String_Split
456 ----------------------
457 -- Get_Kind_Of_Unit --
458 ----------------------
460 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
461 Fname : constant File_Name_Type := Unit_File_Name (U);
463 begin
464 -- If length of file name is greater than 12, not predefined.
465 -- The value 12 here is an 8 char name with extension .ads.
467 if Length_Of_Name (Fname) > 12 then
468 return Not_Predefined_Unit;
469 end if;
471 -- Otherwise test file name
473 Get_Name_String (Fname);
475 -- Not predefined if file name does not start with a- g- s- i-
477 if Name_Len < 3
478 or else Name_Buffer (2) /= '-'
479 or else (Name_Buffer (1) /= 'a'
480 and then
481 Name_Buffer (1) /= 'g'
482 and then
483 Name_Buffer (1) /= 'i'
484 and then
485 Name_Buffer (1) /= 's')
486 then
487 return Not_Predefined_Unit;
488 end if;
490 -- Not predefined if file name does not end in .ads. This can
491 -- happen when non-standard file names are being used.
493 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
494 return Not_Predefined_Unit;
495 end if;
497 -- Otherwise normalize file name to 8 characters
499 Name_Len := Name_Len - 4;
500 while Name_Len < 8 loop
501 Name_Len := Name_Len + 1;
502 Name_Buffer (Name_Len) := ' ';
503 end loop;
505 -- See if name is in 95 list
507 for J in Non_Imp_File_Names_95'Range loop
508 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
509 return Ada_95_Unit;
510 end if;
511 end loop;
513 -- See if name is in 05 list
515 for J in Non_Imp_File_Names_05'Range loop
516 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
517 return Ada_05_Unit;
518 end if;
519 end loop;
521 -- Only remaining special possibilities are children of System.RPC and
522 -- System.Garlic and special files of the form System.Aux...
524 Get_Name_String (Unit_Name (U));
526 if Name_Len > 12
527 and then Name_Buffer (1 .. 11) = "system.rpc."
528 then
529 return Ada_95_Unit;
530 end if;
532 if Name_Len > 15
533 and then Name_Buffer (1 .. 14) = "system.garlic."
534 then
535 return Ada_95_Unit;
536 end if;
538 if Name_Len > 11
539 and then Name_Buffer (1 .. 10) = "system.aux"
540 then
541 return Ada_95_Unit;
542 end if;
544 -- All tests failed, this is definitely an implementation unit
546 return Implementation_Unit;
547 end Get_Kind_Of_Unit;
549 -------------------
550 -- Is_Known_Unit --
551 -------------------
553 function Is_Known_Unit (Nam : Node_Id) return Boolean is
554 Unam : Unit_Name_Type;
555 Fnam : File_Name_Type;
557 begin
558 -- If selector is not an identifier (e.g. it is a character literal or
559 -- some junk from a previous error), then definitely not a known unit.
561 if Nkind (Selector_Name (Nam)) /= N_Identifier then
562 return False;
563 end if;
565 -- Otherwise get corresponding file name
567 Unam := Get_Unit_Name (Nam);
568 Fnam := Get_File_Name (Unam, Subunit => False);
569 Get_Name_String (Fnam);
571 -- Remove extension from file name
573 if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then
574 Name_Len := Name_Len - 4;
575 else
576 return False;
577 end if;
579 -- Pad name to 8 characters
581 while Name_Len < 8 loop
582 Name_Len := Name_Len + 1;
583 Name_Buffer (Name_Len) := ' ';
584 end loop;
586 -- If length more than 8, definitely not a match
588 if Name_Len /= 8 then
589 return False;
590 end if;
592 -- If length is 8, search our tables
594 for J in Non_Imp_File_Names_95'Range loop
595 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
596 return True;
597 end if;
598 end loop;
600 for J in Non_Imp_File_Names_05'Range loop
601 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
602 return True;
603 end if;
604 end loop;
606 -- If not found, not known
608 return False;
610 -- A safety guard, if we get an exception during this processing then it
611 -- is most likely the result of a previous error, or a peculiar case we
612 -- have not thought of. Since this routine is only used for error message
613 -- refinement, we will just return False.
615 exception
616 when others =>
617 return False;
618 end Is_Known_Unit;
620 end Impunit;