Daily bump.
[official-gcc.git] / gcc / ada / impunit.ads
blobaf9f924f7f8d8b6b4e1b3a606d5f936172235f0e
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- I M P U N I T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2000-2024, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- This package contains data and functions used to determine if a given unit
27 -- is an internal unit intended only for use by the implementation and which
28 -- should not be directly WITH'ed by user code. It also checks for Ada 2005
29 -- units that should only be WITH'ed in Ada 2005 mode, and Ada 2012 units
30 -- that should only be WITH'ed in Ada 2012 mode.
32 with Types; use Types;
34 package Impunit is
36 type Kind_Of_Unit is
37 (Implementation_Unit,
38 -- Unit from predefined library intended to be used only by the compiler
39 -- generated code, or from the implementation of the run time. Use of
40 -- such a unit generates a warning unless the client is compiled with
41 -- the -gnatg switch. If we are being super strict, this should be an
42 -- error for the case of Ada units, but that seems over strenuous.
44 Not_Predefined_Unit,
45 -- This is not a predefined unit, so no checks are needed
47 Ada_95_Unit,
48 Ada_2005_Unit,
49 Ada_2012_Unit,
50 Ada_2022_Unit);
51 -- This unit is defined in the Ada RM of the given year. This is used to
52 -- give a warning when withing a unit from a wrong mode (e.g. withing an
53 -- Ada_2012_Unit when compiling with -gnat95). Note that in Ada 83 mode,
54 -- no child units are allowed, so you can't even name such a unit.
56 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit;
57 -- Given the unit number of a unit, this function determines the type
58 -- of the unit, as defined above. If the result is Implementation_Unit,
59 -- then the name of a possible alternative equivalent unit is placed in
60 -- Error_Msg_String/Slen on return. If there is no alternative name, or if
61 -- the result is not Implementation_Unit, then Error_Msg_Slen is zero on
62 -- return, indicating that no alternative name was found.
64 function Get_Kind_Of_File (File : String) return Kind_Of_Unit;
65 -- Same as Get_Kind_Of_Unit, for a given filename
67 function Is_Known_Unit (Nam : Node_Id) return Boolean;
68 -- Nam is the possible name of a child unit, represented as a selected
69 -- component node. This function determines whether the name matches one of
70 -- the known library units, and if so, returns True. If the name does not
71 -- match any known library unit, False is returned.
73 function Not_Impl_Defined_Unit (U : Unit_Number_Type) return Boolean;
74 -- This function returns True if U represents a unit that is permitted by
75 -- the restriction No_Implementation_Units (i.e. a unit in the Ada, System,
76 -- and Interfaces hierarchies that is defined in the RM, or a user defined
77 -- unit. It returns False if U represents a unit that is not permitted by
78 -- this restriction, which includes units in these three hierarchies that
79 -- are GNAT implementation defined. It also returns False for any units in
80 -- the GNAT hierarchy, which is not strictly conforming, but so obviously
81 -- useful that it is a reasonable deviation from the standard.
83 end Impunit;