1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2000-2021, Free Software Foundation, Inc. --
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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Atree; use Atree;
27 with Errout; use Errout;
28 with Sinfo; use Sinfo;
29 with Fname.UF; use Fname.UF;
31 with Namet; use Namet;
33 with Uname; use Uname;
35 -- Note: this package body is used by GNAT Studio and GNATBench to supply a
36 -- list of entries for help on available library routines.
38 package body Impunit is
40 subtype File_Name_8 is String (1 .. 8);
42 type File_Name_Record is record
44 -- 8 character name of unit
47 -- True if unit is RM defined. False for any unit that is implementation
48 -- defined (and thus not with'able in No_Implementation_Units mode).
51 type File_List is array (Nat range <>) of File_Name_Record;
53 T : constant Boolean := True;
54 F : constant Boolean := False;
55 -- Short hand for RM_Defined values in lists below
61 -- The following is a giant string list containing the names of all non-
62 -- implementation internal files, i.e. the complete list of files for
63 -- internal units which a program may legitimately WITH when operating in
64 -- either Ada 95 or Ada 2005 mode.
66 -- Note that this list should match the list of units documented in the
67 -- "GNAT Library" section of the GNAT Reference Manual. A unit listed here
68 -- must either be documented in that section or described in the Ada RM.
70 Non_Imp_File_Names_95 : constant File_List := (
72 ------------------------------------------------------
73 -- Ada Hierarchy Units from Ada-95 Reference Manual --
74 ------------------------------------------------------
76 ("a-astaco", T), -- Ada.Asynchronous_Task_Control
77 ("a-calend", T), -- Ada.Calendar
78 ("a-chahan", T), -- Ada.Characters.Handling
79 ("a-charac", T), -- Ada.Characters
80 ("a-chlat1", T), -- Ada.Characters.Latin_1
81 ("a-comlin", T), -- Ada.Command_Line
82 ("a-decima", T), -- Ada.Decimal
83 ("a-direio", T), -- Ada.Direct_IO
84 ("a-dynpri", T), -- Ada.Dynamic_Priorities
85 ("a-except", T), -- Ada.Exceptions
86 ("a-finali", T), -- Ada.Finalization
87 ("a-flteio", T), -- Ada.Float_Text_IO
88 ("a-fwteio", T), -- Ada.Float_Wide_Text_IO
89 ("a-inteio", T), -- Ada.Integer_Text_IO
90 ("a-interr", T), -- Ada.Interrupts
91 ("a-intnam", T), -- Ada.Interrupts.Names
92 ("a-ioexce", T), -- Ada.IO_Exceptions
93 ("a-iwteio", T), -- Ada.Integer_Wide_Text_IO
94 ("a-ncelfu", T), -- Ada.Numerics.Complex_Elementary_Functions
95 ("a-ngcefu", T), -- Ada.Numerics.Generic_Complex_Elementary_Functions
96 ("a-ngcoty", T), -- Ada.Numerics.Generic_Complex_Types
97 ("a-ngelfu", T), -- Ada.Numerics.Generic_Elementary_Functions
98 ("a-nucoty", T), -- Ada.Numerics.Complex_Types
99 ("a-nudira", T), -- Ada.Numerics.Discrete_Random
100 ("a-nuelfu", T), -- Ada.Numerics.Elementary_Functions
101 ("a-nuflra", T), -- Ada.Numerics.Float_Random
102 ("a-numeri", T), -- Ada.Numerics
103 ("a-reatim", T), -- Ada.Real_Time
104 ("a-sequio", T), -- Ada.Sequential_IO
105 ("a-stmaco", T), -- Ada.Strings.Maps.Constants
106 ("a-storio", T), -- Ada.Storage_IO
107 ("a-strbou", T), -- Ada.Strings.Bounded
108 ("a-stream", T), -- Ada.Streams
109 ("a-strfix", T), -- Ada.Strings.Fixed
110 ("a-string", T), -- Ada.Strings
111 ("a-strmap", T), -- Ada.Strings.Maps
112 ("a-strunb", T), -- Ada.Strings.Unbounded
113 ("a-ststio", T), -- Ada.Streams.Stream_IO
114 ("a-stwibo", T), -- Ada.Strings.Wide_Bounded
115 ("a-stwifi", T), -- Ada.Strings.Wide_Fixed
116 ("a-stwima", T), -- Ada.Strings.Wide_Maps
117 ("a-stwiun", T), -- Ada.Strings.Wide_Unbounded
118 ("a-swmwco", T), -- Ada.Strings.Wide_Maps.Wide_Constants
119 ("a-sytaco", T), -- Ada.Synchronous_Task_Control
120 ("a-tags ", T), -- Ada.Tags
121 ("a-tasatt", T), -- Ada.Task_Attributes
122 ("a-taside", T), -- Ada.Task_Identification
123 ("a-teioed", T), -- Ada.Text_IO.Editing
124 ("a-textio", T), -- Ada.Text_IO
125 ("a-ticoio", T), -- Ada.Text_IO.Complex_IO
126 ("a-titest", T), -- Ada.Text_IO.Text_Streams
127 ("a-unccon", T), -- Ada.Unchecked_Conversion
128 ("a-uncdea", T), -- Ada.Unchecked_Deallocation
129 ("a-witeio", T), -- Ada.Wide_Text_IO
130 ("a-wtcoio", T), -- Ada.Wide_Text_IO.Complex_IO
131 ("a-wtedit", T), -- Ada.Wide_Text_IO.Editing
132 ("a-wttest", T), -- Ada.Wide_Text_IO.Text_Streams
134 -------------------------------------------------
135 -- RM Required Additions to Ada for GNAT Types --
136 -------------------------------------------------
138 -- Note: Long versions are considered RM defined, but not the Long Long,
139 -- Short, or Short_Short versions.
141 ("a-lfteio", T), -- Ada.Long_Float_Text_IO
142 ("a-lfwtio", T), -- Ada.Long_Float_Wide_Text_IO
143 ("a-liteio", T), -- Ada.Long_Integer_Text_IO
144 ("a-liwtio", T), -- Ada.Long_Integer_Wide_Text_IO
145 ("a-llftio", T), -- Ada.Long_Long_Float_Text_IO
146 ("a-llfwti", T), -- Ada.Long_Long_Float_Wide_Text_IO
147 ("a-llitio", T), -- Ada.Long_Long_Integer_Text_IO
148 ("a-lliwti", F), -- Ada.Long_Long_Integer_Wide_Text_IO
149 ("a-llltio", T), -- Ada.Long_Long_Long_Integer_Text_IO
150 ("a-lllwti", F), -- Ada.Long_Long_Long_Integer_Wide_Text_IO
151 ("a-nlcefu", F), -- Ada.Long_Complex_Elementary_Functions
152 ("a-nlcoty", T), -- Ada.Numerics.Long_Complex_Types
153 ("a-nlelfu", T), -- Ada.Numerics.Long_Elementary_Functions
154 ("a-nllcef", F), -- Ada.Long_Long_Complex_Elementary_Functions
155 ("a-nllefu", F), -- Ada.Numerics.Long_Long_Elementary_Functions
156 ("a-nllcty", F), -- Ada.Numerics.Long_Long_Complex_Types
157 ("a-nscefu", F), -- Ada.Short_Complex_Elementary_Functions
158 ("a-nscoty", F), -- Ada.Numerics.Short_Complex_Types
159 ("a-nselfu", F), -- Ada.Numerics.Short_Elementary_Functions
160 ("a-sfteio", F), -- Ada.Short_Float_Text_IO
161 ("a-sfwtio", F), -- Ada.Short_Float_Wide_Text_IO
162 ("a-siteio", F), -- Ada.Short_Integer_Text_IO
163 ("a-siwtio", F), -- Ada.Short_Integer_Wide_Text_IO
164 ("a-ssitio", F), -- Ada.Short_Short_Integer_Text_IO
165 ("a-ssiwti", F), -- Ada.Short_Short_Integer_Wide_Text_IO
167 -----------------------------------
168 -- GNAT Defined Additions to Ada --
169 -----------------------------------
171 ("a-calcon", F), -- Ada.Calendar.Conversions
172 ("a-chlat9", F), -- Ada.Characters.Latin_9
173 ("a-clrefi", F), -- Ada.Command_Line.Response_File
174 ("a-colien", F), -- Ada.Command_Line.Environment
175 ("a-colire", F), -- Ada.Command_Line.Remove
176 ("a-cwila1", F), -- Ada.Characters.Wide_Latin_1
177 ("a-cwila9", F), -- Ada.Characters.Wide_Latin_9
178 ("a-diocst", F), -- Ada.Direct_IO.C_Streams
179 ("a-einuoc", F), -- Ada.Exceptions.Is_Null_Occurrence
180 ("a-elchha", F), -- Ada.Exceptions.Last_Chance_Handler
181 ("a-exctra", F), -- Ada.Exceptions.Traceback
182 ("a-siocst", F), -- Ada.Sequential_IO.C_Streams
183 ("a-ssicst", F), -- Ada.Streams.Stream_IO.C_Streams
184 ("a-suteio", F), -- Ada.Strings.Unbounded.Text_IO
185 ("a-swuwti", F), -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
186 ("a-tasini", F), -- Ada.Task_Initialization
187 ("a-tiocst", F), -- Ada.Text_IO.C_Streams
188 ("a-wtcstr", F), -- Ada.Wide_Text_IO.C_Streams
190 -- Note: strictly the next two should be Ada 2005 units, but it seems
191 -- harmless (and useful) to make then available in Ada 95 mode, since
192 -- they only deal with Wide_Character, not Wide_Wide_Character.
194 ("a-wichun", F), -- Ada.Wide_Characters.Unicode
195 ("a-widcha", F), -- Ada.Wide_Characters
197 -- Note: strictly the following should be Ada 2012 units, but it seems
198 -- harmless (and useful) to make then available in Ada 95 mode, since
199 -- they do not deal with Wide_Wide_Character.
201 ("a-wichha", F), -- Ada.Wide_Characters.Handling
202 ("a-stuten", F), -- Ada.Strings.UTF_Encoding
203 ("a-suenco", F), -- Ada.Strings.UTF_Encoding.Conversions
204 ("a-suenst", F), -- Ada.Strings.UTF_Encoding.Strings
205 ("a-suewst", F), -- Ada.Strings.UTF_Encoding.Wide_Strings
207 ---------------------------
208 -- GNAT Special IO Units --
209 ---------------------------
211 -- As further explained elsewhere (see Sem_Ch10), the internal packages of
212 -- Text_IO and Wide_Text_IO are actually implemented as separate children,
213 -- but this fact is intended to be hidden from the user completely. Any
214 -- attempt to WITH one of these units will be diagnosed as an error later
215 -- on, but for now we do not consider these internal implementation units
216 -- (if we did, then we would get a junk warning which would be confusing
217 -- and unnecessary, given that we generate a clear error message).
219 ("a-tideio", F), -- Ada.Text_IO.Decimal_IO
220 ("a-tienio", F), -- Ada.Text_IO.Enumeration_IO
221 ("a-tifiio", F), -- Ada.Text_IO.Fixed_IO
222 ("a-tiflio", F), -- Ada.Text_IO.Float_IO
223 ("a-tiinio", F), -- Ada.Text_IO.Integer_IO
224 ("a-timoio", F), -- Ada.Text_IO.Modular_IO
225 ("a-wtdeio", F), -- Ada.Wide_Text_IO.Decimal_IO
226 ("a-wtenio", F), -- Ada.Wide_Text_IO.Enumeration_IO
227 ("a-wtfiio", F), -- Ada.Wide_Text_IO.Fixed_IO
228 ("a-wtflio", F), -- Ada.Wide_Text_IO.Float_IO
229 ("a-wtinio", F), -- Ada.Wide_Text_IO.Integer_IO
230 ("a-wtmoio", F), -- Ada.Wide_Text_IO.Modular_IO
232 ------------------------
233 -- GNAT Library Units --
234 ------------------------
236 ("g-altive", F), -- GNAT.Altivec
237 ("g-altcon", F), -- GNAT.Altivec.Conversions
238 ("g-alveop", F), -- GNAT.Altivec.Vector_Operations
239 ("g-alvety", F), -- GNAT.Altivec.Vector_Types
240 ("g-alvevi", F), -- GNAT.Altivec.Vector_Views
241 ("g-arrspl", F), -- GNAT.Array_Split
242 ("g-awk ", F), -- GNAT.AWK
243 ("g-binenv", F), -- GNAT.Bind_Environment
244 ("g-boubuf", F), -- GNAT.Bounded_Buffers
245 ("g-boumai", F), -- GNAT.Bounded_Mailboxes
246 ("g-brapre", F), -- GNAT.Branch_Prediction
247 ("g-bubsor", F), -- GNAT.Bubble_Sort
248 ("g-busora", F), -- GNAT.Bubble_Sort_A
249 ("g-busorg", F), -- GNAT.Bubble_Sort_G
250 ("g-byorma", F), -- GNAT.Byte_Order_Mark
251 ("g-bytswa", F), -- GNAT.Byte_Swapping
252 ("g-calend", F), -- GNAT.Calendar
253 ("g-catiio", F), -- GNAT.Calendar.Time_IO
254 ("g-casuti", F), -- GNAT.Case_Util
255 ("g-cgi ", F), -- GNAT.CGI
256 ("g-cgicoo", F), -- GNAT.CGI.Cookie
257 ("g-cgideb", F), -- GNAT.CGI.Debug
258 ("g-comlin", F), -- GNAT.Command_Line
259 ("g-comver", F), -- GNAT.Compiler_Version
260 ("g-cppexc", F), -- GNAT.CPP_Exceptions
261 ("g-crc32 ", F), -- GNAT.CRC32
262 ("g-ctrl_c", F), -- GNAT.Ctrl_C
263 ("g-curexc", F), -- GNAT.Current_Exception
264 ("g-debpoo", F), -- GNAT.Debug_Pools
265 ("g-debuti", F), -- GNAT.Debug_Utilities
266 ("g-decstr", F), -- GNAT.Decode_String
267 ("g-deutst", F), -- GNAT.Decode_UTF8_String
268 ("g-dirope", F), -- GNAT.Directory_Operations
269 ("g-diopit", F), -- GNAT.Directory_Operations.Iteration
270 ("g-dynhta", F), -- GNAT.Dynamic_HTables
271 ("g-dyntab", F), -- GNAT.Dynamic_Tables
272 ("g-encstr", F), -- GNAT.Encode_String
273 ("g-enutst", F), -- GNAT.Encode_UTF8_String
274 ("g-excact", F), -- GNAT.Exception_Actions
275 ("g-except", F), -- GNAT.Exceptions
276 ("g-exctra", F), -- GNAT.Exception_Traces
277 ("g-expect", F), -- GNAT.Expect
278 ("g-exptty", F), -- GNAT.Expect.TTY
279 ("g-flocon", F), -- GNAT.Float_Control
280 ("g-forstr", F), -- GNAT.Formatted_String
281 ("g-graphs", F), -- GNAT.Graphs
282 ("g-heasor", F), -- GNAT.Heap_Sort
283 ("g-hesora", F), -- GNAT.Heap_Sort_A
284 ("g-hesorg", F), -- GNAT.Heap_Sort_G
285 ("g-htable", F), -- GNAT.Htable
286 ("g-io ", F), -- GNAT.IO
287 ("g-io_aux", F), -- GNAT.IO_Aux
288 ("g-lists ", F), -- GNAT.Lists
289 ("g-locfil", F), -- GNAT.Lock_Files
290 ("g-mbdira", F), -- GNAT.MBBS_Discrete_Random
291 ("g-mbflra", F), -- GNAT.MBBS_Float_Random
292 ("g-md5 ", F), -- GNAT.MD5
293 ("g-memdum", F), -- GNAT.Memory_Dump
294 ("g-moreex", F), -- GNAT.Most_Recent_Exception
295 ("g-os_lib", F), -- GNAT.Os_Lib
296 ("g-pehage", F), -- GNAT.Perfect_Hash_Generators
297 ("g-rannum", F), -- GNAT.Random_Numbers
298 ("g-regexp", F), -- GNAT.Regexp
299 ("g-regist", F), -- GNAT.Registry
300 ("g-regpat", F), -- GNAT.Regpat
301 ("g-rewdat", F), -- GNAT.Rewrite_Data
302 ("g-semaph", F), -- GNAT.Semaphores
303 ("g-sercom", F), -- GNAT.Serial_Communications
304 ("g-sestin", F), -- GNAT.Secondary_Stack_Info
305 ("g-sets ", F), -- GNAT.Sets
306 ("g-sha1 ", F), -- GNAT.SHA1
307 ("g-sha224", F), -- GNAT.SHA224
308 ("g-sha256", F), -- GNAT.SHA256
309 ("g-sha384", F), -- GNAT.SHA384
310 ("g-sha512", F), -- GNAT.SHA512
311 ("g-signal", F), -- GNAT.Signals
312 ("g-socket", F), -- GNAT.Sockets
313 ("g-socpol", F), -- GNAT.Sockets.Poll
314 ("g-souinf", F), -- GNAT.Source_Info
315 ("g-speche", F), -- GNAT.Spell_Checker
316 ("g-spchge", F), -- GNAT.Spell_Checker_Generic
317 ("g-spitbo", F), -- GNAT.Spitbol
318 ("g-spipat", F), -- GNAT.Spitbol.Patterns
319 ("g-sptabo", F), -- GNAT.Spitbol.Table_Boolean
320 ("g-sptain", F), -- GNAT.Spitbol.Table_Integer
321 ("g-sptavs", F), -- GNAT.Spitbol.Table_Vstring
322 ("g-strhas", F), -- GNAT.String_Hash
323 ("g-string", F), -- GNAT.Strings
324 ("g-strspl", F), -- GNAT.String_Split
325 ("g-sse ", F), -- GNAT.SSE
326 ("g-ssvety", F), -- GNAT.SSE.Vector_Types
327 ("g-table ", F), -- GNAT.Table
328 ("g-tasloc", F), -- GNAT.Task_Lock
329 ("g-tastus", F), -- GNAT.Task_Stack_Usage
330 ("g-thread", F), -- GNAT.Threads
331 ("g-timsta", F), -- GNAT.Time_Stamp
332 ("g-traceb", F), -- GNAT.Traceback
333 ("g-trasym", F), -- GNAT.Traceback.Symbolic
334 ("g-tty ", F), -- GNAT.TTY
335 ("g-utf_32", F), -- GNAT.UTF_32
336 ("g-u3spch", F), -- GNAT.UTF_32_Spelling_Checker
337 ("g-wispch", F), -- GNAT.Wide_Spelling_Checker
338 ("g-wistsp", F), -- GNAT.Wide_String_Split
340 -----------------------------------------------------
341 -- Interface Hierarchy Units from Reference Manual --
342 -----------------------------------------------------
344 ("i-c ", T), -- Interfaces.C
345 ("i-cobol ", T), -- Interfaces.Cobol
346 ("i-cpoint", T), -- Interfaces.C.Pointers
347 ("i-cstrin", T), -- Interfaces.C.Strings
348 ("i-fortra", T), -- Interfaces.Fortran
350 ------------------------------------------
351 -- GNAT Defined Additions to Interfaces --
352 ------------------------------------------
354 ("i-cexten", F), -- Interfaces.C.Extensions
355 ("i-cil ", F), -- Interfaces.CIL
356 ("i-cilobj", F), -- Interfaces.CIL.Object
357 ("i-cstrea", F), -- Interfaces.C.Streams
358 ("i-java ", F), -- Interfaces.Java
359 ("i-javjni", F), -- Interfaces.Java.JNI
360 ("i-pacdec", F), -- Interfaces.Packed_Decimal
361 ("i-vxinco", F), -- Interfaces.VxWorks.Int_Connection
362 ("i-vxwoio", F), -- Interfaces.VxWorks.IO
363 ("i-vxwork", F), -- Interfaces.VxWorks
365 --------------------------------------------------
366 -- System Hierarchy Units from Reference Manual --
367 --------------------------------------------------
369 ("s-atacco", T), -- System.Address_To_Access_Conversions
370 ("s-maccod", T), -- System.Machine_Code
371 ("s-rpc ", T), -- System.Rpc
372 ("s-stoele", T), -- System.Storage_Elements
373 ("s-stopoo", T), -- System.Storage_Pools
375 --------------------------------------
376 -- GNAT Defined Additions to System --
377 --------------------------------------
379 ("s-addima", F), -- System.Address_Image
380 ("s-atocou", F), -- System.Atomic_Counters
381 ("s-assert", F), -- System.Assertions
382 ("s-dfmkio", F), -- System.Dim.Float_Mks_IO
383 ("s-dfmopr", F), -- System.Dim.Float_Mks.Other_Prefixes
384 ("s-dgmgop", F), -- System.Dim.Generic_Mks.Generic_Other_Prefixes
385 ("s-dlmopr", F), -- System.Dim.Long_Mks.Other_Prefixes
386 ("s-diflio", F), -- System.Dim.Float_IO
387 ("s-diflmk", F), -- System.Dim.Float_Mks
388 ("s-digemk", F), -- System.Dim.Generic_Mks
389 ("s-diinio", F), -- System.Dim.Integer_IO
390 ("s-dilomk", F), -- System.Dim.Long_Mks
391 ("s-dimkio", F), -- System.Dim.Mks_IO
392 ("s-dimmks", F), -- System.Dim.Mks
393 ("s-dlmkio", F), -- System.Dim.Long_Mks_IO
394 ("s-dmotpr", F), -- System.Dim.Mks.Other_Prefixes
395 ("s-memory", F), -- System.Memory
396 ("s-parint", F), -- System.Partition_Interface
397 ("s-pooglo", F), -- System.Pool_Global
398 ("s-pooloc", F), -- System.Pool_Local
399 ("s-restri", F), -- System.Restrictions
400 ("s-rident", F), -- System.Rident
401 ("s-ststop", F), -- System.Strings.Stream_Ops
402 ("s-tasinf", F), -- System.Task_Info
403 ("s-unstyp", F), -- System.Unsigned_Types
404 ("s-wchcnv", F), -- System.WCh_Cnv
405 ("s-wchcon", F), -- System.WCh_Con
407 -- The following are strictly speaking Ada 2012 units, but we are allowed
408 -- to add children to system, so we consider them to be implementation
409 -- defined additions to System in earlier versions of Ada.
411 ("s-multip", T), -- System.Multiprocessors
412 ("s-mudido", T)); -- System.Multiprocessors.Dispatching_Domains
418 -- The following units should be used only in Ada 05 mode
420 Non_Imp_File_Names_05 : constant File_List := (
422 --------------------------------------------------------
423 -- Ada Hierarchy Units from Ada 2005 Reference Manual --
424 --------------------------------------------------------
426 ("a-assert", T), -- Ada.Assertions
427 ("a-calari", T), -- Ada.Calendar.Arithmetic
428 ("a-calfor", T), -- Ada.Calendar.Formatting
429 ("a-catizo", T), -- Ada.Calendar.Time_Zones
430 ("a-cdlili", T), -- Ada.Containers.Doubly_Linked_Lists
431 ("a-cgarso", T), -- Ada.Containers.Generic_Array_Sort
432 ("a-cgcaso", T), -- Ada.Containers.Generic_Constrained_Array_Sort
433 ("a-chacon", T), -- Ada.Characters.Conversions
434 ("a-cidlli", T), -- Ada.Containers.Indefinite_Doubly_Linked_Lists
435 ("a-cihama", T), -- Ada.Containers.Indefinite_Hashed_Maps
436 ("a-cihase", T), -- Ada.Containers.Indefinite_Hashed_Sets
437 ("a-ciorma", T), -- Ada.Containers.Indefinite_Ordered_Maps
438 ("a-ciorse", T), -- Ada.Containers.Indefinite_Ordered_Sets
439 ("a-cohama", T), -- Ada.Containers.Hashed_Maps
440 ("a-cohase", T), -- Ada.Containers.Hashed_Sets
441 ("a-coinve", T), -- Ada.Containers.Indefinite_Vectors
442 ("a-contai", T), -- Ada.Containers
443 ("a-convec", T), -- Ada.Containers.Vectors
444 ("a-coorma", T), -- Ada.Containers.Ordered_Maps
445 ("a-coorse", T), -- Ada.Containers.Ordered_Sets
446 ("a-coteio", T), -- Ada.Complex_Text_IO
447 ("a-direct", T), -- Ada.Directories
448 ("a-dinopr", T), -- Ada.Dispatching.Non_Preemptive
449 ("a-diroro", T), -- Ada.Dispatching.Round_Robin
450 ("a-disedf", T), -- Ada.Dispatching.EDF
451 ("a-dispat", T), -- Ada.Dispatching
452 ("a-envvar", T), -- Ada.Environment_Variables
453 ("a-etgrbu", T), -- Ada.Execution_Time.Group_Budgets
454 ("a-exetim", T), -- Ada.Execution_Time
455 ("a-extiti", T), -- Ada.Execution_Time.Timers
456 ("a-izteio", T), -- Ada.Integer_Wide_Wide_Text_IO
457 ("a-rttiev", T), -- Ada.Real_Time.Timing_Events
458 ("a-ngcoar", T), -- Ada.Numerics.Generic_Complex_Arrays
459 ("a-ngrear", T), -- Ada.Numerics.Generic_Real_Arrays
460 ("a-nucoar", T), -- Ada.Numerics.Complex_Arrays
461 ("a-nurear", T), -- Ada.Numerics.Real_Arrays
462 ("a-stboha", T), -- Ada.Strings.Bounded.Hash
463 ("a-stfiha", T), -- Ada.Strings.Fixed.Hash
464 ("a-strhas", T), -- Ada.Strings.Hash
465 ("a-stunha", T), -- Ada.Strings.Unbounded.Hash
466 ("a-stwiha", T), -- Ada.Strings.Wide_Hash
467 ("a-stzbou", T), -- Ada.Strings.Wide_Wide_Bounded
468 ("a-stzfix", T), -- Ada.Strings.Wide_Wide_Fixed
469 ("a-stzhas", T), -- Ada.Strings.Wide_Wide_Hash
470 ("a-stzmap", T), -- Ada.Strings.Wide_Wide_Maps
471 ("a-stzunb", T), -- Ada.Strings.Wide_Wide_Unbounded
472 ("a-swbwha", T), -- Ada.Strings.Wide_Bounded.Wide_Hash
473 ("a-swfwha", T), -- Ada.Strings.Wide_Fixed.Wide_Hash
474 ("a-swuwha", T), -- Ada.Strings.Wide_Unbounded.Wide_Hash
475 ("a-szbzha", T), -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
476 ("a-szfzha", T), -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
477 ("a-szmzco", T), -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
478 ("a-szuzha", T), -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
479 ("a-taster", T), -- Ada.Task_Termination
480 ("a-tgdico", T), -- Ada.Tags.Generic_Dispatching_Constructor
481 ("a-tiboio", T), -- Ada.Text_IO.Bounded_IO
482 ("a-tiunio", T), -- Ada.Text_IO.Unbounded_IO
483 ("a-wichun", T), -- Ada.Wide_Characters.Unicode
484 ("a-wwboio", T), -- Ada.Wide_Text_IO.Wide_Bounded_IO
485 ("a-wwunio", T), -- Ada.Wide_Text_IO.Wide_Unbounded_IO
486 ("a-zchara", T), -- Ada.Wide_Wide_Characters
487 ("a-zchhan", T), -- Ada.Wide_Wide_Characters.Handling
488 ("a-ztcoio", T), -- Ada.Wide_Wide_Text_IO.Complex_IO
489 ("a-ztedit", T), -- Ada.Wide_Wide_Text_IO.Editing
490 ("a-zttest", T), -- Ada.Wide_Wide_Text_IO.Text_Streams
491 ("a-ztexio", T), -- Ada.Wide_Wide_Text_IO
492 ("a-zzboio", T), -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
493 ("a-zzunio", T), -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
495 ------------------------------------------------------
496 -- RM Required Additions to Ada 2005 for GNAT Types --
497 ------------------------------------------------------
499 -- Note: Long versions are considered RM defined, but not the Long Long,
500 -- Short, or Short_Short versions.
502 ("a-lcteio", T), -- Ada.Long_Complex_Text_IO
503 ("a-lfztio", T), -- Ada.Long_Float_Wide_Wide_Text_IO
504 ("a-liztio", T), -- Ada.Long_Integer_Wide_Wide_Text_IO
505 ("a-llctio", T), -- Ada.Long_Long_Complex_Text_IO
506 ("a-llfzti", T), -- Ada.Long_Long_Float_Wide_Wide_Text_IO
507 ("a-llizti", T), -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
508 ("a-lllzti", T), -- Ada.Long_Long_Long_Integer_Wide_Wide_Text_IO
509 ("a-nlcoar", T), -- Ada.Numerics.Long_Complex_Arrays
510 ("a-nllcar", T), -- Ada.Numerics.Long_Long_Complex_Arrays
511 ("a-nllrar", T), -- Ada.Numerics.Long_Long_Real_Arrays
512 ("a-nlrear", T), -- Ada.Numerics.Long_Real_Arrays
513 ("a-scteio", F), -- Ada.Short_Complex_Text_IO
514 ("a-sfztio", F), -- Ada.Short_Float_Wide_Wide_Text_IO
515 ("a-siztio", F), -- Ada.Short_Integer_Wide_Wide_Text_IO
516 ("a-ssizti", F), -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
518 ----------------------------------------
519 -- GNAT Defined Additions to Ada 2005 --
520 ----------------------------------------
522 ("a-cgaaso", F), -- Ada.Containers.Generic_Anonymous_Array_Sort
523 ("a-chzla1", F), -- Ada.Characters.Wide_Wide_Latin_1
524 ("a-chzla9", F), -- Ada.Characters.Wide_Wide_Latin_9
525 ("a-ciormu", F), -- Ada.Containers.Indefinite_Ordered_Multisets
526 ("a-coormu", F), -- Ada.Containers.Ordered_Multisets
527 ("a-crdlli", F), -- Ada.Containers.Restricted_Doubly_Linked_Lists
528 ("a-szuzti", F), -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
529 ("a-zchuni", F), -- Ada.Wide_Wide_Characters.Unicode
530 ("a-ztcstr", F), -- Ada.Wide_Wide_Text_IO.C_Streams
532 -- Note: strictly the following should be Ada 2012 units, but it seems
533 -- harmless (and useful) to make then available in Ada 2005 mode.
535 ("a-cogeso", T), -- Ada.Containers.Generic_Sort
536 ("a-dhfina", T), -- Ada.Directories.Hierarchical_File_Names
537 ("a-secain", T), -- Ada.Strings.Equal_Case_Insensitive
538 ("a-shcain", T), -- Ada.Strings.Hash_Case_Insensitive
539 ("a-slcain", T), -- Ada.Strings.Less_Case_Insensitive
540 ("a-sfecin", T), -- Ada.Strings.Fixed.Equal_Case_Insensitive
541 ("a-sfhcin", T), -- Ada.Strings.Fixed.Hash_Case_Insensitive
542 ("a-sflcin", T), -- Ada.Strings.Fixed.Less_Case_Insensitive
543 ("a-sbecin", T), -- Ada.Strings.Bounded.Equal_Case_Insensitive
544 ("a-sbhcin", T), -- Ada.Strings.Bounded.Hash_Case_Insensitive
545 ("a-sblcin", T), -- Ada.Strings.Bounded.Less_Case_Insensitive
546 ("a-suecin", T), -- Ada.Strings.Unbounded.Equal_Case_Insensitive
547 ("a-suhcin", T), -- Ada.Strings.Unbounded.Hash_Case_Insensitive
548 ("a-sulcin", T), -- Ada.Strings.Unbounded.Less_Case_Insensitive
549 ("a-suezst", T), -- Ada.Strings.UTF_Encoding.Wide_Wide_Strings
551 ---------------------------
552 -- GNAT Special IO Units --
553 ---------------------------
555 -- See Ada 95 section for further information. These packages are for the
556 -- implementation of the Wide_Wide_Text_IO generic packages.
558 ("a-ztdeio", F), -- Ada.Wide_Wide_Text_IO.Decimal_IO
559 ("a-ztenio", F), -- Ada.Wide_Wide_Text_IO.Enumeration_IO
560 ("a-ztfiio", F), -- Ada.Wide_Wide_Text_IO.Fixed_IO
561 ("a-ztflio", F), -- Ada.Wide_Wide_Text_IO.Float_IO
562 ("a-ztinio", F), -- Ada.Wide_Wide_Text_IO.Integer_IO
563 ("a-ztmoio", F), -- Ada.Wide_Wide_Text_IO.Modular_IO
565 ------------------------
566 -- GNAT Library Units --
567 ------------------------
569 ("g-zspche", F), -- GNAT.Wide_Wide_Spelling_Checker
570 ("g-zstspl", F)); -- GNAT.Wide_Wide_String_Split
576 -- The following units should be used only in Ada 2012 mode
578 Non_Imp_File_Names_12 : constant File_List := (
579 ("s-stposu", T), -- System.Storage_Pools.Subpools
580 ("a-cobove", T), -- Ada.Containers.Bounded_Vectors
581 ("a-cbdlli", T), -- Ada.Containers.Bounded_Doubly_Linked_Lists
582 ("a-cborse", T), -- Ada.Containers.Bounded_Ordered_Sets
583 ("a-cborma", T), -- Ada.Containers.Bounded_Ordered_Maps
584 ("a-cbhase", T), -- Ada.Containers.Bounded_Hashed_Sets
585 ("a-cbhama", T), -- Ada.Containers.Bounded_Hashed_Maps
586 ("a-coinho", T), -- Ada.Containers.Indefinite_Holders
587 ("a-comutr", T), -- Ada.Containers.Multiway_Trees
588 ("a-cimutr", T), -- Ada.Containers.Indefinite_Multiway_Trees
589 ("a-cbmutr", T), -- Ada.Containers.Bounded_Multiway_Trees
590 ("a-csquin", T), -- Ada.Containers.Synchronized_Queue_Interfaces
591 ("a-cusyqu", T), -- Ada.Containers.Unbounded_Synchronized_Queues
592 ("a-cuprqu", T), -- Ada.Containers.Unbounded_Priority_Queues
593 ("a-cbsyqu", T), -- Ada.Containers.Bounded_Synchronized_Queues
594 ("a-cbprqu", T), -- Ada.Containers.Bounded_Priority_Queues
595 ("a-extiin", T), -- Ada.Execution_Time.Interrupts
596 ("a-iteint", T), -- Ada.Iterator_Interfaces
597 ("a-locale", T), -- Ada.Locales
598 ("a-stcoed", T), -- Ada.Synchronous_Task_Control.EDF
599 ("a-synbar", T), -- Ada.Synchronous_Barriers
600 ("a-undesu", T), -- Ada.Unchecked_Deallocate_Subpool
602 ----------------------------------------
603 -- GNAT Defined Additions to Ada 2012 --
604 ----------------------------------------
606 ("a-cfinve", F), -- Ada.Containers.Formal_Indefinite_Vectors
607 ("a-coboho", F), -- Ada.Containers.Bounded_Holders
608 ("a-cofove", F), -- Ada.Containers.Formal_Vectors
609 ("a-cofuma", F), -- Ada.Containers.Functional_Maps
610 ("a-cofuse", F), -- Ada.Containers.Functional_Sets
611 ("a-cofuve", F), -- Ada.Containers.Functional_Vectors
612 ("a-cfdlli", F), -- Ada.Containers.Formal_Doubly_Linked_Lists
613 ("a-cforse", F), -- Ada.Containers.Formal_Ordered_Sets
614 ("a-cforma", F), -- Ada.Containers.Formal_Ordered_Maps
615 ("a-cfhase", F), -- Ada.Containers.Formal_Hashed_Sets
616 ("a-cfhama", F), -- Ada.Containers.Formal_Hashed_Maps
617 ("a-cvgpso", F) -- Ada.Containers.Vectors.Generic_Parallel_Sorting from
624 -- The following units should be used only in Ada 202X mode
626 Non_Imp_File_Names_2X : constant File_List := (
627 ("a-nubinu", T), -- Ada.Numerics.Big_Numbers
628 ("a-nbnbin", T), -- Ada.Numerics.Big_Numbers.Big_Integers
629 ("a-nbnbre", T), -- Ada.Numerics.Big_Numbers.Big_Reals
630 ("s-aoinar", T), -- System.Atomic_Operations.Integer_Arithmetic
631 ("s-aomoar", T), -- System.Atomic_Operations.Modular_Arithmetic
632 ("s-aotase", T), -- System.Atomic_Operations.Test_And_Set
633 ("s-atoope", T), -- System.Atomic_Operations
634 ("s-atopex", T), -- System.Atomic_Operations.Exchange
635 ("a-stteou", T), -- Ada.Strings.Text_Output
636 ("a-stouut", T), -- Ada.Strings.Text_Output.Utils
637 ("a-stoubu", T), -- Ada.Strings.Text_Output.Buffers
638 ("a-stoufi", T), -- Ada.Strings.Text_Output.Files
639 ("a-stobfi", T), -- Ada.Strings.Text_Output.Basic_Files
640 ("a-stobbu", T), -- Ada.Strings.Text_Output.Bit_Buckets
641 ("a-stoufo", T), -- Ada.Strings.Text_Output.Formatting
642 ("a-strsto", T), -- Ada.Streams.Storage
643 ("a-ststbo", T), -- Ada.Streams.Storage.Bounded
644 ("a-ststun", T) -- Ada.Streams.Storage.Unbounded
647 -----------------------
648 -- Alternative Units --
649 -----------------------
651 -- For some implementation units, there is a unit in the GNAT library
652 -- that has identical functionality that is usable. If we have such a
653 -- case we record the appropriate Unit name in Error_Msg_String.
655 type Aunit_Record is record
656 Fname : String (1 .. 6);
657 Aname : String_Ptr_Const;
660 -- Array of alternative unit names
662 Scasuti : aliased constant String := "GNAT.Case_Util";
663 Scrc32 : aliased constant String := "GNAT.CRC32";
664 Shtable : aliased constant String := "GNAT.HTable";
665 Sos_lib : aliased constant String := "GNAT.OS_Lib";
666 Sregexp : aliased constant String := "GNAT.Regexp";
667 Sregpat : aliased constant String := "GNAT.Regpat";
668 Sstring : aliased constant String := "GNAT.Strings";
669 Sstusta : aliased constant String := "GNAT.Task_Stack_Usage";
670 Stasloc : aliased constant String := "GNAT.Task_Lock";
671 Sutf_32 : aliased constant String := "GNAT.UTF_32";
673 -- Array giving mapping
675 Map_Array : constant array (1 .. 10) of Aunit_Record := (
676 ("casuti", Scasuti'Access),
677 ("crc32 ", Scrc32 'Access),
678 ("htable", Shtable'Access),
679 ("os_lib", Sos_lib'Access),
680 ("regexp", Sregexp'Access),
681 ("regpat", Sregpat'Access),
682 ("string", Sstring'Access),
683 ("stusta", Sstusta'Access),
684 ("tasloc", Stasloc'Access),
685 ("utf_32", Sutf_32'Access));
687 ----------------------
688 -- Get_Kind_Of_File --
689 ----------------------
691 function Get_Kind_Of_File (File : String) return Kind_Of_Unit is
692 pragma Assert (File'First = 1);
694 Buffer : String (1 .. 9);
697 Error_Msg_Strlen := 0;
699 -- Ada/System/Interfaces are all Ada 95 units
702 or else File = "interfac.ads"
703 or else File = "system.ads"
708 -- Not predefined if file name does not start with a- g- s- i-
711 or else File (2) /= '-'
714 and then File (1) /= 'g'
715 and then File (1) /= 'i'
716 and then File (1) /= 's')
718 return Not_Predefined_Unit;
721 -- If length of file name is greater than 12, not predefined. The value
722 -- 12 here is an 8 char name with extension .ads. The exception of 13 is
723 -- for the implementation units of the 128-bit types under System.
726 and then not (File'Length = 13 and then File (1) = 's')
728 return Not_Predefined_Unit;
731 -- Not predefined if file name does not end in .ads. This can happen
732 -- when non-standard file names are being used.
734 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
735 return Not_Predefined_Unit;
738 -- Otherwise normalize file name to 8 characters
740 Buffer (1 .. File'Length - 4) := File (1 .. File'Length - 4);
742 for J in File'Length - 3 .. 8 loop
746 -- See if name is in 95 list
748 for J in Non_Imp_File_Names_95'Range loop
749 if Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
754 -- See if name is in 2005 list
756 for J in Non_Imp_File_Names_05'Range loop
757 if Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
758 return Ada_2005_Unit;
762 -- See if name is in 2012 list
764 for J in Non_Imp_File_Names_12'Range loop
765 if Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
766 return Ada_2012_Unit;
770 -- See if name is in 202X list
772 for J in Non_Imp_File_Names_2X'Range loop
773 if Buffer (1 .. 8) = Non_Imp_File_Names_2X (J).Fname then
774 return Ada_202X_Unit;
778 -- Only remaining special possibilities are children of System.RPC and
779 -- System.Garlic and special files of the form System.Aux...
781 if File (1 .. 5) = "s-aux"
782 or else File (1 .. 5) = "s-gar"
783 or else File (1 .. 5) = "s-rpc"
788 -- All tests failed, this is definitely an implementation unit. See if
789 -- we have an alternative name.
791 if File'Length in 11 .. 12
792 and then File (1 .. 2) = "s-"
793 and then File (File'Last - 3 .. File'Last) = ".ads"
795 for J in Map_Array'Range loop
796 if (File'Length = 12 and then
797 File (3 .. 8) = Map_Array (J).Fname)
799 (File'Length = 11 and then
800 File (3 .. 7) = Map_Array (J).Fname (1 .. 5))
802 Error_Msg_Strlen := Map_Array (J).Aname'Length;
803 Error_Msg_String (1 .. Error_Msg_Strlen) :=
804 Map_Array (J).Aname.all;
809 return Implementation_Unit;
810 end Get_Kind_Of_File;
812 ----------------------
813 -- Get_Kind_Of_Unit --
814 ----------------------
816 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
818 Get_Name_String (Unit_File_Name (U));
819 return Get_Kind_Of_File (Name_Buffer (1 .. Name_Len));
820 end Get_Kind_Of_Unit;
826 function Is_Known_Unit (Nam : Node_Id) return Boolean is
827 Unam : Unit_Name_Type;
828 Fnam : File_Name_Type;
831 -- If selector is not an identifier (e.g. it is a character literal or
832 -- some junk from a previous error), then definitely not a known unit.
834 if Nkind (Selector_Name (Nam)) /= N_Identifier then
838 -- Otherwise get corresponding file name
840 Unam := Get_Unit_Name (Nam);
841 Fnam := Get_File_Name (Unam, Subunit => False);
842 Get_Name_String (Fnam);
844 Error_Msg_Strlen := 0;
846 -- Ada/System/Interfaces are all Ada 95 units
848 if (Name_Len = 7 and then Name_Buffer (1 .. 7) = "ada.ads")
850 (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
852 (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
857 -- Remove extension from file name
859 if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb"
861 Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
863 Name_Len := Name_Len - 4;
868 -- Pad name to 8 characters
870 while Name_Len < 8 loop
871 Name_Len := Name_Len + 1;
872 Name_Buffer (Name_Len) := ' ';
875 -- If length more than 8, definitely not a match
877 if Name_Len /= 8 then
881 -- If length is 8, search our tables
883 for J in Non_Imp_File_Names_95'Range loop
884 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
889 for J in Non_Imp_File_Names_05'Range loop
890 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
895 for J in Non_Imp_File_Names_12'Range loop
896 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
901 -- If not found, not known
905 -- A safety guard, if we get an exception during this processing then it
906 -- is most likely the result of a previous error, or a peculiar case we
907 -- have not thought of. Since this routine is only used for error message
908 -- refinement, we will just return False.
915 ---------------------------
916 -- Not_Impl_Defined_Unit --
917 ---------------------------
919 function Not_Impl_Defined_Unit (U : Unit_Number_Type) return Boolean is
920 Fname : constant File_Name_Type := Unit_File_Name (U);
923 Error_Msg_Strlen := 0;
924 Get_Name_String (Fname);
926 -- Ada/System/Interfaces are all RM-defined Ada 95 units
928 if (Name_Len = 7 and then Name_Buffer (1 .. 7) = "ada.ads")
930 (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
932 (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
937 -- Implementation defined if unit in the gnat hierarchy
939 if (Name_Len = 8 and then Name_Buffer (1 .. 8) = "gnat.ads")
940 or else (Name_Len > 2 and then Name_Buffer (1 .. 2) = "g-")
945 -- Not implementation defined if file name does not start with a- s- i-
948 or else Name_Buffer (2) /= '-'
949 or else (Name_Buffer (1) /= 'a'
951 Name_Buffer (1) /= 'i'
953 Name_Buffer (1) /= 's')
958 -- If length of file name is greater than 12, not predefined. The value
959 -- 12 here is an 8 char name with extension .ads. The exception of 13 is
960 -- for the implementation units of the 128-bit types under System.
963 and then not (Name_Len = 13 and then Name_Buffer (1) = 's')
968 -- Not impl-defined if file name does not end in .ads. This can happen
969 -- when non-standard file names are being used.
971 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
975 -- Otherwise normalize file name to 8 characters
977 Name_Len := Name_Len - 4;
978 while Name_Len < 8 loop
979 Name_Len := Name_Len + 1;
980 Name_Buffer (Name_Len) := ' ';
983 -- Check our lists of names, if we find a match, return corresponding
984 -- indication of whether the file is RM defined, respecting the RM
985 -- version in which it is defined.
987 for J in Non_Imp_File_Names_95'Range loop
988 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
989 return Non_Imp_File_Names_95 (J).RMdef;
993 for J in Non_Imp_File_Names_05'Range loop
994 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
995 return Non_Imp_File_Names_05 (J).RMdef
996 and then Ada_Version >= Ada_2005;
1000 for J in Non_Imp_File_Names_12'Range loop
1001 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
1002 return Non_Imp_File_Names_12 (J).RMdef
1003 and then Ada_Version >= Ada_2012;
1007 -- If unit is in System, Ada or Interfaces hierarchies and did not match
1008 -- any entry in the list, means it is an internal implementation defined
1009 -- unit which the restriction should definition forbid.
1012 end Not_Impl_Defined_Unit;