aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-08-14 09:52:34 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-14 09:52:34 +0000
commit0246fe44ac945c563cb57fdb625746293d8f8334 (patch)
tree9db685731cb31ee14f9eb0699b9b078e15bd300d /gcc/ada/sem_prag.ads
parentebf7f0abade68c85557af4f634fe68b86c34f751 (diff)
downloadgcc-0246fe44ac945c563cb57fdb625746293d8f8334.zip
gcc-0246fe44ac945c563cb57fdb625746293d8f8334.tar.gz
gcc-0246fe44ac945c563cb57fdb625746293d8f8334.tar.bz2
[Ada] Warn about unknown condition in Compile_Time_Warning
The compiler now warns if the condition in a pragma Compile_Time_Warning or Compile_Time_Error does not have a compile-time-known value. The warning is not given for pragmas in a generic template, but is given for pragmas in an instance. The -gnatw_c and -gnatw_C switches turn the warning on and off. The default is on. 2019-08-14 Bob Duff <duff@adacore.com> gcc/ada/ * sem_prag.ads, sem_prag.adb (Process_Compile_Time_Warning_Or_Error): In parameterless version, improve detection of whether we are in a generic unit to cover the case of an instance within a generic unit. (Process_Compile_Time_Warning_Or_Error): Rename the two-parameter version to be Validate_Compile_Time_Warning_Or_Error, and do not export it. Issue a warning if the condition is not known at compile time. The key point is that the warning must be given only for pragmas deferred to the back end, because the back end discovers additional values that are known at compile time. Previous changes in this ticket have enabled this by deferring to the back end without checking for special cases such as 'Size. (Validate_Compile_Time_Warning_Or_Error): Rename to be Defer_Compile_Time_Warning_Error_To_BE. * warnsw.ads, warnsw.adb (Warn_On_Unknown_Compile_Time_Warning): Add new switches -gnatw_c and -gnatw_C to control the above warning. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Document new switches. * gnat_ugn.texi: Regenerate. gcc/testsuite/ * gnat.dg/warn27.adb: New testcase. From-SVN: r274469
Diffstat (limited to 'gcc/ada/sem_prag.ads')
-rw-r--r--gcc/ada/sem_prag.ads8
1 files changed, 0 insertions, 8 deletions
diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads
index 4978299..88c103a 100644
--- a/gcc/ada/sem_prag.ads
+++ b/gcc/ada/sem_prag.ads
@@ -499,14 +499,6 @@ package Sem_Prag is
-- Name_uInvariant, and Name_uType_Invariant (_Pre, _Post, _Invariant,
-- and _Type_Invariant).
- procedure Process_Compile_Time_Warning_Or_Error
- (N : Node_Id;
- Eloc : Source_Ptr);
- -- Common processing for Compile_Time_Error and Compile_Time_Warning of
- -- pragma N. Called when the pragma is processed as part of its regular
- -- analysis but also called after calling the back end to validate these
- -- pragmas for size and alignment appropriateness.
-
procedure Process_Compilation_Unit_Pragmas (N : Node_Id);
-- Called at the start of processing compilation unit N to deal with any
-- special issues regarding pragmas. In particular, we have to deal with