OSDN Git Service

2005-11-14 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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       --  Note: strictly the next two should be Ada 2005 units, but it seems
161       --  harmless (and useful) to make then available in Ada 95 mode, since
162       --  they only deal with Wide_Character, not Wide_Wide_Character.
163
164      "a-wichun",    -- Ada.Wide_Characters.Unicode
165      "a-widcha",    -- Ada.Wide_Characters
166
167    ---------------------------
168    -- GNAT Special IO Units --
169    ---------------------------
170
171    --  As further explained elsewhere (see Sem_Ch10), the internal
172    --  packages of Text_IO and Wide_Text_IO are actually implemented
173    --  as separate children, but this fact is intended to be hidden
174    --  from the user completely. Any attempt to WITH one of these
175    --  units will be diagnosed as an error later on, but for now we
176    --  do not consider these internal implementation units (if we did,
177    --  then we would get a junk warning which would be confusing and
178    --  unecessary, given that we generate a clear error message).
179
180      "a-tideio",    -- Ada.Text_IO.Decimal_IO
181      "a-tienio",    -- Ada.Text_IO.Enumeration_IO
182      "a-tifiio",    -- Ada.Text_IO.Fixed_IO
183      "a-tiflio",    -- Ada.Text_IO.Float_IO
184      "a-tiinio",    -- Ada.Text_IO.Integer_IO
185      "a-tiinio",    -- Ada.Text_IO.Integer_IO
186      "a-timoio",    -- Ada.Text_IO.Modular_IO
187      "a-wtdeio",    -- Ada.Wide_Text_IO.Decimal_IO
188      "a-wtenio",    -- Ada.Wide_Text_IO.Enumeration_IO
189      "a-wtfiio",    -- Ada.Wide_Text_IO.Fixed_IO
190      "a-wtflio",    -- Ada.Wide_Text_IO.Float_IO
191      "a-wtinio",    -- Ada.Wide_Text_IO.Integer_IO
192      "a-wtmoio",    -- Ada.Wide_Text_IO.Modular_IO
193
194    ------------------------
195    -- GNAT Library Units --
196    ------------------------
197
198      "g-arrspl",    -- GNAT.Array_Split
199      "g-awk   ",    -- GNAT.AWK
200      "g-boubuf",    -- GNAT.Bounded_Buffers
201      "g-boumai",    -- GNAT.Bounded_Mailboxes
202      "g-bubsor",    -- GNAT.Bubble_Sort
203      "g-busora",    -- GNAT.Bubble_Sort_A
204      "g-busorg",    -- GNAT.Bubble_Sort_G
205      "g-calend",    -- GNAT.Calendar
206      "g-casuti",    -- GNAT.Case_Util
207      "g-catiio",    -- GNAT.Calendar.Time_IO
208      "g-cgi   ",    -- GNAT.CGI
209      "g-cgicoo",    -- GNAT.CGI.Cookie
210      "g-cgideb",    -- GNAT.CGI.Debug
211      "g-comlin",    -- GNAT.Command_Line
212      "g-comver",    -- GNAT.Compiler_Version
213      "g-crc32 ",    -- GNAT.CRC32
214      "g-ctrl_c",    -- GNAT.Ctrl_C
215      "g-curexc",    -- GNAT.Current_Exception
216      "g-debpoo",    -- GNAT.Debug_Pools
217      "g-debuti",    -- GNAT.Debug_Utilities
218      "g-diopit",    -- GNAT.Directory_Operations.Iteration
219      "g-dirope",    -- GNAT.Directory_Operations
220      "g-dynhta",    -- GNAT.Dynamic_HTables
221      "g-dyntab",    -- GNAT.Dynamic_Tables
222      "g-excact",    -- GNAT.Exception_Actions
223      "g-except",    -- GNAT.Exceptions
224      "g-exctra",    -- GNAT.Exception_Traces
225      "g-expect",    -- GNAT.Expect
226      "g-flocon",    -- GNAT.Float_Control
227      "g-heasor",    -- GNAT.Heap_Sort
228      "g-hesora",    -- GNAT.Heap_Sort_A
229      "g-hesorg",    -- GNAT.Heap_Sort_G
230      "g-htable",    -- GNAT.Htable
231      "g-io    ",    -- GNAT.IO
232      "g-io_aux",    -- GNAT.IO_Aux
233      "g-locfil",    -- GNAT.Lock_Files
234      "g-md5   ",    -- GNAT.MD5
235      "g-memdum",    -- GNAT.Memory_Dump
236      "g-moreex",    -- GNAT.Most_Recent_Exception
237      "g-os_lib",    -- GNAT.Os_Lib
238      "g-pehage",    -- GNAT.Perfect_Hash_Generators
239      "g-regexp",    -- GNAT.Regexp
240      "g-regist",    -- GNAT.Registry
241      "g-regpat",    -- GNAT.Regpat
242      "g-semaph",    -- GNAT.Semaphores
243      "g-sestin",    -- GNAT.Secondary_Stack_Info
244      "g-signal",    -- GNAT.Signals
245      "g-socket",    -- GNAT.Sockets
246      "g-souinf",    -- GNAT.Source_Info
247      "g-speche",    -- GNAT.Spell_Checker
248      "g-spipat",    -- GNAT.Spitbol.Patterns
249      "g-spitbo",    -- GNAT.Spitbol
250      "g-sptabo",    -- GNAT.Spitbol.Table_Boolean
251      "g-sptain",    -- GNAT.Spitbol.Table_Integer
252      "g-sptavs",    -- GNAT.Spitbol.Table_Vstring
253      "g-string",    -- GNAT.Strings
254      "g-strspl",    -- GNAT.String_Split
255      "g-table ",    -- GNAT.Table
256      "g-tasloc",    -- GNAT.Task_Lock
257      "g-thread",    -- GNAT.Threads
258      "g-traceb",    -- GNAT.Traceback
259      "g-trasym",    -- GNAT.Traceback.Symbolic
260      "g-utf_32",    -- GNAT.UTF_32
261      "g-wistsp",    -- GNAT.Wide_String_Split
262
263    -----------------------------------------------------
264    -- Interface Hierarchy Units from Reference Manual --
265    -----------------------------------------------------
266
267      "i-c     ",    -- Interfaces.C
268      "i-cobol ",    -- Interfaces.Cobol
269      "i-cpoint",    -- Interfaces.C.Pointers
270      "i-cstrin",    -- Interfaces.C.Strings
271      "i-fortra",    -- Interfaces.Fortran
272
273    ------------------------------------------
274    -- GNAT Defined Additions to Interfaces --
275    ------------------------------------------
276
277      "i-cexten",    -- Interfaces.C.Extensions
278      "i-cpp   ",    -- Interfaces.CPP
279      "i-cstrea",    -- Interfaces.C.Streams
280      "i-jalaob",    -- Interfaces.Java.Lang.Object
281      "i-jalasy",    -- Interfaces.Java.Lang.System
282      "i-jalath",    -- Interfaces.Java.Lang.Thread
283      "i-java  ",    -- Interfaces.Java
284      "i-javlan",    -- Interfaces.Java.Lang
285      "i-os2err",    -- Interfaces.Os2lib.Errors
286      "i-os2lib",    -- Interfaces.Os2lib
287      "i-os2syn",    -- Interfaces.Os2lib.Synchronization
288      "i-os2thr",    -- Interfaces.Os2lib.Threads
289      "i-pacdec",    -- Interfaces.Packed_Decimal
290      "i-vthrea",    -- Interfaces.Vthreads
291      "i-vxwoio",    -- Interfaces.VxWorks.IO
292      "i-vxwork",    -- Interfaces.VxWorks
293
294    --------------------------------------------------
295    -- System Hierarchy Units from Reference Manual --
296    --------------------------------------------------
297
298      "s-atacco",    -- System.Address_To_Access_Conversions
299      "s-maccod",    -- System.Machine_Code
300      "s-rpc   ",    -- System.Rpc
301      "s-stoele",    -- System.Storage_Elements
302      "s-stopoo",    -- System.Storage_Pools
303
304    --------------------------------------
305    -- GNAT Defined Additions to System --
306    --------------------------------------
307
308      "s-addima",    -- System.Address_Image
309      "s-assert",    -- System.Assertions
310      "s-memory",    -- System.Memory
311      "s-parint",    -- System.Partition_Interface
312      "s-pooglo",    -- System.Pool_Global
313      "s-pooloc",    -- System.Pool_Local
314      "s-restri",    -- System.Restrictions
315      "s-rident",    -- System.Rident
316      "s-tasinf",    -- System.Task_Info
317      "s-wchcnv",    -- System.Wch_Cnv
318      "s-wchcon");   -- System.Wch_Con
319
320    --------------------
321    -- Ada 2005 Units --
322    --------------------
323
324    --  The following units should be used only in Ada 05 mode
325
326    Non_Imp_File_Names_05 : constant File_List := (
327
328    --------------------------------------------------------
329    -- Ada Hierarchy Units from Ada 2005 Reference Manual --
330    --------------------------------------------------------
331
332      "a-cdlili",    -- Ada.Containers.Doubly_Linked_Lists
333      "a-cgaaso",    -- Ada.Containers.Generic_Anonymous_Array_Sort
334      "a-cgarso",    -- Ada.Containers.Generic_Array_Sort
335      "a-cgcaso",    -- Ada.Containers.Generic_Constrained_Array_Sort
336      "a-chacon",    -- Ada.Characters.Conversions
337      "a-cidlli",    -- Ada.Containers.Indefinite_Doubly_Linked_Lists
338      "a-cihama",    -- Ada.Containers.Indefinite_Hashed_Maps
339      "a-cihase",    -- Ada.Containers.Indefinite_Hashed_Sets
340      "a-ciorma",    -- Ada.Containers.Indefinite_Ordered_Maps
341      "a-ciorse",    -- Ada.Containers.Indefinite_Ordered_Sets
342      "a-cohama",    -- Ada.Containers.Hashed_Maps
343      "a-cohase",    -- Ada.Containers.Hashed_Sets
344      "a-coinve",    -- Ada.Containers.Indefinite_Vectors
345      "a-contai",    -- Ada.Containers
346      "a-convec",    -- Ada.Containers.Vectors
347      "a-coorma",    -- Ada.Containers.Ordered_Maps
348      "a-coorse",    -- Ada.Containers.Ordered_Sets
349      "a-direct",    -- Ada.Directories
350      "a-secain",    -- Ada.Strings.Equal_Case_Insensitive
351      "a-shcain",    -- Ada.Strings.Hash_Case_Insensitive
352      "a-slcain",    -- Ada.Strings.Less_Case_Insensitive
353      "a-strhas",    -- Ada.Strings.Hash
354      "a-stunha",    -- Ada.Strings.Unbounded.Hash
355      "a-stwiha",    -- Ada.Strings.Wide_Hash
356      "a-stzbou",    -- Ada.Strings.Wide_Wide_Bounded
357      "a-stzfix",    -- Ada.Strings.Wide_Wide_Fixed
358      "a-stzhas",    -- Ada.Strings.Wide_Wide_Hash
359      "a-stzmap",    -- Ada.Strings.Wide_Wide_Maps
360      "a-stzunb",    -- Ada.Strings.Wide_Wide_Unbounded
361      "a-swuwha",    -- Ada.Strings.Wide_Unbounded.Wide_Hash
362      "a-szmzco",    -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants;
363      "a-szuzha",    -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
364      "a-tgdico",    -- Ada.Tags.Generic_Dispatching_Constructor;
365      "a-tiunio",    -- Ada.Text_IO.Unbounded_IO;
366      "a-wichun",    -- Ada.Wide_Characters.Unicode
367      "a-wwunio",    -- Ada.Wide_Text_IO.Wide_Unbounded_IO;
368      "a-zchara",    -- Ada.Wide_Wide_Characters
369      "a-zttest",    -- Ada.Wide_Wide_Text_IO.Text_Streams
370      "a-ztexio",    -- Ada.Wide_Wide_Text_IO
371      "a-zzunio",    -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
372
373    ------------------------------------------------------
374    -- RM Required Additions to Ada 2005 for GNAT Types --
375    ------------------------------------------------------
376
377      "a-lfztio",    -- Ada.Long_Float_Wide_Wide_Text_IO
378      "a-liztio",    -- Ada.Long_Integer_Wide_Wide_Text_IO
379      "a-llfzti",    -- Ada.Long_Long_Float_Wide_Wide_Text_IO
380      "a-llizti",    -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
381      "a-sfztio",    -- Ada.Short_Float_Wide_Wide_Text_IO
382      "a-siztio",    -- Ada.Short_Integer_Wide_Wide_Text_IO
383      "a-ssizti",    -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
384      "a-ztcstr",    -- Ada.Wide_Wide_Text_IO.C_Streams
385
386    ----------------------------------------
387    -- GNAT Defined Additions to Ada 2005 --
388    ----------------------------------------
389
390      "a-chzla1",    -- Ada.Characters.Wide_Wide_Latin_1
391      "a-chzla9",    -- Ada.Characters.Wide_Wide_Latin_9
392      "a-ciormu",    -- Ada.Containers.Indefinite_Ordered_Multisets
393      "a-coormu",    -- Ada.Containers.Ordered_Multisets
394      "a-szuzti",    -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
395      "a-zchuni",    -- Ada.Wide_Wide_Characters.Unicode
396
397    ---------------------------
398    -- GNAT Special IO Units --
399    ---------------------------
400
401    --  See Ada 95 section for further information. These packages are for the
402    --  implementation of the Wide_Wide_Text_IO generic packages.
403
404      "a-ztdeio",    -- Ada.Wide_Wide_Text_IO.Decimal_IO
405      "a-ztenio",    -- Ada.Wide_Wide_Text_IO.Enumeration_IO
406      "a-ztfiio",    -- Ada.Wide_Wide_Text_IO.Fixed_IO
407      "a-ztflio",    -- Ada.Wide_Wide_Text_IO.Float_IO
408      "a-ztinio",    -- Ada.Wide_Wide_Text_IO.Integer_IO
409      "a-ztmoio",    -- Ada.Wide_Wide_Text_IO.Modular_IO
410
411    ------------------------
412    -- GNAT Library Units --
413    ------------------------
414
415      "g-zstspl");   -- GNAT.Wide_Wide_String_Split
416
417    ----------------------
418    -- Get_Kind_Of_Unit --
419    ----------------------
420
421    function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
422       Fname : constant File_Name_Type := Unit_File_Name (U);
423
424    begin
425       --  If length of file name is greater than 12, not predefined.
426       --  The value 12 here is an 8 char name with extension .ads.
427
428       if Length_Of_Name (Fname) > 12 then
429          return Not_Predefined_Unit;
430       end if;
431
432       --  Otherwise test file name
433
434       Get_Name_String (Fname);
435
436       --  Not predefined if file name does not start with a- g- s- i-
437
438       if Name_Len < 3
439         or else Name_Buffer (2) /= '-'
440         or else (Name_Buffer (1) /= 'a'
441                    and then
442                  Name_Buffer (1) /= 'g'
443                    and then
444                  Name_Buffer (1) /= 'i'
445                    and then
446                  Name_Buffer (1) /= 's')
447       then
448          return Not_Predefined_Unit;
449       end if;
450
451       --  Not predefined if file name does not end in .ads. This can
452       --  happen when non-standard file names are being used.
453
454       if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
455          return Not_Predefined_Unit;
456       end if;
457
458       --  Otherwise normalize file name to 8 characters
459
460       Name_Len := Name_Len - 4;
461       while Name_Len < 8 loop
462          Name_Len := Name_Len + 1;
463          Name_Buffer (Name_Len) := ' ';
464       end loop;
465
466       --  See if name is in 95 list
467
468       for J in Non_Imp_File_Names_95'Range loop
469          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
470             return Ada_95_Unit;
471          end if;
472       end loop;
473
474       --  See if name is in 05 list
475
476       for J in Non_Imp_File_Names_05'Range loop
477          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
478             return Ada_05_Unit;
479          end if;
480       end loop;
481
482       --  Only remaining special possibilities are children of System.RPC and
483       --  System.Garlic and special files of the form System.Aux...
484
485       Get_Name_String (Unit_Name (U));
486
487       if Name_Len > 12
488         and then Name_Buffer (1 .. 11) = "system.rpc."
489       then
490          return Ada_95_Unit;
491       end if;
492
493       if Name_Len > 15
494         and then Name_Buffer (1 .. 14) = "system.garlic."
495       then
496          return Ada_95_Unit;
497       end if;
498
499       if Name_Len > 11
500         and then Name_Buffer (1 .. 10) = "system.aux"
501       then
502          return Ada_95_Unit;
503       end if;
504
505       --  All tests failed, this is definitely an implementation unit
506
507       return Implementation_Unit;
508    end Get_Kind_Of_Unit;
509
510 end Impunit;