OSDN Git Service

* trans.h (struct gfc_ss): New field nested_ss.
[pf3gnuchains/gcc-fork.git] / gcc / ada / osint.ads
index 8af2ef6..a4fc334 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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 2,  or (at your option) any later ver- --
+-- 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 COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- 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.      --
 --  This package contains the low level, operating system routines used in the
 --  compiler and binder for command line processing and file input output.
 
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-with System;      use System;
-with Types;       use Types;
+with Namet; use Namet;
+with Types; use Types;
 
-pragma Elaborate_All (GNAT.OS_Lib);
+with System;                  use System;
+
+pragma Warnings (Off);
+--  This package is used also by gnatcoll
+with System.OS_Lib;           use System.OS_Lib;
+pragma Warnings (On);
+
+with System.Storage_Elements;
+
+pragma Elaborate_All (System.OS_Lib);
 --  For the call to function Get_Target_Object_Suffix in the private part
 
 package Osint is
 
    Multi_Unit_Index_Character : Character := '~';
-   --  The character before the index of the unit in a multi-unit source, in
-   --  ALI and object file names. This is not a constant, because it is changed
-   --  to '$' on VMS.
+   --  The character before the index of the unit in a multi-unit source in ALI
+   --  and object file names. Changed to '$' on VMS.
 
    Ada_Include_Path          : constant String := "ADA_INCLUDE_PATH";
    Ada_Objects_Path          : constant String := "ADA_OBJECTS_PATH";
@@ -61,7 +67,7 @@ package Osint is
       T : File_Type) return File_Name_Type;
    --  Finds a source, library or config file depending on the value of T
    --  following the directory search order rules unless N is the name of the
-   --  file just read with Next_Main_File and already contains directiory
+   --  file just read with Next_Main_File and already contains directory
    --  information, in which case just look in the Primary_Directory. Returns
    --  File_Name_Type of the full file name if found, No_File if file not
    --  found. Note that for the special case of gnat.adc, only the compilation
@@ -78,7 +84,7 @@ package Osint is
                                  Get_File_Names_Case_Sensitive /= 0;
    --  Set to indicate whether the operating system convention is for file
    --  names to be case sensitive (e.g., in Unix, set True), or non case
-   --  sensitive (e.g., in OS/2, set False).
+   --  sensitive (e.g., in Windows, set False).
 
    procedure Canonical_Case_File_Name (S : in out String);
    --  Given a file name, converts it to canonical case form. For systems
@@ -88,6 +94,23 @@ package Osint is
    --  this call converts the given string to canonical all lower case form,
    --  so that two file names compare equal if they refer to the same file.
 
+   function Get_Env_Vars_Case_Sensitive return Int;
+   pragma Import (C, Get_Env_Vars_Case_Sensitive,
+                  "__gnat_get_env_vars_case_sensitive");
+   Env_Vars_Case_Sensitive : constant Boolean :=
+                                 Get_Env_Vars_Case_Sensitive /= 0;
+   --  Set to indicate whether the operating system convention is for
+   --  environment variable names to be case sensitive (e.g., in Unix, set
+   --  True), or non case sensitive (e.g., in Windows, set False).
+
+   procedure Canonical_Case_Env_Var_Name (S : in out String);
+   --  Given an environment variable name, converts it to canonical case form.
+   --  For systems where environment variable names are case sensitive, this
+   --  procedure has no effect. If environment variable names are not case
+   --  sensitive, then this call converts the given string to canonical all
+   --  lower case form, so that two environment variable names compare equal if
+   --  they refer to the same environment variable.
+
    function Number_Of_Files return Int;
    --  Gives the total number of filenames found on the command line
 
@@ -104,22 +127,27 @@ package Osint is
    --  Put simple name of current program being run (excluding the directory
    --  path) in Name_Buffer, with the length in Name_Len.
 
-   function Program_Name (Nam : String) return String_Access;
+   function Program_Name (Nam : String; Prog : String) return String_Access;
    --  In the native compilation case, Create a string containing Nam. In the
    --  cross compilation case, looks at the prefix of the current program being
    --  run and prepend it to Nam. For instance if the program being run is
    --  <target>-gnatmake and Nam is "gcc", the returned value will be a pointer
-   --  to "<target>-gcc". This function clobbers Name_Buffer and Name_Len.
+   --  to "<target>-gcc". In the specific case where AAMP_On_Target is set, the
+   --  name "gcc" is mapped to "gnaamp", and names of the form "gnat*" are
+   --  mapped to "gnaamp*". This function clobbers Name_Buffer and Name_Len.
+   --  Also look at any suffix, e.g. gnatmake-4.1 -> "gcc-4.1". Prog is the
+   --  default name of the current program being executed, e.g. "gnatmake",
+   --  "gnatlink".
 
    procedure Write_Program_Name;
-   --  Writes name of program as invoked to the current output
-   --  (normally standard output).
+   --  Writes name of program as invoked to the current output (normally
+   --  standard output).
 
-   procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
+   procedure Fail (S : String);
    pragma No_Return (Fail);
-   --  Outputs error messages S1 & S2 & S3 preceded by the name of the
-   --  executing program and exits with E_Fatal. The output goes to standard
-   --  error, except if special output is in effect (see Output).
+   --  Outputs error message S preceded by the name of the executing program
+   --  and exits with E_Fatal. The output goes to standard error, except if
+   --  special output is in effect (see Output).
 
    function Is_Directory_Separator (C : Character) return Boolean;
    --  Returns True if C is a directory separator
@@ -140,23 +168,30 @@ package Osint is
    --  Strips the suffix (the last '.' and whatever comes after it) from Name.
    --  Returns the stripped name.
 
-   function Executable_Name (Name : File_Name_Type) return File_Name_Type;
+   function Executable_Name
+     (Name              : File_Name_Type;
+      Only_If_No_Suffix : Boolean := False) return File_Name_Type;
    --  Given a file name it adds the appropriate suffix at the end so that
    --  it becomes the name of the executable on the system at end. For
    --  instance under DOS it adds the ".exe" suffix, whereas under UNIX no
    --  suffix is added.
 
-   function Executable_Name (Name : String) return String;
+   function Executable_Name
+     (Name              : String;
+      Only_If_No_Suffix : Boolean := False) return String;
    --  Same as above, with String parameters
 
    function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type;
-   --  Returns the time stamp of file Name. Name should include relative
-   --  path information in order to locate it. If the source file cannot be
-   --  opened, or Name = No_File, and all blank time stamp is returned (this is
-   --  not an error situation).
+   --  Returns the time stamp of file Name. Name should include relative path
+   --  information in order to locate it. If the source file cannot be opened,
+   --  or Name = No_File, and all blank time stamp is returned (this is not an
+   --  error situation).
+
+   function File_Stamp (Name : Path_Name_Type) return Time_Stamp_Type;
+   --  Same as above for a path name
 
    type String_Access_List is array (Positive range <>) of String_Access;
-   --  Deferenced type used to return a list of file specs in
+   --  Dereferenced type used to return a list of file specs in
    --  To_Canonical_File_List.
 
    type String_Access_List_Access is access all String_Access_List;
@@ -167,9 +202,8 @@ package Osint is
      (Wildcard_Host_File : String;
       Only_Dirs          : Boolean) return String_Access_List_Access;
    --  Expand a wildcard host syntax file or directory specification (e.g. on
-   --  a VMS host, any file or directory spec that contains:
-   --  "*", or "%", or "...")
-   --  and return a list of valid Unix syntax file or directory specs.
+   --  a VMS host, any file or directory spec that contains: "*", or "%", or
+   --  "...") and return a list of valid Unix syntax file or directory specs.
    --  If Only_Dirs is True, then only return directories.
 
    function To_Canonical_Dir_Spec
@@ -198,9 +232,9 @@ package Osint is
    function To_Host_Dir_Spec
      (Canonical_Dir : String;
       Prefix_Style  : Boolean) return String_Access;
-   --  Convert a canonical syntax directory specification to host syntax.
-   --  The Prefix_Style flag is currently ignored but should be set to
-   --  False.
+   --  Convert a canonical syntax directory specification to host syntax. The
+   --  Prefix_Style flag is currently ignored but should be set to False.
+   --  Note that the caller must free result.
 
    function To_Host_File_Spec
      (Canonical_File : String) return String_Access;
@@ -222,6 +256,60 @@ package Osint is
    --  this routine called with Name set to "gnat" will return "-lgnat-5.02"
    --  on UNIX and Windows and -lgnat_5_02 on VMS.
 
+   ---------------------
+   -- File attributes --
+   ---------------------
+
+   --  The following subprograms offer services similar to those found in
+   --  System.OS_Lib, but with the ability to extra multiple information from
+   --  a single system call, depending on the system. This can result in fewer
+   --  system calls when reused.
+
+   --  In all these subprograms, the requested value is either read from the
+   --  File_Attributes parameter (resulting in no system call), or computed
+   --  from the disk and then cached in the File_Attributes parameter (possibly
+   --  along with other values).
+
+   type File_Attributes is private;
+   Unknown_Attributes : constant File_Attributes;
+   --  A cache for various attributes for a file (length, accessibility,...)
+   --  This must be initialized to Unknown_Attributes prior to the first call.
+
+   function Is_Directory
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Boolean;
+   function Is_Regular_File
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Boolean;
+   function Is_Symbolic_Link
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Boolean;
+   --  Return the type of the file,
+
+   function File_Length
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Long_Integer;
+   --  Return the length (number of bytes) of the file
+
+   function File_Time_Stamp
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return OS_Time;
+   function File_Time_Stamp
+     (Name : Path_Name_Type;
+      Attr : access File_Attributes) return Time_Stamp_Type;
+   --  Return the time stamp of the file
+
+   function Is_Readable_File
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Boolean;
+   function Is_Executable_File
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Boolean;
+   function Is_Writable_File
+     (Name : C_File_Name;
+      Attr : access File_Attributes) return Boolean;
+   --  Return the access rights for the file
+
    -------------------------
    -- Search Dir Routines --
    -------------------------
@@ -235,8 +323,8 @@ package Osint is
    --  modified by update_path.
 
    procedure Add_Default_Search_Dirs;
-   --  This routine adds the default search dirs indicated by the
-   --  environment variables and sdefault package.
+   --  This routine adds the default search dirs indicated by the environment
+   --  variables and sdefault package.
 
    procedure Add_Lib_Search_Dir (Dir : String);
    --  Add Dir at the end of the library file search path
@@ -248,11 +336,11 @@ package Osint is
      (Search_Path : String_Access);
    function Get_Next_Dir_In_Path
      (Search_Path : String_Access) return String_Access;
-   --  These subprograms are used to parse out the directory names in a
-   --  search path specified by a Search_Path argument. The procedure
-   --  initializes an internal pointer to point to the initial directory
-   --  name, and calls to the function return successive directory names,
-   --  with a null pointer marking the end of the list.
+   --  These subprograms are used to parse out the directory names in a search
+   --  path specified by a Search_Path argument. The procedure initializes an
+   --  internal pointer to point to the initial directory name, and calls to
+   --  the function return successive directory names, with a null pointer
+   --  marking the end of the list.
 
    type Search_File_Type is (Include, Objects);
 
@@ -278,7 +366,7 @@ package Osint is
                            new String'("ada_source_path");
    Objects_Search_File : constant String_Access :=
                            new String'("ada_object_path");
-   --  Names of the files containg the default include or objects search
+   --  Names of the files containing the default include or objects search
    --  directories. These files, located in Sdefault.Search_Dir_Prefix, do
    --  not necessarily exist.
 
@@ -336,13 +424,11 @@ package Osint is
    --
    --    CR
    --    CR/LF
-   --    LF/CR
    --    LF
 
-   --  The source is terminated by an EOF (16#1A#) character, which is
-   --  the last charcater of the returned source bufer (note that any
-   --  EOF characters in positions other than the last source character
-   --  are treated as representing blanks).
+   --  The source is terminated by an EOF (16#1A#) character, which is the last
+   --  character of the returned source buffer (note that any EOF characters in
+   --  positions other than the last source character are treated as blanks).
    --
    --  The logical lower bound of the source buffer is the input value of Lo,
    --  and on exit Hi is set to the logical upper bound of the source buffer.
@@ -363,10 +449,10 @@ package Osint is
    --  without any directory information. The implementation is responsible
    --  for searching for the file in the appropriate directories.
    --
-   --  Note the special case that if the file name is gnat.adc, then the
-   --  search for the file is done ONLY in the directory corresponding to
-   --  the current compilation environment, i.e. in the same directory
-   --  where the ali and object files will be written.
+   --  Note the special case that if the file name is gnat.adc, then the search
+   --  for the file is done ONLY in the directory corresponding to the current
+   --  compilation environment, i.e. in the same directory where the ali and
+   --  object files will be written.
 
    function Full_Source_Name return File_Name_Type;
    function Current_Source_File_Stamp return Time_Stamp_Type;
@@ -374,16 +460,23 @@ package Osint is
    --  using Read_Source_File. Calling this routine entails no source file
    --  directory lookup penalty.
 
+   procedure Full_Source_Name
+     (N         : File_Name_Type;
+      Full_File : out File_Name_Type;
+      Attr      : access File_Attributes);
    function Full_Source_Name (N : File_Name_Type) return File_Name_Type;
    function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-   --  Returns the full name/time stamp of the source file whose simple name is
-   --  N which should not include path information. Note that if the file
+   --  Returns the full name/time stamp of the source file whose simple name
+   --  is N which should not include path information. Note that if the file
    --  cannot be located No_File is returned for the first routine and an all
    --  blank time stamp is returned for the second (this is not an error
    --  situation). The full name includes appropriate directory information.
    --  The source file directory lookup penalty is incurred every single time
    --  the routines are called unless you have previously called
    --  Source_File_Data (Cache => True). See below.
+   --
+   --  The procedural version also returns some file attributes for the ALI
+   --  file (to save on system calls later on).
 
    function Current_File_Index return Int;
    --  Return the index in its source file of the current main unit
@@ -401,18 +494,24 @@ package Osint is
    --  Source_File_Stamp (N) is made. This may be undesirable in certain
    --  applications as this is uselessly slow if source file data does not
    --  change during program execution. When this procedure is called with
-   --  Cache => True access to source file data does not encurr a penalty if
+   --  Cache => True access to source file data does not incur a penalty if
    --  this data was previously retrieved.
 
+   procedure Dump_Source_File_Names;
+   --  Prints out the names of all source files that have been read by
+   --  Read_Source_File, except those that come from the run-time library
+   --  (i.e. Include_Dir_Default_Prefix). The text is sent to whatever Output
+   --  is currently using (e.g. standard output or standard error).
+
    -------------------------------------------
    -- Representation of Library Information --
    -------------------------------------------
 
-   --  Associated with each compiled source file is library information,
-   --  a string of bytes whose exact format is described in the body of
-   --  Lib.Writ. Compiling a source file generates this library information
-   --  for the compiled unit, and access the library information for units
-   --  that were compiled previously on which the unit being compiled depends.
+   --  Associated with each compiled source file is library information, a
+   --  string of bytes whose exact format is described in the body of Lib.Writ.
+   --  Compiling a source file generates this library information for the
+   --  compiled unit, and access the library information for units that were
+   --  compiled previously on which the unit being compiled depends.
 
    --  How this information is stored is up to the implementation of this
    --  package. At the interface level, this information is simply associated
@@ -454,7 +553,7 @@ package Osint is
    --  whose name is given by the parameter Name.
    --
    --  See description of Read_Source_File for details on the format of the
-   --  returned text buffer (the format is identical). THe lower bound of
+   --  returned text buffer (the format is identical). The lower bound of
    --  the Text_Buffer is always zero
    --
    --  If the specified file cannot be opened, then the action depends on
@@ -464,15 +563,25 @@ package Osint is
    --  include any directory information. The implementation is responsible
    --  for searching for the file in appropriate directories.
    --
-   --  If Opt.Check_Object_Consistency is set to True then this routine
-   --  checks whether the object file corresponding to the Lib_File is
-   --  consistent with it. The object file is inconsistent if the object
-   --  does not exist or if it has an older time stamp than Lib_File.
-   --  This check is not performed when the Lib_File is "locked" (i.e.
-   --  read/only) because in this case the object file may be buried
-   --  in a library. In case of inconsistencies Read_Library_Info
-   --  behaves as if it did not find Lib_File (namely if Fatal_Err is
-   --  False, null is returned).
+   --  If Opt.Check_Object_Consistency is set to True then this routine checks
+   --  whether the object file corresponding to the Lib_File is consistent with
+   --  it. The object file is inconsistent if the object does not exist or if
+   --  it has an older time stamp than Lib_File. This check is not performed
+   --  when the Lib_File is "locked" (i.e. read/only) because in this case the
+   --  object file may be buried in a library. In case of inconsistencies
+   --  Read_Library_Info behaves as if it did not find Lib_File (namely if
+   --  Fatal_Err is False, null is returned).
+
+   function Read_Library_Info_From_Full
+     (Full_Lib_File : File_Name_Type;
+      Lib_File_Attr : access File_Attributes;
+      Fatal_Err     : Boolean := False) return Text_Buffer_Ptr;
+   --  Same as Read_Library_Info, except Full_Lib_File must contains the full
+   --  path to the library file (instead of having Read_Library_Info recompute
+   --  it).
+   --  Lib_File_Attr should be an initialized set of attributes for the
+   --  library file (it can be initialized to Unknown_Attributes, but in
+   --  general will have been initialized by a previous call to Find_File).
 
    function Full_Library_Info_Name return File_Name_Type;
    function Full_Object_File_Name return File_Name_Type;
@@ -480,7 +589,7 @@ package Osint is
    --  using Read_Library_Info, including appropriate directory information.
    --  Calling this routine entails no library file directory lookup
    --  penalty. Note that the object file corresponding to a library file
-   --  is not actually read. Its time stamp is fected when the flag
+   --  is not actually read. Its time stamp is affected when the flag
    --  Opt.Check_Object_Consistency is set.
 
    function Current_Library_File_Stamp return Time_Stamp_Type;
@@ -489,33 +598,46 @@ package Osint is
    --  It is an error to call Current_Object_File_Stamp if
    --  Opt.Check_Object_Consistency is set to False.
 
+   procedure Full_Lib_File_Name
+     (N        : File_Name_Type;
+      Lib_File : out File_Name_Type;
+      Attr     : out File_Attributes);
    function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
-   function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-   --  Returns the full name/time stamp of library file N. N should not
-   --  include path information. Note that if the file cannot be located
-   --  No_File is returned for the first routine and an all blank time stamp
-   --  is returned for the second (this is not an error situation). The
-   --  full name includes the appropriate directory information. The library
-   --  file directory lookup penalty is incurred every single time this
-   --  routine is called.
+   --  Returns the full name of library file N. N should not include
+   --  path information. Note that if the file cannot be located No_File is
+   --  returned for the first routine and an all blank time stamp is returned
+   --  for the second (this is not an error situation). The full name includes
+   --  the appropriate directory information. The library file directory lookup
+   --  penalty is incurred every single time this routine is called.
+   --  The procedural version also returns some file attributes for the ALI
+   --  file (to save on system calls later on).
 
    function Lib_File_Name
      (Source_File : File_Name_Type;
       Munit_Index : Nat := 0) return File_Name_Type;
    --  Given the name of a source file, returns the name of the corresponding
-   --  library information file. This may be the name of the object file, or
-   --  of a separate file used to store the library information. In either case
-   --  the returned result is suitable for use in a call to Read_Library_Info.
-   --  The Munit_Index is the unit index in multiple unit per file mode, or
-   --  zero in normal single unit per file mode (used to add ~nnn suffix).
-   --  Note: this subprogram is in this section because it is used by the
-   --  compiler to determine the proper library information names to be placed
-   --  in the generated library information file.
+   --  library information file. This may be the name of the object file or of
+   --  a separate file used to store the library information. In the current
+   --  implementation, a separate file (the ALI file) is always used. In either
+   --  case the returned result is suitable for calling Read_Library_Info. The
+   --  Munit_Index is the unit index in multiple unit per file mode, or zero in
+   --  normal single unit per file mode (used to add ~nnn suffix). Note: this
+   --  subprogram is in this section because it is used by the compiler to
+   --  determine the proper library information names to be placed in the
+   --  generated library information file.
 
    -----------------
    -- Termination --
    -----------------
 
+   Current_Exit_Status : Integer := 0;
+   --  Exit status that is set with procedure OS_Exit_Through_Exception below
+   --  and can be used in exception handler for Types.Terminate_Program to call
+   --  Set_Exit_Status as the last action of the program.
+
+   procedure OS_Exit_Through_Exception (Status : Integer);
+   --  Set the Current_Exit_Status, then raise Types.Terminate_Program
+
    type Exit_Code_Type is (
       E_Success,    -- No warnings or errors
       E_Warnings,   -- Compiler warnings generated
@@ -551,10 +673,11 @@ package Osint is
    pragma Import (C, Len_Arg, "__gnat_len_arg");
    --  Get length of argument
 
-private
+   ALI_Default_Suffix : constant String_Ptr := new String'("ali");
+   ALI_Suffix         : String_Ptr          := ALI_Default_Suffix;
+   --  The suffixes used for the library files (also known as ALI files)
 
-   ALI_Suffix : constant String_Ptr := new String'("ali");
-   --  The suffix used for the library files (also known as ALI files)
+private
 
    Current_Main : File_Name_Type := No_File;
    --  Used to save a simple file name between calls to Next_Main_Source and
@@ -579,7 +702,7 @@ private
    type File_Name_Array_Ptr is access File_Name_Array;
    File_Names : File_Name_Array_Ptr :=
                   new File_Name_Array (1 .. Int (Argument_Count) + 2);
-   --  As arguments are scanned, file names are stored in this array The
+   --  As arguments are scanned, file names are stored in this array. The
    --  strings do not have terminating NUL files. The array is extensible,
    --  because when using project files, there may be more files than
    --  arguments on the command line.
@@ -601,7 +724,7 @@ private
    --  length in Name_Len), and place the resulting descriptor in Fdesc. Issue
    --  message and exit with fatal error if file cannot be created. The Fmode
    --  parameter is set to either Text or Binary (for details see description
-   --  of GNAT.OS_Lib.Create_File).
+   --  of System.OS_Lib.Create_File).
 
    type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified);
    --  Program currently running
@@ -633,4 +756,21 @@ private
    --  detected, the file being written is deleted, and a fatal error is
    --  signalled.
 
+   File_Attributes_Size : constant Natural := 24;
+   --  This should be big enough to fit a "struct file_attributes" on any
+   --  system. It doesn't cause any malfunction if it is too big (which avoids
+   --  the need for either mapping the struct exactly or importing the sizeof
+   --  from C, which would result in dynamic code). However, it does waste
+   --  space (e.g. when a component of this type appears in a record, if it is
+   --  unnecessarily large.
+
+   type File_Attributes is
+     array (1 .. File_Attributes_Size)
+       of System.Storage_Elements.Storage_Element;
+   for File_Attributes'Alignment use Standard'Maximum_Alignment;
+
+   Unknown_Attributes : constant File_Attributes := (others => 0);
+   --  Will be initialized properly at elaboration (for efficiency later on,
+   --  avoid function calls every time we want to reset the attributes).
+
 end Osint;