OSDN Git Service

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