aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/ada/impunit.adb
blob: 6b6b45febaaf4d737be68795554d431de1828493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT COMPILER COMPONENTS                         --
--                                                                          --
--                              I M P U N I T                               --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--           Copyright (C) 2000-2013, Free Software Foundation, Inc.        --
--                                                                          --
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license.          --
--                                                                          --
-- GNAT was originally developed  by the GNAT team at  New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
--                                                                          --
------------------------------------------------------------------------------

with Atree;    use Atree;
with Errout;   use Errout;
with Sinfo;    use Sinfo;
with Fname.UF; use Fname.UF;
with Lib;      use Lib;
with Namet;    use Namet;
with Opt;      use Opt;
with Uname;    use Uname;

--  Note: this package body is used by GPS and GNATBench to supply a list of
--  entries for help on available library routines.

package body Impunit is

   subtype File_Name_8 is String (1 .. 8);

   type File_Name_Record is record
      Fname : File_Name_8;
      --  8 character name of unit

      RMdef : Boolean;
      --  True if unit is RM defined. False for any unit that is implementation
      --  defined (and thus not with'able in No_Implementation_Units mode).
   end record;

   type File_List is array (Nat range <>) of File_Name_Record;

   T : constant Boolean := True;
   F : constant Boolean := False;
   --  Short hand for RM_Defined values in lists below

   ------------------
   -- Ada 95 Units --
   ------------------

   --  The following is a giant string list containing the names of all non-
   --  implementation internal files, i.e. the complete list of files for
   --  internal units which a program may legitimately WITH when operating in
   --  either Ada 95 or Ada 2005 mode.

   --  Note that this list should match the list of units documented in the
   --  "GNAT Library" section of the GNAT Reference Manual. A unit listed here
   --  must either be documented in that section or described in the Ada RM.

   Non_Imp_File_Names_95 : constant File_List := (

   ------------------------------------------------------
   -- Ada Hierarchy Units from Ada-95 Reference Manual --
   ------------------------------------------------------

    ("a-astaco", T),  -- Ada.Asynchronous_Task_Control
    ("a-calend", T),  -- Ada.Calendar
    ("a-chahan", T),  -- Ada.Characters.Handling
    ("a-charac", T),  -- Ada.Characters
    ("a-chlat1", T),  -- Ada.Characters.Latin_1
    ("a-comlin", T),  -- Ada.Command_Line
    ("a-decima", T),  -- Ada.Decimal
    ("a-direio", T),  -- Ada.Direct_IO
    ("a-dynpri", T),  -- Ada.Dynamic_Priorities
    ("a-except", T),  -- Ada.Exceptions
    ("a-finali", T),  -- Ada.Finalization
    ("a-flteio", T),  -- Ada.Float_Text_IO
    ("a-fwteio", T),  -- Ada.Float_Wide_Text_IO
    ("a-inteio", T),  -- Ada.Integer_Text_IO
    ("a-interr", T),  -- Ada.Interrupts
    ("a-intnam", T),  -- Ada.Interrupts.Names
    ("a-ioexce", T),  -- Ada.IO_Exceptions
    ("a-iwteio", T),  -- Ada.Integer_Wide_Text_IO
    ("a-ncelfu", T),  -- Ada.Numerics.Complex_Elementary_Functions
    ("a-ngcefu", T),  -- Ada.Numerics.Generic_Complex_Elementary_Functions
    ("a-ngcoty", T),  -- Ada.Numerics.Generic_Complex_Types
    ("a-ngelfu", T),  -- Ada.Numerics.Generic_Elementary_Functions
    ("a-nucoty", T),  -- Ada.Numerics.Complex_Types
    ("a-nudira", T),  -- Ada.Numerics.Discrete_Random
    ("a-nuelfu", T),  -- Ada.Numerics.Elementary_Functions
    ("a-nuflra", T),  -- Ada.Numerics.Float_Random
    ("a-numeri", T),  -- Ada.Numerics
    ("a-reatim", T),  -- Ada.Real_Time
    ("a-sequio", T),  -- Ada.Sequential_IO
    ("a-stmaco", T),  -- Ada.Strings.Maps.Constants
    ("a-storio", T),  -- Ada.Storage_IO
    ("a-strbou", T),  -- Ada.Strings.Bounded
    ("a-stream", T),  -- Ada.Streams
    ("a-strfix", T),  -- Ada.Strings.Fixed
    ("a-string", T),  -- Ada.Strings
    ("a-strmap", T),  -- Ada.Strings.Maps
    ("a-strunb", T),  -- Ada.Strings.Unbounded
    ("a-ststio", T),  -- Ada.Streams.Stream_IO
    ("a-stwibo", T),  -- Ada.Strings.Wide_Bounded
    ("a-stwifi", T),  -- Ada.Strings.Wide_Fixed
    ("a-stwima", T),  -- Ada.Strings.Wide_Maps
    ("a-stwiun", T),  -- Ada.Strings.Wide_Unbounded
    ("a-swmwco", T),  -- Ada.Strings.Wide_Maps.Wide_Constants
    ("a-sytaco", T),  -- Ada.Synchronous_Task_Control
    ("a-tags  ", T),  -- Ada.Tags
    ("a-tasatt", T),  -- Ada.Task_Attributes
    ("a-taside", T),  -- Ada.Task_Identification
    ("a-teioed", T),  -- Ada.Text_IO.Editing
    ("a-textio", T),  -- Ada.Text_IO
    ("a-ticoio", T),  -- Ada.Text_IO.Complex_IO
    ("a-titest", T),  -- Ada.Text_IO.Text_Streams
    ("a-unccon", T),  -- Ada.Unchecked_Conversion
    ("a-uncdea", T),  -- Ada.Unchecked_Deallocation
    ("a-witeio", T),  -- Ada.Wide_Text_IO
    ("a-wtcoio", T),  -- Ada.Wide_Text_IO.Complex_IO
    ("a-wtedit", T),  -- Ada.Wide_Text_IO.Editing
    ("a-wttest", T),  -- Ada.Wide_Text_IO.Text_Streams

   -------------------------------------------------
   -- RM Required Additions to Ada for GNAT Types --
   -------------------------------------------------

   --  Note: Long versions are considered RM defined, but not the Long Long,
   --  Short, or Short_Short versions.

    ("a-lfteio", T),  -- Ada.Long_Float_Text_IO
    ("a-lfwtio", T),  -- Ada.Long_Float_Wide_Text_IO
    ("a-liteio", T),  -- Ada.Long_Integer_Text_IO
    ("a-liwtio", T),  -- Ada.Long_Integer_Wide_Text_IO
    ("a-llftio", T),  -- Ada.Long_Long_Float_Text_IO
    ("a-llfwti", T),  -- Ada.Long_Long_Float_Wide_Text_IO
    ("a-llitio", T),  -- Ada.Long_Long_Integer_Text_IO
    ("a-lliwti", F),  -- Ada.Long_Long_Integer_Wide_Text_IO
    ("a-nlcefu", F),  -- Ada.Long_Complex_Elementary_Functions
    ("a-nlcoty", T),  -- Ada.Numerics.Long_Complex_Types
    ("a-nlelfu", T),  -- Ada.Numerics.Long_Elementary_Functions
    ("a-nllcef", F),  -- Ada.Long_Long_Complex_Elementary_Functions
    ("a-nllefu", F),  -- Ada.Numerics.Long_Long_Elementary_Functions
    ("a-nllcty", F),  -- Ada.Numerics.Long_Long_Complex_Types
    ("a-nscefu", F),  -- Ada.Short_Complex_Elementary_Functions
    ("a-nscoty", F),  -- Ada.Numerics.Short_Complex_Types
    ("a-nselfu", F),  -- Ada.Numerics.Short_Elementary_Functions
    ("a-sfteio", F),  -- Ada.Short_Float_Text_IO
    ("a-sfwtio", F),  -- Ada.Short_Float_Wide_Text_IO
    ("a-siteio", F),  -- Ada.Short_Integer_Text_IO
    ("a-siwtio", F),  -- Ada.Short_Integer_Wide_Text_IO
    ("a-ssitio", F),  -- Ada.Short_Short_Integer_Text_IO
    ("a-ssiwti", F),  -- Ada.Short_Short_Integer_Wide_Text_IO

   -----------------------------------
   -- GNAT Defined Additions to Ada --
   -----------------------------------

    ("a-calcon", F),  -- Ada.Calendar.Conversions
    ("a-chlat9", F),  -- Ada.Characters.Latin_9
    ("a-clrefi", F),  -- Ada.Command_Line.Response_File
    ("a-colien", F),  -- Ada.Command_Line.Environment
    ("a-colire", F),  -- Ada.Command_Line.Remove
    ("a-cwila1", F),  -- Ada.Characters.Wide_Latin_1
    ("a-cwila9", F),  -- Ada.Characters.Wide_Latin_9
    ("a-diocst", F),  -- Ada.Direct_IO.C_Streams
    ("a-einuoc", F),  -- Ada.Exceptions.Is_Null_Occurrence
    ("a-elchha", F),  -- Ada.Exceptions.Last_Chance_Handler
    ("a-exctra", F),  -- Ada.Exceptions.Traceback
    ("a-siocst", F),  -- Ada.Sequential_IO.C_Streams
    ("a-ssicst", F),  -- Ada.Streams.Stream_IO.C_Streams
    ("a-suteio", F),  -- Ada.Strings.Unbounded.Text_IO
    ("a-swuwti", F),  -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
    ("a-tiocst", F),  -- Ada.Text_IO.C_Streams
    ("a-wtcstr", F),  -- Ada.Wide_Text_IO.C_Streams

      --  Note: strictly the next two should be Ada 2005 units, but it seems
      --  harmless (and useful) to make then available in Ada 95 mode, since
      --  they only deal with Wide_Character, not Wide_Wide_Character.

    ("a-wichun", F),  -- Ada.Wide_Characters.Unicode
    ("a-widcha", F),  -- Ada.Wide_Characters

      --  Note: strictly the following should be Ada 2012 units, but it seems
      --  harmless (and useful) to make then available in Ada 95 mode, since
      --  they do not deal with Wide_Wide_Character.

    ("a-wichha", F),  -- Ada.Wide_Characters.Handling
    ("a-stuten", F),  -- Ada.Strings.UTF_Encoding
    ("a-suenco", F),  -- Ada.Strings.UTF_Encoding.Conversions
    ("a-suenst", F),  -- Ada.Strings.UTF_Encoding.Strings
    ("a-suewst", F),  -- Ada.Strings.UTF_Encoding.Wide_Strings

   ---------------------------
   -- GNAT Special IO Units --
   ---------------------------

   --  As further explained elsewhere (see Sem_Ch10), the internal packages of
   --  Text_IO and Wide_Text_IO are actually implemented as separate children,
   --  but this fact is intended to be hidden from the user completely. Any
   --  attempt to WITH one of these units will be diagnosed as an error later
   --  on, but for now we do not consider these internal implementation units
   --  (if we did, then we would get a junk warning which would be confusing
   --  and unnecessary, given that we generate a clear error message).

    ("a-tideio", F),  -- Ada.Text_IO.Decimal_IO
    ("a-tienio", F),  -- Ada.Text_IO.Enumeration_IO
    ("a-tifiio", F),  -- Ada.Text_IO.Fixed_IO
    ("a-tiflio", F),  -- Ada.Text_IO.Float_IO
    ("a-tiinio", F),  -- Ada.Text_IO.Integer_IO
    ("a-tiinio", F),  -- Ada.Text_IO.Integer_IO
    ("a-timoio", F),  -- Ada.Text_IO.Modular_IO
    ("a-wtdeio", F),  -- Ada.Wide_Text_IO.Decimal_IO
    ("a-wtenio", F),  -- Ada.Wide_Text_IO.Enumeration_IO
    ("a-wtfiio", F),  -- Ada.Wide_Text_IO.Fixed_IO
    ("a-wtflio", F),  -- Ada.Wide_Text_IO.Float_IO
    ("a-wtinio", F),  -- Ada.Wide_Text_IO.Integer_IO
    ("a-wtmoio", F),  -- Ada.Wide_Text_IO.Modular_IO

   ------------------------
   -- GNAT Library Units --
   ------------------------

    ("g-altive", F),  -- GNAT.Altivec
    ("g-altcon", F),  -- GNAT.Altivec.Conversions
    ("g-alveop", F),  -- GNAT.Altivec.Vector_Operations
    ("g-alvety", F),  -- GNAT.Altivec.Vector_Types
    ("g-alvevi", F),  -- GNAT.Altivec.Vector_Views
    ("g-arrspl", F),  -- GNAT.Array_Split
    ("g-awk   ", F),  -- GNAT.AWK
    ("g-boubuf", F),  -- GNAT.Bounded_Buffers
    ("g-boumai", F),  -- GNAT.Bounded_Mailboxes
    ("g-bubsor", F),  -- GNAT.Bubble_Sort
    ("g-busora", F),  -- GNAT.Bubble_Sort_A
    ("g-busorg", F),  -- GNAT.Bubble_Sort_G
    ("g-byorma", F),  -- GNAT.Byte_Order_Mark
    ("g-bytswa", F),  -- GNAT.Byte_Swapping
    ("g-calend", F),  -- GNAT.Calendar
    ("g-catiio", F),  -- GNAT.Calendar.Time_IO
    ("g-casuti", F),  -- GNAT.Case_Util
    ("g-cgi   ", F),  -- GNAT.CGI
    ("g-cgicoo", F),  -- GNAT.CGI.Cookie
    ("g-cgideb", F),  -- GNAT.CGI.Debug
    ("g-comlin", F),  -- GNAT.Command_Line
    ("g-comver", F),  -- GNAT.Compiler_Version
    ("g-cppexc", F),  -- GNAT.CPP_Exceptions
    ("g-crc32 ", F),  -- GNAT.CRC32
    ("g-ctrl_c", F),  -- GNAT.Ctrl_C
    ("g-curexc", F),  -- GNAT.Current_Exception
    ("g-debpoo", F),  -- GNAT.Debug_Pools
    ("g-debuti", F),  -- GNAT.Debug_Utilities
    ("g-decstr", F),  -- GNAT.Decode_String
    ("g-deutst", F),  -- GNAT.Decode_UTF8_String
    ("g-dirope", F),  -- GNAT.Directory_Operations
    ("g-diopit", F),  -- GNAT.Directory_Operations.Iteration
    ("g-dynhta", F),  -- GNAT.Dynamic_HTables
    ("g-dyntab", F),  -- GNAT.Dynamic_Tables
    ("g-encstr", F),  -- GNAT.Encode_String
    ("g-enutst", F),  -- GNAT.Encode_UTF8_String
    ("g-excact", F),  -- GNAT.Exception_Actions
    ("g-except", F),  -- GNAT.Exceptions
    ("g-exctra", F),  -- GNAT.Exception_Traces
    ("g-expect", F),  -- GNAT.Expect
    ("g-exptty", F),  -- GNAT.Expect.TTY
    ("g-flocon", F),  -- GNAT.Float_Control
    ("g-heasor", F),  -- GNAT.Heap_Sort
    ("g-hesora", F),  -- GNAT.Heap_Sort_A
    ("g-hesorg", F),  -- GNAT.Heap_Sort_G
    ("g-htable", F),  -- GNAT.Htable
    ("g-io    ", F),  -- GNAT.IO
    ("g-io_aux", F),  -- GNAT.IO_Aux
    ("g-locfil", F),  -- GNAT.Lock_Files
    ("g-mbdira", F),  -- GNAT.MBBS_Discrete_Random
    ("g-mbflra", F),  -- GNAT.MBBS_Float_Random
    ("g-md5   ", F),  -- GNAT.MD5
    ("g-memdum", F),  -- GNAT.Memory_Dump
    ("g-moreex", F),  -- GNAT.Most_Recent_Exception
    ("g-os_lib", F),  -- GNAT.Os_Lib
    ("g-pehage", F),  -- GNAT.Perfect_Hash_Generators
    ("g-rannum", F),  -- GNAT.Random_Numbers
    ("g-regexp", F),  -- GNAT.Regexp
    ("g-regist", F),  -- GNAT.Registry
    ("g-regpat", F),  -- GNAT.Regpat
    ("g-semaph", F),  -- GNAT.Semaphores
    ("g-sercom", F),  -- GNAT.Serial_Communications
    ("g-sestin", F),  -- GNAT.Secondary_Stack_Info
    ("g-sha1  ", F),  -- GNAT.SHA1
    ("g-sha224", F),  -- GNAT.SHA224
    ("g-sha256", F),  -- GNAT.SHA256
    ("g-sha384", F),  -- GNAT.SHA384
    ("g-sha512", F),  -- GNAT.SHA512
    ("g-signal", F),  -- GNAT.Signals
    ("g-socket", F),  -- GNAT.Sockets
    ("g-souinf", F),  -- GNAT.Source_Info
    ("g-speche", F),  -- GNAT.Spell_Checker
    ("g-spchge", F),  -- GNAT.Spell_Checker_Generic
    ("g-spitbo", F),  -- GNAT.Spitbol
    ("g-spipat", F),  -- GNAT.Spitbol.Patterns
    ("g-sptabo", F),  -- GNAT.Spitbol.Table_Boolean
    ("g-sptain", F),  -- GNAT.Spitbol.Table_Integer
    ("g-sptavs", F),  -- GNAT.Spitbol.Table_Vstring
    ("g-string", F),  -- GNAT.Strings
    ("g-strspl", F),  -- GNAT.String_Split
    ("g-sse   ", F),  -- GNAT.SSE
    ("g-ssvety", F),  -- GNAT.SSE.Vector_Types
    ("g-table ", F),  -- GNAT.Table
    ("g-tasloc", F),  -- GNAT.Task_Lock
    ("g-tastus", F),  -- GNAT.Task_Stack_Usage
    ("g-thread", F),  -- GNAT.Threads
    ("g-timsta", F),  -- GNAT.Time_Stamp
    ("g-traceb", F),  -- GNAT.Traceback
    ("g-trasym", F),  -- GNAT.Traceback.Symbolic
    ("g-tty   ", F),  -- GNAT.TTY
    ("g-utf_32", F),  -- GNAT.UTF_32
    ("g-u3spch", F),  -- GNAT.UTF_32_Spelling_Checker
    ("g-wispch", F),  -- GNAT.Wide_Spelling_Checker
    ("g-wistsp", F),  -- GNAT.Wide_String_Split

   -----------------------------------------------------
   -- Interface Hierarchy Units from Reference Manual --
   -----------------------------------------------------

    ("i-c     ", T),  -- Interfaces.C
    ("i-cobol ", T),  -- Interfaces.Cobol
    ("i-cpoint", T),  -- Interfaces.C.Pointers
    ("i-cstrin", T),  -- Interfaces.C.Strings
    ("i-fortra", T),  -- Interfaces.Fortran

   ------------------------------------------
   -- GNAT Defined Additions to Interfaces --
   ------------------------------------------

    ("i-cexten", F),  -- Interfaces.C.Extensions
    ("i-cil   ", F),  -- Interfaces.CIL
    ("i-cilobj", F),  -- Interfaces.CIL.Object
    ("i-cpp   ", F),  -- Interfaces.CPP
    ("i-cstrea", F),  -- Interfaces.C.Streams
    ("i-java  ", F),  -- Interfaces.Java
    ("i-javjni", F),  -- Interfaces.Java.JNI
    ("i-pacdec", F),  -- Interfaces.Packed_Decimal
    ("i-vxwoio", F),  -- Interfaces.VxWorks.IO
    ("i-vxwork", F),  -- Interfaces.VxWorks

   --------------------------------------------------
   -- System Hierarchy Units from Reference Manual --
   --------------------------------------------------

    ("s-atacco", T),  -- System.Address_To_Access_Conversions
    ("s-maccod", T),  -- System.Machine_Code
    ("s-rpc   ", T),  -- System.Rpc
    ("s-stoele", T),  -- System.Storage_Elements
    ("s-stopoo", T),  -- System.Storage_Pools

   --------------------------------------
   -- GNAT Defined Additions to System --
   --------------------------------------

    ("s-addima", F),  -- System.Address_Image
    ("s-assert", F),  -- System.Assertions
    ("s-diflio", F),  -- System.Dim.Float_IO
    ("s-diinio", F),  -- System.Dim.Integer_IO
    ("s-dimkio", F),  -- System.Dim.Mks_IO
    ("s-dimmks", F),  -- System.Dim.Mks
    ("s-dmotpr", F),  -- System.Dim.Mks.Other_Prefixes
    ("s-memory", F),  -- System.Memory
    ("s-parint", F),  -- System.Partition_Interface
    ("s-pooglo", F),  -- System.Pool_Global
    ("s-pooloc", F),  -- System.Pool_Local
    ("s-restri", F),  -- System.Restrictions
    ("s-rident", F),  -- System.Rident
    ("s-ststop", F),  -- System.Strings.Stream_Ops
    ("s-tasinf", F),  -- System.Task_Info
    ("s-wchcnv", F),  -- System.Wch_Cnv
    ("s-wchcon", F),  -- System.Wch_Con

   --  The following are strictly speaking Ada 2012 units, but we are allowed
   --  to add children to system, so we consider them to be implementation
   --  defined additions to System in earlier versions of Ada.

    ("s-multip", T),  -- System.Multiprocessors
    ("s-mudido", T)); -- System.Multiprocessors.Dispatching_Domains

   --------------------
   -- Ada 2005 Units --
   --------------------

   --  The following units should be used only in Ada 05 mode

   Non_Imp_File_Names_05 : constant File_List := (

   --------------------------------------------------------
   -- Ada Hierarchy Units from Ada 2005 Reference Manual --
   --------------------------------------------------------

    ("a-assert", T),  -- Ada.Assertions
    ("a-calari", T),  -- Ada.Calendar.Arithmetic
    ("a-calfor", T),  -- Ada.Calendar.Formatting
    ("a-catizo", T),  -- Ada.Calendar.Time_Zones
    ("a-cdlili", T),  -- Ada.Containers.Doubly_Linked_Lists
    ("a-cgarso", T),  -- Ada.Containers.Generic_Array_Sort
    ("a-cgcaso", T),  -- Ada.Containers.Generic_Constrained_Array_Sort
    ("a-chacon", T),  -- Ada.Characters.Conversions
    ("a-cidlli", T),  -- Ada.Containers.Indefinite_Doubly_Linked_Lists
    ("a-cihama", T),  -- Ada.Containers.Indefinite_Hashed_Maps
    ("a-cihase", T),  -- Ada.Containers.Indefinite_Hashed_Sets
    ("a-ciorma", T),  -- Ada.Containers.Indefinite_Ordered_Maps
    ("a-ciorse", T),  -- Ada.Containers.Indefinite_Ordered_Sets
    ("a-cohama", T),  -- Ada.Containers.Hashed_Maps
    ("a-cohase", T),  -- Ada.Containers.Hashed_Sets
    ("a-coinve", T),  -- Ada.Containers.Indefinite_Vectors
    ("a-contai", T),  -- Ada.Containers
    ("a-convec", T),  -- Ada.Containers.Vectors
    ("a-coorma", T),  -- Ada.Containers.Ordered_Maps
    ("a-coorse", T),  -- Ada.Containers.Ordered_Sets
    ("a-coteio", T),  -- Ada.Complex_Text_IO
    ("a-direct", T),  -- Ada.Directories
    ("a-diroro", T),  -- Ada.Dispatching.Round_Robin
    ("a-disedf", T),  -- Ada.Dispatching.EDF
    ("a-dispat", T),  -- Ada.Dispatching
    ("a-envvar", T),  -- Ada.Environment_Variables
    ("a-etgrbu", T),  -- Ada.Execution_Time.Group_Budgets
    ("a-exetim", T),  -- Ada.Execution_Time
    ("a-extiti", T),  -- Ada.Execution_Time.Timers
    ("a-izteio", T),  -- Ada.Integer_Wide_Wide_Text_IO
    ("a-rttiev", T),  -- Ada.Real_Time.Timing_Events
    ("a-ngcoar", T),  -- Ada.Numerics.Generic_Complex_Arrays
    ("a-ngrear", T),  -- Ada.Numerics.Generic_Real_Arrays
    ("a-nucoar", T),  -- Ada.Numerics.Complex_Arrays
    ("a-nurear", T),  -- Ada.Numerics.Real_Arrays
    ("a-stboha", T),  -- Ada.Strings.Bounded.Hash
    ("a-stfiha", T),  -- Ada.Strings.Fixed.Hash
    ("a-strhas", T),  -- Ada.Strings.Hash
    ("a-stunha", T),  -- Ada.Strings.Unbounded.Hash
    ("a-stwiha", T),  -- Ada.Strings.Wide_Hash
    ("a-stzbou", T),  -- Ada.Strings.Wide_Wide_Bounded
    ("a-stzfix", T),  -- Ada.Strings.Wide_Wide_Fixed
    ("a-stzhas", T),  -- Ada.Strings.Wide_Wide_Hash
    ("a-stzmap", T),  -- Ada.Strings.Wide_Wide_Maps
    ("a-stzunb", T),  -- Ada.Strings.Wide_Wide_Unbounded
    ("a-swbwha", T),  -- Ada.Strings.Wide_Bounded.Wide_Hash
    ("a-swfwha", T),  -- Ada.Strings.Wide_Fixed.Wide_Hash
    ("a-swuwha", T),  -- Ada.Strings.Wide_Unbounded.Wide_Hash
    ("a-szbzha", T),  -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
    ("a-szfzha", T),  -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
    ("a-szmzco", T),  -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
    ("a-szuzha", T),  -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
    ("a-taster", T),  -- Ada.Task_Termination
    ("a-tgdico", T),  -- Ada.Tags.Generic_Dispatching_Constructor
    ("a-tiboio", T),  -- Ada.Text_IO.Bounded_IO
    ("a-tiunio", T),  -- Ada.Text_IO.Unbounded_IO
    ("a-wichun", T),  -- Ada.Wide_Characters.Unicode
    ("a-wwboio", T),  -- Ada.Wide_Text_IO.Wide_Bounded_IO
    ("a-wwunio", T),  -- Ada.Wide_Text_IO.Wide_Unbounded_IO
    ("a-zchara", T),  -- Ada.Wide_Wide_Characters
    ("a-zchhan", T),  -- Ada.Wide_Wide_Characters.Handling
    ("a-ztcoio", T),  -- Ada.Wide_Wide_Text_IO.Complex_IO
    ("a-ztedit", T),  -- Ada.Wide_Wide_Text_IO.Editing
    ("a-zttest", T),  -- Ada.Wide_Wide_Text_IO.Text_Streams
    ("a-ztexio", T),  -- Ada.Wide_Wide_Text_IO
    ("a-zzboio", T),  -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
    ("a-zzunio", T),  -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO

   ------------------------------------------------------
   -- RM Required Additions to Ada 2005 for GNAT Types --
   ------------------------------------------------------

   --  Note: Long versions are considered RM defined, but not the Long Long,
   --  Short, or Short_Short versions.

    ("a-lcteio", T),  -- Ada.Long_Complex_Text_IO
    ("a-lfztio", T),  -- Ada.Long_Float_Wide_Wide_Text_IO
    ("a-liztio", T),  -- Ada.Long_Integer_Wide_Wide_Text_IO
    ("a-llctio", T),  -- Ada.Long_Long_Complex_Text_IO
    ("a-llfzti", T),  -- Ada.Long_Long_Float_Wide_Wide_Text_IO
    ("a-llizti", T),  -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
    ("a-nlcoar", T),  -- Ada.Numerics.Long_Complex_Arrays
    ("a-nllcar", T),  -- Ada.Numerics.Long_Long_Complex_Arrays
    ("a-nllrar", T),  -- Ada.Numerics.Long_Long_Real_Arrays
    ("a-nlrear", T),  -- Ada.Numerics.Long_Real_Arrays
    ("a-scteio", F),  -- Ada.Short_Complex_Text_IO
    ("a-sfztio", F),  -- Ada.Short_Float_Wide_Wide_Text_IO
    ("a-siztio", F),  -- Ada.Short_Integer_Wide_Wide_Text_IO
    ("a-ssizti", F),  -- Ada.Short_Short_Integer_Wide_Wide_Text_IO

   ----------------------------------------
   -- GNAT Defined Additions to Ada 2005 --
   ----------------------------------------

    ("a-cgaaso", F),  -- Ada.Containers.Generic_Anonymous_Array_Sort
    ("a-chzla1", F),  -- Ada.Characters.Wide_Wide_Latin_1
    ("a-chzla9", F),  -- Ada.Characters.Wide_Wide_Latin_9
    ("a-ciormu", F),  -- Ada.Containers.Indefinite_Ordered_Multisets
    ("a-coormu", F),  -- Ada.Containers.Ordered_Multisets
    ("a-crdlli", F),  -- Ada.Containers.Restricted_Doubly_Linked_Lists
    ("a-szuzti", F),  -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
    ("a-zchuni", F),  -- Ada.Wide_Wide_Characters.Unicode
    ("a-ztcstr", F),  -- Ada.Wide_Wide_Text_IO.C_Streams

      --  Note: strictly the following should be Ada 2012 units, but it seems
      --  harmless (and useful) to make then available in Ada 2005 mode.

    ("a-cogeso", T),  -- Ada.Containers.Generic_Sort
    ("a-secain", T),  -- Ada.Strings.Equal_Case_Insensitive
    ("a-shcain", T),  -- Ada.Strings.Hash_Case_Insensitive
    ("a-slcain", T),  -- Ada.Strings.Less_Case_Insensitive
    ("a-sfecin", T),  -- Ada.Strings.Fixed.Equal_Case_Insensitive
    ("a-sfhcin", T),  -- Ada.Strings.Fixed.Hash_Case_Insensitive
    ("a-sflcin", T),  -- Ada.Strings.Fixed.Less_Case_Insensitive
    ("a-sbecin", T),  -- Ada.Strings.Bounded.Equal_Case_Insensitive
    ("a-sbhcin", T),  -- Ada.Strings.Bounded.Hash_Case_Insensitive
    ("a-sblcin", T),  -- Ada.Strings.Bounded.Less_Case_Insensitive
    ("a-suecin", T),  -- Ada.Strings.Unbounded.Equal_Case_Insensitive
    ("a-suhcin", T),  -- Ada.Strings.Unbounded.Hash_Case_Insensitive
    ("a-sulcin", T),  -- Ada.Strings.Unbounded.Less_Case_Insensitive
    ("a-suezst", T),  -- Ada.Strings.UTF_Encoding.Wide_Wide_Strings

   ---------------------------
   -- GNAT Special IO Units --
   ---------------------------

   --  See Ada 95 section for further information. These packages are for the
   --  implementation of the Wide_Wide_Text_IO generic packages.

    ("a-ztdeio", F),  -- Ada.Wide_Wide_Text_IO.Decimal_IO
    ("a-ztenio", F),  -- Ada.Wide_Wide_Text_IO.Enumeration_IO
    ("a-ztfiio", F),  -- Ada.Wide_Wide_Text_IO.Fixed_IO
    ("a-ztflio", F),  -- Ada.Wide_Wide_Text_IO.Float_IO
    ("a-ztinio", F),  -- Ada.Wide_Wide_Text_IO.Integer_IO
    ("a-ztmoio", F),  -- Ada.Wide_Wide_Text_IO.Modular_IO

   ------------------------
   -- GNAT Library Units --
   ------------------------

    ("g-zspche", F),  -- GNAT.Wide_Wide_Spelling_Checker
    ("g-zstspl", F)); -- GNAT.Wide_Wide_String_Split

   --------------------
   -- Ada 2012 Units --
   --------------------

   --  The following units should be used only in Ada 2012 mode

   Non_Imp_File_Names_12 : constant File_List := (
    ("s-stposu", T),  -- System.Storage_Pools.Subpools
    ("a-cobove", T),  -- Ada.Containers.Bounded_Vectors
    ("a-cbdlli", T),  -- Ada.Containers.Bounded_Doubly_Linked_Lists
    ("a-cborse", T),  -- Ada.Containers.Bounded_Ordered_Sets
    ("a-cborma", T),  -- Ada.Containers.Bounded_Ordered_Maps
    ("a-cbhase", T),  -- Ada.Containers.Bounded_Hashed_Sets
    ("a-cbhama", T),  -- Ada.Containers.Bounded_Hashed_Maps
    ("a-coinho", T),  -- Ada.Containers.Indefinite_Holders
    ("a-comutr", T),  -- Ada.Containers.Multiway_Trees
    ("a-cimutr", T),  -- Ada.Containers.Indefinite_Multiway_Trees
    ("a-cbmutr", T),  -- Ada.Containers.Bounded_Multiway_Trees
    ("a-csquin", T),  -- Ada.Containers.Synchronized_Queue_Interfaces
    ("a-cusyqu", T),  -- Ada.Containers.Unbounded_Synchronized_Queues
    ("a-cuprqu", T),  -- Ada.Containers.Unbounded_Priority_Queues
    ("a-cbsyqu", T),  -- Ada.Containers.Bounded_Synchronized_Queues
    ("a-cbprqu", T),  -- Ada.Containers.Bounded_Priority_Queues
    ("a-extiin", T),  -- Ada.Execution_Time.Interrupts
    ("a-iteint", T),  -- Ada.Iterator_Interfaces
    ("a-locale", T),  -- Ada.Locales
    ("a-synbar", T),  -- Ada.Synchronous_Barriers
    ("a-undesu", T),  -- Ada.Unchecked_Deallocate_Subpool

   ----------------------------------------
   -- GNAT Defined Additions to Ada 2012 --
   ----------------------------------------

    ("a-cofove", F),  -- Ada.Containers.Formal_Vectors
    ("a-cfdlli", F),  -- Ada.Containers.Formal_Doubly_Linked_Lists
    ("a-cforse", F),  -- Ada.Containers.Formal_Ordered_Sets
    ("a-cforma", F),  -- Ada.Containers.Formal_Ordered_Maps
    ("a-cfhase", F),  -- Ada.Containers.Formal_Hashed_Sets
    ("a-cfhama", F)); -- Ada.Containers.Formal_Hashed_Maps

   -----------------------
   -- Alternative Units --
   -----------------------

   --  For some implementation units, there is a unit in the GNAT library
   --  that has identical functionality that is usable. If we have such a
   --  case we record the appropriate Unit name in Error_Msg_String.

   type Aunit_Record is record
      Fname : String (1 .. 6);
      Aname : String_Ptr;
   end record;

   --  Array of alternative unit names

   Scasuti : aliased String := "GNAT.Case_Util";
   Scrc32  : aliased String := "GNAT.CRC32";
   Shtable : aliased String := "GNAT.HTable";
   Sos_lib : aliased String := "GNAT.OS_Lib";
   Sregexp : aliased String := "GNAT.Regexp";
   Sregpat : aliased String := "GNAT.Regpat";
   Sstring : aliased String := "GNAT.Strings";
   Sstusta : aliased String := "GNAT.Task_Stack_Usage";
   Stasloc : aliased String := "GNAT.Task_Lock";
   Sutf_32 : aliased String := "GNAT.UTF_32";

   --  Array giving mapping

   Map_Array : constant array (1 .. 10) of Aunit_Record := (
                 ("casuti", Scasuti'Access),
                 ("crc32 ", Scrc32 'Access),
                 ("htable", Shtable'Access),
                 ("os_lib", Sos_lib'Access),
                 ("regexp", Sregexp'Access),
                 ("regpat", Sregpat'Access),
                 ("string", Sstring'Access),
                 ("stusta", Sstusta'Access),
                 ("tasloc", Stasloc'Access),
                 ("utf_32", Sutf_32'Access));

   ----------------------
   -- Get_Kind_Of_Unit --
   ----------------------

   function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
      Fname : constant File_Name_Type := Unit_File_Name (U);

   begin
      Error_Msg_Strlen := 0;
      Get_Name_String (Fname);

      --  Ada/System/Interfaces are all Ada 95 units

      if (Name_Len =  7 and then Name_Buffer (1 ..  7) = "ada.ads")
           or else
         (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
           or else
         (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
      then
         return Ada_95_Unit;
      end if;

      --  If length of file name is greater than 12, not predefined. The value
      --  12 here is an 8 char name with extension .ads.

      if Name_Len > 12 then
         return Not_Predefined_Unit;
      end if;

      --  Not predefined if file name does not start with a- g- s- i-

      if Name_Len < 3
        or else Name_Buffer (2) /= '-'
        or else (Name_Buffer (1) /= 'a'
                   and then
                 Name_Buffer (1) /= 'g'
                   and then
                 Name_Buffer (1) /= 'i'
                   and then
                 Name_Buffer (1) /= 's')
      then
         return Not_Predefined_Unit;
      end if;

      --  To be considered predefined, the file name must end in .ads or .adb.
      --  File names with other extensions (coming from the use of non-standard
      --  file naming schemes) can never be predefined.

      --  Note that in the context of a compiler, the .adb case will never
      --  arise. However it can arise for other tools, e.g. gnatprove uses
      --  this routine to detect when a construct comes from an instance of
      --  a generic defined in a predefined unit.

      if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads"
           and then
         Name_Buffer (Name_Len - 3 .. Name_Len) /= ".adb"
      then
         return Not_Predefined_Unit;
      end if;

      --  Otherwise normalize file name to 8 characters

      Name_Len := Name_Len - 4;
      while Name_Len < 8 loop
         Name_Len := Name_Len + 1;
         Name_Buffer (Name_Len) := ' ';
      end loop;

      --  See if name is in 95 list

      for J in Non_Imp_File_Names_95'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
            return Ada_95_Unit;
         end if;
      end loop;

      --  See if name is in 2005 list

      for J in Non_Imp_File_Names_05'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
            return Ada_2005_Unit;
         end if;
      end loop;

      --  See if name is in 2012 list

      for J in Non_Imp_File_Names_12'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
            return Ada_2012_Unit;
         end if;
      end loop;

      --  Only remaining special possibilities are children of System.RPC and
      --  System.Garlic and special files of the form System.Aux...

      Get_Name_String (Unit_Name (U));

      if Name_Len > 12
        and then Name_Buffer (1 .. 11) = "system.rpc."
      then
         return Ada_95_Unit;
      end if;

      if Name_Len > 15
        and then Name_Buffer (1 .. 14) = "system.garlic."
      then
         return Ada_95_Unit;
      end if;

      if Name_Len > 11
        and then Name_Buffer (1 .. 10) = "system.aux"
      then
         return Ada_95_Unit;
      end if;

      --  All tests failed, this is definitely an implementation unit. See if
      --  we have an alternative name.

      Get_Name_String (Fname);

      if Name_Len in 11 .. 12
        and then Name_Buffer (1 .. 2) = "s-"
        and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
      then
         for J in Map_Array'Range loop
            if (Name_Len = 12 and then
                 Name_Buffer (3 .. 8) = Map_Array (J).Fname)
              or else
               (Name_Len = 11 and then
                 Name_Buffer (3 .. 7) = Map_Array (J).Fname (1 .. 5))
            then
               Error_Msg_Strlen := Map_Array (J).Aname'Length;
               Error_Msg_String (1 .. Error_Msg_Strlen) :=
                 Map_Array (J).Aname.all;
            end if;
         end loop;
      end if;

      return Implementation_Unit;
   end Get_Kind_Of_Unit;

   -------------------
   -- Is_Known_Unit --
   -------------------

   function Is_Known_Unit (Nam : Node_Id) return Boolean is
      Unam : Unit_Name_Type;
      Fnam : File_Name_Type;

   begin
      --  If selector is not an identifier (e.g. it is a character literal or
      --  some junk from a previous error), then definitely not a known unit.

      if Nkind (Selector_Name (Nam)) /= N_Identifier then
         return False;
      end if;

      --  Otherwise get corresponding file name

      Unam := Get_Unit_Name (Nam);
      Fnam := Get_File_Name (Unam, Subunit => False);
      Get_Name_String (Fnam);

      Error_Msg_Strlen := 0;

      --  Ada/System/Interfaces are all Ada 95 units

      if (Name_Len =  7 and then Name_Buffer (1 ..  7) = "ada.ads")
           or else
         (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
           or else
         (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
      then
         return True;
      end if;

      --  Remove extension from file name

      if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb"
           or else
         Name_Buffer (Name_Len - 3 .. Name_Len) = ".ads"
      then
         Name_Len := Name_Len - 4;
      else
         return False;
      end if;

      --  Pad name to 8 characters

      while Name_Len < 8 loop
         Name_Len := Name_Len + 1;
         Name_Buffer (Name_Len) := ' ';
      end loop;

      --  If length more than 8, definitely not a match

      if Name_Len /= 8 then
         return False;
      end if;

      --  If length is 8, search our tables

      for J in Non_Imp_File_Names_95'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
            return True;
         end if;
      end loop;

      for J in Non_Imp_File_Names_05'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
            return True;
         end if;
      end loop;

      for J in Non_Imp_File_Names_12'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
            return True;
         end if;
      end loop;

      --  If not found, not known

      return False;

   --  A safety guard, if we get an exception during this processing then it
   --  is most likely the result of a previous error, or a peculiar case we
   --  have not thought of. Since this routine is only used for error message
   --  refinement, we will just return False.

   exception
      when others =>
         return False;
   end Is_Known_Unit;

   ---------------------------
   -- Not_Impl_Defined_Unit --
   ---------------------------

   function Not_Impl_Defined_Unit (U : Unit_Number_Type) return Boolean is
      Fname : constant File_Name_Type := Unit_File_Name (U);

   begin
      Error_Msg_Strlen := 0;
      Get_Name_String (Fname);

      --  Ada/System/Interfaces are all RM-defined Ada 95 units

      if (Name_Len =  7 and then Name_Buffer (1 ..  7) = "ada.ads")
           or else
         (Name_Len = 10 and then Name_Buffer (1 .. 10) = "system.ads")
           or else
         (Name_Len = 12 and then Name_Buffer (1 .. 12) = "interfac.ads")
      then
         return True;
      end if;

      --  If length of file name is greater than 12, then it's a user unit
      --  and not a GNAT implementation defined unit.

      if Name_Len > 12 then
         return True;
      end if;

      --  Implementation defined if unit in the gnat hierarchy

      if (Name_Len = 8 and then Name_Buffer (1 .. 8) = "gnat.ads")
        or else (Name_Len > 2 and then Name_Buffer (1 .. 2) = "g-")
      then
         return False;
      end if;

      --  Not implementation defined if file name does not start with a- s- i-

      if Name_Len < 3
        or else Name_Buffer (2) /= '-'
        or else (Name_Buffer (1) /= 'a'
                   and then
                 Name_Buffer (1) /= 'i'
                   and then
                 Name_Buffer (1) /= 's')
      then
         return True;
      end if;

      --  Not impl-defined if file name does not end in .ads. This can happen
      --  when non-standard file names are being used.

      if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
         return True;
      end if;

      --  Otherwise normalize file name to 8 characters

      Name_Len := Name_Len - 4;
      while Name_Len < 8 loop
         Name_Len := Name_Len + 1;
         Name_Buffer (Name_Len) := ' ';
      end loop;

      --  Check our lists of names, if we find a match, return corresponding
      --  indication of whether the file is RM defined, respecting the RM
      --  version in which it is defined.

      for J in Non_Imp_File_Names_95'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
            return Non_Imp_File_Names_95 (J).RMdef;
         end if;
      end loop;

      for J in Non_Imp_File_Names_05'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
            return Non_Imp_File_Names_05 (J).RMdef
              and then Ada_Version >= Ada_2005;
         end if;
      end loop;

      for J in Non_Imp_File_Names_12'Range loop
         if Name_Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
            return Non_Imp_File_Names_95 (J).RMdef
              and then Ada_Version >= Ada_2012;
         end if;
      end loop;

      --  If unit is in System, Ada or Interfaces hierarchies and did not match
      --  any entry in the list, means it is an internal implementation defined
      --  unit which the restriction should definition forbid.

      return True;
   end Not_Impl_Defined_Unit;

end Impunit;