[Ada] Remove redundant checks for empty lists

Pierre-Marie de Rodat derodat@adacore.com
Wed May 5 08:20:05 GMT 2021


When iterating over list elements with First/Next there is no need to
detect empty or non-existing list, because First intentionally returns
Empty in those cases.

Cleanup of code related to Unchecked_Unions; behaviour is unaffected.

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

gcc/ada/

	* exp_ch4.adb (Variant_Is_Unconstrained_UU): Remove redundant
	check for empty list.
	* exp_disp.adb (Find_Entry_Index): Simplify by removing
	redundant check and counting from zero; fix type of a local
	variable.
	* sem_ch12.adb (Save_Global_Descendant): Remove an unnecessary
	special-case for empty lists.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 3404 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210505/c0a9be81/attachment-0001.bin>


More information about the Gcc-patches mailing list