diff options
author | Yannick Moy <moy@adacore.com> | 2019-12-11 10:21:57 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-05-25 10:00:55 -0400 |
commit | 1a14bfbd78324a25943998ed1e877e41ec4cd417 (patch) | |
tree | d0e872f1ccf8f88f00a3c65d46fc0245941a19e8 /gcc/ada/doc | |
parent | 4354291994e6f6cb6eba1acef3192fa5c18b1274 (diff) | |
download | gcc-1a14bfbd78324a25943998ed1e877e41ec4cd417.zip gcc-1a14bfbd78324a25943998ed1e877e41ec4cd417.tar.gz gcc-1a14bfbd78324a25943998ed1e877e41ec4cd417.tar.bz2 |
[Ada] Change pragma Compile_Time_Error to force compile-time evaluation
2020-05-25 Yannick Moy <moy@adacore.com>
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst: Document
changes to pragmas Compile_Time_Error/Compile_Time_Warning.
* gnat_rm.texi: Regenerate.
* libgnat/g-bytswa.adb: Change uses of Compile_Time_Error to
Compile_Time_Warning, as the actual expression may not always be
known statically.
* sem_prag.adb (Analyze_Pragma): Handle differently pragma
Compile_Time_Error in both compilation and in GNATprove mode.
(Validate_Compile_Time_Warning_Or_Error): Issue an error or
warning when the expression is not known at compile time.
* usage.adb: Add missing documentation for warning switches _c
and _r.
* warnsw.ads: Update comment.
Diffstat (limited to 'gcc/ada/doc')
-rw-r--r-- | gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index c3d6f90..471bfdc 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -1094,14 +1094,14 @@ This pragma can be used to generate additional compile time error messages. It is particularly useful in generics, where errors can be issued for specific problematic instantiations. The first parameter is a boolean -expression. The pragma is effective only if the value of this expression -is known at compile time, and has the value True. The set of expressions +expression. The pragma ensures that the value of an expression +is known at compile time, and has the value False. The set of expressions whose values are known at compile time includes all static boolean expressions, and also other values which the compiler can determine at compile time (e.g., the size of a record type set by an explicit size representation clause, or the value of a variable which was initialized to a constant and is known not to have been modified). -If these conditions are met, an error message is generated using +If these conditions are not met, an error message is generated using the value given as the second argument. This string value may contain embedded ASCII.LF characters to break the message into multiple lines. @@ -1118,7 +1118,10 @@ Syntax: Same as pragma Compile_Time_Error, except a warning is issued instead -of an error message. Note that if this pragma is used in a package that +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). |