r274469 - in /trunk/gcc: ada/ChangeLog ada/doc/...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Wed Aug 14 09:52:00 GMT 2019


Author: pmderodat
Date: Wed Aug 14 09:52:34 2019
New Revision: 274469

URL: https://gcc.gnu.org/viewcvs?rev=274469&root=gcc&view=rev
Log:
[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.

Added:
    trunk/gcc/testsuite/gnat.dg/warn27.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
    trunk/gcc/ada/gnat_ugn.texi
    trunk/gcc/ada/sem_prag.adb
    trunk/gcc/ada/sem_prag.ads
    trunk/gcc/ada/warnsw.adb
    trunk/gcc/ada/warnsw.ads
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list