OSDN Git Service

2005-02-09 Robert Dewar <dewar@adacore.com>
[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-2005 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 2,  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 COPYING.  If not, write --
19 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 with Lib;   use Lib;
28 with Namet; use Namet;
29
30 package body Impunit is
31
32    subtype File_Name_8 is String (1 .. 8);
33    type File_List is array (Nat range <>) of File_Name_8;
34
35    ------------------
36    -- Ada 95 Units --
37    ------------------
38
39    --  The following is a giant string list containing the names of all
40    --  non-implementation internal files, i.e. the complete list of files for
41    --  internal units which a program may legitimately WITH when operating in
42    --  either Ada 95 or Ada 05 mode.
43
44    --  Note that this list should match the list of units documented in the
45    --  "GNAT Library" section of the GNAT Reference Manual.
46
47    Non_Imp_File_Names_95 : constant File_List := (
48
49    ------------------------------------------------------
50    -- Ada Hierarchy Units from Ada-83 Reference Manual --
51    ------------------------------------------------------
52
53      "a-astaco",    -- Ada.Asynchronous_Task_Control
54      "a-calend",    -- Ada.Calendar
55      "a-chahan",    -- Ada.Characters.Handling
56      "a-charac",    -- Ada.Characters
57      "a-chlat1",    -- Ada.Characters.Latin_1
58      "a-comlin",    -- Ada.Command_Line
59      "a-decima",    -- Ada.Decimal
60      "a-direio",    -- Ada.Direct_IO
61      "a-dynpri",    -- Ada.Dynamic_Priorities
62      "a-except",    -- Ada.Exceptions
63      "a-finali",    -- Ada.Finalization
64      "a-flteio",    -- Ada.Float_Text_IO
65      "a-fwteio",    -- Ada.Float_Wide_Text_IO
66      "a-inteio",    -- Ada.Integer_Text_IO
67      "a-interr",    -- Ada.Interrupts
68      "a-intnam",    -- Ada.Interrupts.Names
69      "a-ioexce",    -- Ada.IO_Exceptions
70      "a-iwteio",    -- Ada.Integer_Wide_Text_IO
71      "a-ncelfu",    -- Ada.Numerics.Complex_Elementary_Functions
72      "a-ngcefu",    -- Ada.Numerics.Generic_Complex_Elementary_Functions
73      "a-ngcoty",    -- Ada.Numerics.Generic_Complex_Types
74      "a-ngelfu",    -- Ada.Numerics.Generic_Elementary_Functions
75      "a-nucoty",    -- Ada.Numerics.Complex_Types
76      "a-nudira",    -- Ada.Numerics.Discrete_Random
77      "a-nuelfu",    -- Ada.Numerics.Elementary_Functions
78      "a-nuflra",    -- Ada.Numerics.Float_Random
79      "a-numeri",    -- Ada.Numerics
80      "a-reatim",    -- Ada.Real_Time
81      "a-sequio",    -- Ada.Sequential_IO
82      "a-stmaco",    -- Ada.Strings.Maps.Constants
83      "a-storio",    -- Ada.Storage_IO
84      "a-strbou",    -- Ada.Strings.Bounded
85      "a-stream",    -- Ada.Streams
86      "a-strfix",    -- Ada.Strings.Fixed
87      "a-string",    -- Ada.Strings
88      "a-strmap",    -- Ada.Strings.Maps
89      "a-strunb",    -- Ada.Strings.Unbounded
90      "a-ststio",    -- Ada.Streams.Stream_IO
91      "a-stwibo",    -- Ada.Strings.Wide_Bounded
92      "a-stwifi",    -- Ada.Strings.Wide_Fixed
93      "a-stwima",    -- Ada.Strings.Wide_Maps
94      "a-stwiun",    -- Ada.Strings.Wide_Unbounded
95      "a-swmwco",    -- Ada.Strings.Wide_Maps.Wide_Constants
96      "a-sytaco",    -- Ada.Synchronous_Task_Control
97      "a-tags  ",    -- Ada.Tags
98      "a-tasatt",    -- Ada.Task_Attributes
99      "a-taside",    -- Ada.Task_Identification
100      "a-teioed",    -- Ada.Text_IO.Editing
101      "a-textio",    -- Ada.Text_IO
102      "a-ticoio",    -- Ada.Text_IO.Complex_IO
103      "a-titest",    -- Ada.Text_IO.Text_Streams
104      "a-unccon",    -- Ada.Unchecked_Conversion
105      "a-uncdea",    -- Ada.Unchecked_Deallocation
106      "a-witeio",    -- Ada.Wide_Text_IO
107      "a-wtcoio",    -- Ada.Wide_Text_IO.Complex_IO
108      "a-wtedit",    -- Ada.Wide_Text_IO.Editing
109      "a-wttest",    -- Ada.Wide_Text_IO.Text_Streams
110
111    -------------------------------------------------
112    -- RM Required Additions to Ada for GNAT Types --
113    -------------------------------------------------
114
115      "a-lfteio",    -- Ada.Long_Float_Text_IO
116      "a-lfwtio",    -- Ada.Long_Float_Wide_Text_IO
117      "a-liteio",    -- Ada.Long_Integer_Text_IO
118      "a-liwtio",    -- Ada.Long_Integer_Wide_Text_IO
119      "a-llftio",    -- Ada.Long_Long_Float_Text_IO
120      "a-llfwti",    -- Ada.Long_Long_Float_Wide_Text_IO
121      "a-llitio",    -- Ada.Long_Long_Integer_Text_IO
122      "a-lliwti",    -- Ada.Long_Long_Integer_Wide_Text_IO
123      "a-nlcefu",    -- Ada.Long_Complex_Elementary_Functions
124      "a-nlcoty",    -- Ada.Numerics.Long_Complex_Types
125      "a-nlelfu",    -- Ada.Numerics.Long_Elementary_Functions
126      "a-nllcef",    -- Ada.Long_Long_Complex_Elementary_Functions
127      "a-nllefu",    -- Ada.Numerics.Long_Long_Elementary_Functions
128      "a-nllcty",    -- Ada.Numerics.Long_Long_Complex_Types
129      "a-nscefu",    -- Ada.Short_Complex_Elementary_Functions
130      "a-nscoty",    -- Ada.Numerics.Short_Complex_Types
131      "a-nselfu",    -- Ada.Numerics.Short_Elementary_Functions
132      "a-sfteio",    -- Ada.Short_Float_Text_IO
133      "a-sfwtio",    -- Ada.Short_Float_Wide_Text_IO
134      "a-siteio",    -- Ada.Short_Integer_Text_IO
135      "a-siwtio",    -- Ada.Short_Integer_Wide_Text_IO
136      "a-ssitio",    -- Ada.Short_Short_Integer_Text_IO
137      "a-ssiwti",    -- Ada.Short_Short_Integer_Wide_Text_IO
138
139    -----------------------------------
140    -- GNAT Defined Additions to Ada --
141    -----------------------------------
142
143      "a-chlat9",    -- Ada.Characters.Latin_9
144      "a-colien",    -- Ada.Command_Line.Environment
145      "a-colire",    -- Ada.Command_Line.Remove
146      "a-cwila1",    -- Ada.Characters.Wide_Latin_1
147      "a-cwila9",    -- Ada.Characters.Wide_Latin_9
148      "a-diocst",    -- Ada.Direct_IO.C_Streams
149      "a-einuoc",    -- Ada.Exceptions.Is_Null_Occurrence
150      "a-elchha",    -- Ada.Exceptions.Last_Chance_Handler
151      "a-exctra",    -- Ada.Exceptions.Traceback
152      "a-siocst",    -- Ada.Sequential_IO.C_Streams
153      "a-ssicst",    -- Ada.Streams.Stream_IO.C_Streams
154      "a-suteio",    -- Ada.Strings.Unbounded.Text_IO
155      "a-swuwti",    -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
156      "a-taidim",    -- Ada.Task_Identification.Image
157      "a-tiocst",    -- Ada.Text_IO.C_Streams
158      "a-wtcstr",    -- Ada.Wide_Text_IO.C_Streams
159
160    ---------------------------
161    -- GNAT Special IO Units --
162    ---------------------------
163
164    --  As further explained elsewhere (see Sem_Ch10), the internal
165    --  packages of Text_IO and Wide_Text_IO are actually implemented
166    --  as separate children, but this fact is intended to be hidden
167    --  from the user completely. Any attempt to WITH one of these
168    --  units will be diagnosed as an error later on, but for now we
169    --  do not consider these internal implementation units (if we did,
170    --  then we would get a junk warning which would be confusing and
171    --  unecessary, given that we generate a clear error message).
172
173      "a-tideio",    -- Ada.Text_IO.Decimal_IO
174      "a-tienio",    -- Ada.Text_IO.Enumeration_IO
175      "a-tifiio",    -- Ada.Text_IO.Fixed_IO
176      "a-tiflio",    -- Ada.Text_IO.Float_IO
177      "a-tiinio",    -- Ada.Text_IO.Integer_IO
178      "a-tiinio",    -- Ada.Text_IO.Integer_IO
179      "a-timoio",    -- Ada.Text_IO.Modular_IO
180      "a-wtdeio",    -- Ada.Wide_Text_IO.Decimal_IO
181      "a-wtenio",    -- Ada.Wide_Text_IO.Enumeration_IO
182      "a-wtfiio",    -- Ada.Wide_Text_IO.Fixed_IO
183      "a-wtflio",    -- Ada.Wide_Text_IO.Float_IO
184      "a-wtinio",    -- Ada.Wide_Text_IO.Integer_IO
185      "a-wtmoio",    -- Ada.Wide_Text_IO.Modular_IO
186
187    ------------------------
188    -- GNAT Library Units --
189    ------------------------
190
191      "g-arrspl",    -- GNAT.Array_Split
192      "g-awk   ",    -- GNAT.AWK
193      "g-boubuf",    -- GNAT.Bounded_Buffers
194      "g-boumai",    -- GNAT.Bounded_Mailboxes
195      "g-bubsor",    -- GNAT.Bubble_Sort
196      "g-busora",    -- GNAT.Bubble_Sort_A
197      "g-busorg",    -- GNAT.Bubble_Sort_G
198      "g-calend",    -- GNAT.Calendar
199      "g-casuti",    -- GNAT.Case_Util
200      "g-catiio",    -- GNAT.Calendar.Time_IO
201      "g-cgi   ",    -- GNAT.CGI
202      "g-cgicoo",    -- GNAT.CGI.Cookie
203      "g-cgideb",    -- GNAT.CGI.Debug
204      "g-comlin",    -- GNAT.Command_Line
205      "g-comver",    -- GNAT.Compiler_Version
206      "g-crc32 ",    -- GNAT.CRC32
207      "g-ctrl_c",    -- GNAT.Ctrl_C
208      "g-curexc",    -- GNAT.Current_Exception
209      "g-debpoo",    -- GNAT.Debug_Pools
210      "g-debuti",    -- GNAT.Debug_Utilities
211      "g-diopit",    -- GNAT.Directory_Operations.Iteration
212      "g-dirope",    -- GNAT.Directory_Operations
213      "g-dynhta",    -- GNAT.Dynamic_HTables
214      "g-dyntab",    -- GNAT.Dynamic_Tables
215      "g-excact",    -- GNAT.Exception_Actions
216      "g-except",    -- GNAT.Exceptions
217      "g-exctra",    -- GNAT.Exception_Traces
218      "g-expect",    -- GNAT.Expect
219      "g-flocon",    -- GNAT.Float_Control
220      "g-heasor",    -- GNAT.Heap_Sort
221      "g-hesora",    -- GNAT.Heap_Sort_A
222      "g-hesorg",    -- GNAT.Heap_Sort_G
223      "g-htable",    -- GNAT.Htable
224      "g-io    ",    -- GNAT.IO
225      "g-io_aux",    -- GNAT.IO_Aux
226      "g-locfil",    -- GNAT.Lock_Files
227      "g-md5   ",    -- GNAT.MD5
228      "g-memdum",    -- GNAT.Memory_Dump
229      "g-moreex",    -- GNAT.Most_Recent_Exception
230      "g-os_lib",    -- GNAT.Os_Lib
231      "g-pehage",    -- GNAT.Perfect_Hash_Generators
232      "g-regexp",    -- GNAT.Regexp
233      "g-regist",    -- GNAT.Registry
234      "g-regpat",    -- GNAT.Regpat
235      "g-semaph",    -- GNAT.Semaphores
236      "g-sestin",    -- GNAT.Secondary_Stack_Info
237      "g-signal",    -- GNAT.Signals
238      "g-socket",    -- GNAT.Sockets
239      "g-souinf",    -- GNAT.Source_Info
240      "g-speche",    -- GNAT.Spell_Checker
241      "g-spipat",    -- GNAT.Spitbol.Patterns
242      "g-spitbo",    -- GNAT.Spitbol
243      "g-sptabo",    -- GNAT.Spitbol.Table_Boolean
244      "g-sptain",    -- GNAT.Spitbol.Table_Integer
245      "g-sptavs",    -- GNAT.Spitbol.Table_Vstring
246      "g-string",    -- GNAT.Strings
247      "g-strspl",    -- GNAT.String_Split
248      "g-table ",    -- GNAT.Table
249      "g-tasloc",    -- GNAT.Task_Lock
250      "g-thread",    -- GNAT.Threads
251      "g-traceb",    -- GNAT.Traceback
252      "g-trasym",    -- GNAT.Traceback.Symbolic
253      "g-wistsp",    -- GNAT.Wide_String_Split
254
255    -----------------------------------------------------
256    -- Interface Hierarchy Units from Reference Manual --
257    -----------------------------------------------------
258
259      "i-c     ",    -- Interfaces.C
260      "i-cobol ",    -- Interfaces.Cobol
261      "i-cpoint",    -- Interfaces.C.Pointers
262      "i-cstrin",    -- Interfaces.C.Strings
263      "i-fortra",    -- Interfaces.Fortran
264
265    ------------------------------------------
266    -- GNAT Defined Additions to Interfaces --
267    ------------------------------------------
268
269      "i-cexten",    -- Interfaces.C.Extensions
270      "i-cpp   ",    -- Interfaces.CPP
271      "i-cstrea",    -- Interfaces.C.Streams
272      "i-jalaob",    -- Interfaces.Java.Lang.Object
273      "i-jalasy",    -- Interfaces.Java.Lang.System
274      "i-jalath",    -- Interfaces.Java.Lang.Thread
275      "i-java  ",    -- Interfaces.Java
276      "i-javlan",    -- Interfaces.Java.Lang
277      "i-os2err",    -- Interfaces.Os2lib.Errors
278      "i-os2lib",    -- Interfaces.Os2lib
279      "i-os2syn",    -- Interfaces.Os2lib.Synchronization
280      "i-os2thr",    -- Interfaces.Os2lib.Threads
281      "i-pacdec",    -- Interfaces.Packed_Decimal
282      "i-vthrea",    -- Interfaces.Vthreads
283      "i-vxwoio",    -- Interfaces.VxWorks.IO
284      "i-vxwork",    -- Interfaces.VxWorks
285
286    --------------------------------------------------
287    -- System Hierarchy Units from Reference Manual --
288    --------------------------------------------------
289
290      "s-atacco",    -- System.Address_To_Access_Conversions
291      "s-maccod",    -- System.Machine_Code
292      "s-rpc   ",    -- System.Rpc
293      "s-stoele",    -- System.Storage_Elements
294      "s-stopoo",    -- System.Storage_Pools
295
296    --------------------------------------
297    -- GNAT Defined Additions to System --
298    --------------------------------------
299
300      "s-addima",    -- System.Address_Image
301      "s-assert",    -- System.Assertions
302      "s-memory",    -- System.Memory
303      "s-parint",    -- System.Partition_Interface
304      "s-pooglo",    -- System.Pool_Global
305      "s-pooloc",    -- System.Pool_Local
306      "s-restri",    -- System.Restrictions
307      "s-rident",    -- System.Rident
308      "s-tasinf",    -- System.Task_Info
309      "s-wchcnv",    -- System.Wch_Cnv
310      "s-wchcon");   -- System.Wch_Con
311
312    --------------------
313    -- Ada 2005 Units --
314    --------------------
315
316    --  The following units should be used only in Ada 05 mode
317
318    Non_Imp_File_Names_05 : constant File_List := (
319
320    --------------------------------------------------------
321    -- Ada Hierarchy Units from Ada 2005 Reference Manual --
322    --------------------------------------------------------
323
324      "a-cdlili",    -- Ada.Containers.Doubly_Linked_Lists
325      "a-cgaaso",    -- Ada.Containers.Generic_Anonymous_Array_Sort
326      "a-cgarso",    -- Ada.Containers.Generic_Array_Sort
327      "a-cgcaso",    -- Ada.Containers.Generic_Constrained_Array_Sort
328      "a-chtgke",    -- Ada.Containers.Hash_Tables.Generic_Keys
329      "a-chtgop",    -- Ada.Containers.Hash_Tables.Generic_Operations
330      "a-cidlli",    -- Ada.Containers.Indefinite_Doubly_Linked_Lists
331      "a-cihama",    -- Ada.Containers.Indefinite_Hashed_Maps
332      "a-cihase",    -- Ada.Containers.Indefinite_Hashed_Sets
333      "a-ciorma",    -- Ada.Containers.Indefinite_Ordered_Maps
334      "a-ciormu",    -- Ada.Containers.Indefinite_Ordered_Multisets
335      "a-ciorse",    -- Ada.Containers.Indefinite_Ordered_Sets
336      "a-cohama",    -- Ada.Containers.Hashed_Maps
337      "a-cohase",    -- Ada.Containers.Hashed_Sets
338      "a-cohata",    -- Ada.Containers.Hash_Tables
339      "a-coinve",    -- Ada.Containers.Indefinite_Vectors
340      "a-contai",    -- Ada.Containers
341      "a-convec",    -- Ada.Containers.Vectors
342      "a-coorma",    -- Ada.Containers.Ordered_Maps
343      "a-coormu",    -- Ada.Containers.Ordered_Multisets
344      "a-coorse",    -- Ada.Containers.Ordered_Sets
345      "a-coprnu",    -- Ada.Containers.Prime_Numbers
346      "a-crbltr",    -- Ada.Containers.Red_Black_Trees
347      "a-crbtgk",    -- Ada.Containers.Red_Black_Trees.Generic_Keys
348      "a-crbtgo",    -- Ada.Containers.Red_Black_Trees.Generic_Operations
349      "a-direct",    -- Ada.Directories
350      "a-rbtgso",    -- Ada.Containers.Red_Black_Trees.Generic_Set_Operations
351      "a-secain",    -- Ada.Strings.Equal_Case_Insensitive
352      "a-shcain",    -- Ada.Strings.Hash_Case_Insensitive
353      "a-slcain",    -- Ada.Strings.Less_Case_Insensitive
354      "a-strhas",    -- Ada.Strings.Hash
355      "a-stunha",    -- Ada.Strings.Unbounded.Hash
356      "a-stwiha",    -- Ada.Strings.Wide_Hash
357      "a-stzbou",    -- Ada.Strings.Wide_Wide_Bounded
358      "a-stzfix",    -- Ada.Strings.Wide_Wide_Fixed
359      "a-stzhas",    -- Ada.Strings.Wide_Wide_Hash
360      "a-stzmap",    -- Ada.Strings.Wide_Wide_Maps
361      "a-stzunb",    -- Ada.Strings.Wide_Wide_Unbounded
362      "a-swunha",    -- Ada.Strings.Wide_Unbounded.Hash
363      "a-szmzco",    -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants;
364      "a-szunha",    -- Ada.Strings.Wide_Wide_Unbounded.Hash
365      "a-tiunio",    -- Ada.Text_IO.Unbounded_IO;
366      "a-wwunio",    -- Ada.Wide_Text_IO.Wide_Unbounded_IO;
367      "a-zttest",    -- Ada.Wide_Wide_Text_IO.Text_Streams
368      "a-ztexio",    -- Ada.Wide_Wide_Text_IO
369      "a-zzunio",    -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
370
371    ------------------------------------------------------
372    -- RM Required Additions to Ada 2005 for GNAT Types --
373    ------------------------------------------------------
374
375      "a-lfztio",    -- Ada.Long_Float_Wide_Wide_Text_IO
376      "a-liztio",    -- Ada.Long_Integer_Wide_Wide_Text_IO
377      "a-llfzti",    -- Ada.Long_Long_Float_Wide_Wide_Text_IO
378      "a-llizti",    -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
379      "a-sfztio",    -- Ada.Short_Float_Wide_Wide_Text_IO
380      "a-siztio",    -- Ada.Short_Integer_Wide_Wide_Text_IO
381      "a-ssizti",    -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
382      "a-ztcstr",    -- Ada.Wide_Wide_Text_IO.C_Streams
383
384    ----------------------------------------
385    -- GNAT Defined Additions to Ada 2005 --
386    ----------------------------------------
387
388      "a-chzla1",    -- Ada.Characters.Wide_Wide_Latin_1
389      "a-chzla9",    -- Ada.Characters.Wide_Wide_Latin_9
390      "a-szuzti",    -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
391
392    ---------------------------
393    -- GNAT Special IO Units --
394    ---------------------------
395
396    --  See Ada 95 section for further information. These packages are for the
397    --  implementation of the Wide_Wide_Text_IO generic packages.
398
399      "a-ztdeio",    -- Ada.Wide_Wide_Text_IO.Decimal_IO
400      "a-ztenio",    -- Ada.Wide_Wide_Text_IO.Enumeration_IO
401      "a-ztfiio",    -- Ada.Wide_Wide_Text_IO.Fixed_IO
402      "a-ztflio",    -- Ada.Wide_Wide_Text_IO.Float_IO
403      "a-ztinio",    -- Ada.Wide_Wide_Text_IO.Integer_IO
404      "a-ztmoio",    -- Ada.Wide_Wide_Text_IO.Modular_IO
405
406    ------------------------
407    -- GNAT Library Units --
408    ------------------------
409
410      "g-zstspl");   -- GNAT.Wide_Wide_String_Split
411
412    ----------------------
413    -- Get_Kind_Of_Unit --
414    ----------------------
415
416    function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
417       Fname : constant File_Name_Type := Unit_File_Name (U);
418
419    begin
420       --  If length of file name is greater than 12, not predefined.
421       --  The value 12 here is an 8 char name with extension .ads.
422
423       if Length_Of_Name (Fname) > 12 then
424          return Not_Predefined_Unit;
425       end if;
426
427       --  Otherwise test file name
428
429       Get_Name_String (Fname);
430
431       --  Not predefined if file name does not start with a- g- s- i-
432
433       if Name_Len < 3
434         or else Name_Buffer (2) /= '-'
435         or else (Name_Buffer (1) /= 'a'
436                    and then
437                  Name_Buffer (1) /= 'g'
438                    and then
439                  Name_Buffer (1) /= 'i'
440                    and then
441                  Name_Buffer (1) /= 's')
442       then
443          return Not_Predefined_Unit;
444       end if;
445
446       --  Not predefined if file name does not end in .ads. This can
447       --  happen when non-standard file names are being used.
448
449       if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
450          return Not_Predefined_Unit;
451       end if;
452
453       --  Otherwise normalize file name to 8 characters
454
455       Name_Len := Name_Len - 4;
456       while Name_Len < 8 loop
457          Name_Len := Name_Len + 1;
458          Name_Buffer (Name_Len) := ' ';
459       end loop;
460
461       --  See if name is in 95 list
462
463       for J in Non_Imp_File_Names_95'Range loop
464          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
465             return Ada_95_Unit;
466          end if;
467       end loop;
468
469       --  See if name is in 05 list
470
471       for J in Non_Imp_File_Names_05'Range loop
472          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
473             return Ada_05_Unit;
474          end if;
475       end loop;
476
477       --  Only remaining special possibilities are children of System.RPC and
478       --  System.Garlic and special files of the form System.Aux...
479
480       Get_Name_String (Unit_Name (U));
481
482       if Name_Len > 12
483         and then Name_Buffer (1 .. 11) = "system.rpc."
484       then
485          return Ada_95_Unit;
486       end if;
487
488       if Name_Len > 15
489         and then Name_Buffer (1 .. 14) = "system.garlic."
490       then
491          return Ada_95_Unit;
492       end if;
493
494       if Name_Len > 11
495         and then Name_Buffer (1 .. 10) = "system.aux"
496       then
497          return Ada_95_Unit;
498       end if;
499
500       --  All tests failed, this is definitely an implementation unit
501
502       return Implementation_Unit;
503    end Get_Kind_Of_Unit;
504
505 end Impunit;