Pragma Compile_Time_Warning (GNAT Reference Manual)

### 2.31 Pragma Compile_Time_Warning ¶

Syntax:

    pragma Compile_Time_Warning
             (boolean_EXPRESSION, static_string_EXPRESSION);

Same as pragma Compile_Time_Error, except a warning is issued instead of an error message. If switch ‘-gnatw_C’ is used, a warning is only issued if the value of the expression is known to be True at compile time, not when the value of the expression is not known at compile time. Note that if this pragma is used in a package that is with’ed by a client, the client will get the warning even though it is issued by a with’ed package (normally warnings in with’ed units are suppressed, but this is a special exception to that rule).

One typical use is within a generic where compile time known characteristics of formal parameters are tested, and warnings given appropriately. Another use with a first parameter of True is to warn a client about use of a package, for example that it is not fully implemented.

In previous versions of the compiler, combining ‘-gnatwe’ with Compile_Time_Warning resulted in a fatal error. Now the compiler always emits a warning. You can use Pragma Compile_Time_Error to force the generation of an error.