[Ada] Remove warnings-as-errors about constraints error in dead code

Pierre-Marie de Rodat derodat@adacore.com
Tue Jan 11 13:31:59 GMT 2022


GNAT removes error messages attached to nodes within dead code; in
particular, within instances of generic units with alternative branches
for different generic formal types and parameters. Now this removal also
works for error messages that come from warnings about constraint errors
that have been escalated into hard errors due to -gnatwE switch.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* erroutc.ads, erroutc.adb (Is_Runtime_Raise): Global flag to
	connect status of initial messages and their continuation; we
	already have several flags like this.
	(Error_Msg_Object): Add field Warn_Runtime_Raise to connect
	error reporting (when problematic code is found) and removal
	(when problematic code is determined to be dead).
	* errout.adb (Error_Msg_Internal): Handle new field when
	recording a continuation message; propagate status from
	continuation to the preceding messages.
	(To_Be_Removed): For dead code remove both simple warnings and
	warnings about constraint errors that have been escalated to
	hard errors.
	(Set_Msg_Text): Recognize warnings about constraint errors that
	are escalated to hard errors.
	* errutil.adb (Error_Msg): Handle added field when recording a
	new message.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 4639 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20220111/72b82c9d/attachment.bin>


More information about the Gcc-patches mailing list