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


Pragma Obsolescent

Syntax:

     pragma Obsolescent [(static_string_EXPRESSION [,Ada_05])];

This pragma can occur immediately following a subprogram declaration and indicates that the associated function or procedure is considered obsolescent and should not be used. Typically this is used when an API must be modified by eventually removing or modifying existing subprograms. The pragma can be used at an intermediate stage when the subprogram is still present, but will be removed later.

The effect of this pragma is to output a warning message on a call to a program thus marked that the subprogram is obsolescent if the appropriate warning option in the compiler is activated. If a parameter is present, then a second warning message is given containing this text. In addition, a call to such a program is considered a violation of pragma Restrictions (No_Obsolescent_Features).

This pragma can also be used as a program unit pragma for a package, in which case it indicates that the entire package is considered obsolescent. In this case a client with'ing such a package violates the restriction, and the with statement is flagged with warnings if the warning option is set.

If the optional second parameter is present (which must be exactly the identifier Ada_05, no other argument is allowed), then the indication of obsolescence applies only when compiling in Ada 2005 mode. This is primarily intended for dealing with the situations in the predefined library where subprograms or packages have become defined as obsolescent in Ada 2005 (e.g. in Ada.Characters.Handling), but may be used anywhere.