public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5095] [Ada] Do not assume a priority value of zero is a valid priority
@ 2021-11-10  8:59 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-11-10  8:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:301526488738f16fa1018a2f1c9ce3138ecdf2cb

commit r12-5095-g301526488738f16fa1018a2f1c9ce3138ecdf2cb
Author: Patrick Bernardi <bernardi@adacore.com>
Date:   Wed Nov 3 17:55:50 2021 -0400

    [Ada] Do not assume a priority value of zero is a valid priority
    
    gcc/ada/
    
            * libgnarl/s-taskin.adb (Initialize_ATCB): Initialize
            T.Common.Current_Priority to Priority'First.
            * libgnarl/s-taskin.ads (Unspecified_Priority): Redefined as -1.
            * libgnat/system-rtems.ads: Start priority range from 1, as 0 is
            reserved by the operating system.

Diff:
---
 gcc/ada/libgnarl/s-taskin.adb    | 2 +-
 gcc/ada/libgnarl/s-taskin.ads    | 5 ++++-
 gcc/ada/libgnat/system-rtems.ads | 8 +++-----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/libgnarl/s-taskin.adb b/gcc/ada/libgnarl/s-taskin.adb
index ab50af14138..1e6f42da393 100644
--- a/gcc/ada/libgnarl/s-taskin.adb
+++ b/gcc/ada/libgnarl/s-taskin.adb
@@ -127,7 +127,7 @@ package body System.Tasking is
       end if;
       pragma Assert (T.Common.Domain /= null);
 
-      T.Common.Current_Priority         := 0;
+      T.Common.Current_Priority         := Priority'First;
       T.Common.Protected_Action_Nesting := 0;
       T.Common.Call                     := null;
       T.Common.Task_Arg                 := Task_Arg;
diff --git a/gcc/ada/libgnarl/s-taskin.ads b/gcc/ada/libgnarl/s-taskin.ads
index cf560b569fb..1751553c58c 100644
--- a/gcc/ada/libgnarl/s-taskin.ads
+++ b/gcc/ada/libgnarl/s-taskin.ads
@@ -773,7 +773,10 @@ package System.Tasking is
    -- Priority info --
    -------------------
 
-   Unspecified_Priority : constant Integer := System.Priority'First - 1;
+   Unspecified_Priority : constant Integer := -1;
+   --  Indicates that a task has an unspecified priority. This is hardcoded as
+   --  -1 rather than System.Priority'First - 1 as the value needs to be used
+   --  in init.c to specify that the main task has no specified priority.
 
    Priority_Not_Boosted : constant Integer := System.Priority'First - 1;
    --  Definition of Priority actually has to come from the RTS configuration
diff --git a/gcc/ada/libgnat/system-rtems.ads b/gcc/ada/libgnat/system-rtems.ads
index c083cb5fd44..77423d316ba 100644
--- a/gcc/ada/libgnat/system-rtems.ads
+++ b/gcc/ada/libgnat/system-rtems.ads
@@ -109,15 +109,13 @@ package System is
    --             hardware priority levels.  Protected Object ceilings can
    --             override these values.
    --  245        is used by the Interrupt_Manager task
-   --  0          is reserved for the RTEMS IDLE task and really should not
-   --             be accessible from Ada but GNAT initializes
-   --             Current_Priority to 0 so it must be valid
+   --  0          is reserved for the RTEMS IDLE task
 
    Max_Priority           : constant Positive := 244;
    Max_Interrupt_Priority : constant Positive := 254;
 
-   subtype Any_Priority       is Integer      range   0 .. 254;
-   subtype Priority           is Any_Priority range   0 .. 244;
+   subtype Any_Priority       is Integer      range   1 .. 254;
+   subtype Priority           is Any_Priority range   1 .. 244;
    subtype Interrupt_Priority is Any_Priority range 245 .. 254;
 
    Default_Priority : constant Priority := 122;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-10  8:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  8:59 [gcc r12-5095] [Ada] Do not assume a priority value of zero is a valid priority Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).