Next: , Previous: , Up: Implementation Defined Pragmas   [Contents][Index]


2.99 Pragma License

Syntax:

pragma License (Unrestricted | GPL | Modified_GPL | Restricted);

This pragma is provided to allow automated checking for appropriate license conditions with respect to the standard and modified GPL. A pragma License, which is a configuration pragma that typically appears at the start of a source file or in a separate gnat.adc file, specifies the licensing conditions of a unit as follows:

Normally a unit with no License pragma is considered to have an unknown license, and no checking is done. However, standard GNAT headers are recognized, and license information is derived from them as follows.

A GNAT license header starts with a line containing 78 hyphens. The following comment text is searched for the appearance of any of the following strings.

If the string ’GNU General Public License’ is found, then the unit is assumed to have GPL license, unless the string ’As a special exception’ follows, in which case the license is assumed to be modified GPL.

If one of the strings ’This specification is adapted from the Ada Semantic Interface’ or ’This specification is derived from the Ada Reference Manual’ is found then the unit is assumed to be unrestricted.

These default actions means that a program with a restricted license pragma will automatically get warnings if a GPL unit is inappropriately withed. For example, the program:

with Sem_Ch3;
with GNAT.Sockets;
procedure Secret_Stuff is
  ...
end Secret_Stuff

if compiled with pragma License (Restricted) in a gnat.adc file will generate the warning:

1.  with Sem_Ch3;
        |
   >>> license of withed unit "Sem_Ch3" is incompatible

2.  with GNAT.Sockets;
3.  procedure Secret_Stuff is

Here we get a warning on Sem_Ch3 since it is part of the GNAT compiler and is licensed under the GPL, but no warning for GNAT.Sockets which is part of the GNAT run time, and is therefore licensed under the modified GPL.


Next: , Previous: , Up: Implementation Defined Pragmas   [Contents][Index]