The GNAT compiler must be able to know the source file name of a compilation
unit. When using the standard GNAT default file naming conventions
(.ads
for specs, .adb
for bodies), the GNAT compiler
does not need additional information.
When the source file names do not follow the standard GNAT default file naming
conventions, the GNAT compiler must be given additional information through
a configuration pragmas file (see Configuration Pragmas)
or a project file.
When the non-standard file naming conventions are well-defined,
a small number of pragmas Source_File_Name
specifying a naming pattern
(see Alternative File Naming Schemes) may be sufficient. However,
if the file naming conventions are irregular or arbitrary, a number
of pragma Source_File_Name
for individual compilation units
must be defined.
To help maintain the correspondence between compilation unit names and
source file names within the compiler,
GNAT provides a tool gnatname
to generate the required pragmas for a
set of files.