Next: , Previous: Pragma Keep_Names, Up: Implementation Defined Pragmas



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.

These default actions means that a program with a restricted license pragma will automatically get warnings if a GPL unit is inappropriately with'ed. 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.