diff options
author | Bob Duff <duff@adacore.com> | 2019-08-14 09:52:34 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-14 09:52:34 +0000 |
commit | 0246fe44ac945c563cb57fdb625746293d8f8334 (patch) | |
tree | 9db685731cb31ee14f9eb0699b9b078e15bd300d /libgo | |
parent | ebf7f0abade68c85557af4f634fe68b86c34f751 (diff) | |
download | gcc-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 'libgo')
0 files changed, 0 insertions, 0 deletions