From: Piotr Trojanek <troja...@adacore.com> Checking a rational number for being positive takes a shorter code path than a general comparison with zero. Code cleanup; semantics is unaffected.
gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Tune code for attribute Small. * sem_prag.adb (Analyze_Attribute): Tune code for pragma Time_Slice. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 2 +- gcc/ada/sem_prag.adb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 5e7cba8bef9..76a8c0ba733 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -7250,7 +7250,7 @@ package body Sem_Ch13 is else Small := Expr_Value_R (Expr); - if Small <= Ureal_0 then + if not UR_Is_Positive (Small) then Error_Msg_N ("small value must be greater than zero", Expr); return; end if; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b94606eabc7..4090d0c7117 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -26953,7 +26953,7 @@ package body Sem_Prag is Opt.Time_Slice_Set := True; Val := Expr_Value_R (Get_Pragma_Arg (Arg1)); - if Val <= Ureal_0 then + if not UR_Is_Positive (Val) then Opt.Time_Slice_Value := 0; elsif Val > UR_From_Uint (UI_From_Int (1000)) then -- 2.43.0