https://gcc.gnu.org/g:45a305c3c7b431c5be761dd7e05cc99384b32b32

commit r16-1243-g45a305c3c7b431c5be761dd7e05cc99384b32b32
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Mon Feb 24 10:40:16 2025 +0100

    ada: Simplify tests for positive rational numbers
    
    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.

Diff:
---
 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 5e7cba8bef91..76a8c0ba7331 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 b94606eabc71..4090d0c71175 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

Reply via email to