Re: [PATCH] Fix missing/wrong function declaration in s-osinte-rtems.ads (ada/71317)

2016-05-31 Thread Jan Sommer
Am Dienstag, 31. Mai 2016, 21:00:07 CEST schrieb Eric Botcazou:
> > this patch fixes the build failures of recent gnat compiler version for
> > RTEMS targets (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71317).
> > Attached are patches for trunk, gcc-5-branch and gcc-6-branch.
> > I don't have write access to the svn, so if the patches pass the review
> > process please commit them.
> 
> Patches applied on mainline and 6 branch, but not on the 5 branch since the 
> signature of Get_Page_Size is correct there.

Thank you. 
I attached a patch for 5 branch which will only add the clock_getres-function.



Index: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 236948)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2016-05-31  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	PR ada/71317
+	* s-osinte-rtems.ads: Fix missing/wrong function declarations:
+	Missing: clock_getres
+
 2016-05-06  Eric Botcazou  <ebotca...@adacore.com>
 
 	PR ada/70969
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 236948)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -188,6 +188,11 @@ package System.OS_Interface is
   tp   : access timespec) return int;
pragma Import (C, clock_gettime, "clock_gettime");
 
+   function clock_getres
+ (clock_id : clockid_t;
+  res  : access timespec) return int;
+   pragma Import (C, clock_getres, "clock_getres");
+
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
 


[PATCH] Fix missing/wrong function declaration in s-osinte-rtems.ads (ada/71317)

2016-05-27 Thread Jan Sommer
Hello,

this patch fixes the build failures of recent gnat compiler version for RTEMS 
targets (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71317).
Attached are patches for trunk, gcc-5-branch and gcc-6-branch.
I don't have write access to the svn, so if the patches pass the review process 
please commit them.

CC is the maintainer of the RTEMS project in case there are some further 
questions.

Best regards,

   Jan

Index: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 236835)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,10 @@
+2016-05-27  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	PR ada/71317
+	* s-osinte-rtems.ads: Fix missing/wrong function declarations:
+	Missing: clock_getres
+	Wrong:   Get_Page_Size
+
 2016-05-06  Eric Botcazou  <ebotca...@adacore.com>
 
 	PR ada/70969
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 236835)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -188,6 +188,11 @@ package System.OS_Interface is
   tp   : access timespec) return int;
pragma Import (C, clock_gettime, "clock_gettime");
 
+   function clock_getres
+ (clock_id : clockid_t;
+  res  : access timespec) return int;
+   pragma Import (C, clock_getres, "clock_getres");
+
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
 
@@ -291,8 +296,7 @@ package System.OS_Interface is
--  These two functions are only needed to share s-taprop.adb with
--  FSU threads.
 
-   function Get_Page_Size return size_t;
-   function Get_Page_Size return Address;
+   function Get_Page_Size return int;
pragma Import (C, Get_Page_Size, "getpagesize");
--  Returns the size of a page
 
Index: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 236834)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,10 @@
+2016-05-27  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	PR ada/71317
+	* s-osinte-rtems.ads: Fix missing/wrong function declarations:
+	Missing: clock_getres
+	Wrong:   Get_Page_Size
+
 2016-05-06  Eric Botcazou  <ebotca...@adacore.com>
 
 	PR ada/70969
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 236834)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -188,6 +188,11 @@ package System.OS_Interface is
   tp   : access timespec) return int;
pragma Import (C, clock_gettime, "clock_gettime");
 
+   function clock_getres
+ (clock_id : clockid_t;
+  res  : access timespec) return int;
+   pragma Import (C, clock_getres, "clock_getres");
+
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
 
@@ -291,8 +296,7 @@ package System.OS_Interface is
--  These two functions are only needed to share s-taprop.adb with
--  FSU threads.
 
-   function Get_Page_Size return size_t;
-   function Get_Page_Size return Address;
+   function Get_Page_Size return int;
pragma Import (C, Get_Page_Size, "getpagesize");
--  Returns the size of a page
 
Index: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 236834)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,10 @@
+2016-05-27  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	PR ada/71317
+	* s-osinte-rtems.ads: Fix missing/wrong function declarations:
+	Missing: clock_getres
+	Wrong:   Get_Page_Size
+
 2016-05-20  Eric Botcazou  <ebotca...@adacore.com>
 
 	* gcc-interface/decl.c (gnat_to_gnu_entity) :
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 236834)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -188,6 +188,11 @@ package System.OS_Interface is
   tp   : access timespec) return int;
pragma Import (C, clock_gettime, "clock_gettime");
 
+   function clock_getres
+ (clock_id : clockid_t;
+  res  : access timespec) return int;
+   pragma Import (C, clock_getres, "clock_getres");
+
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
 
@@ -291,8 +296,7 @@ package System.OS_Interface is
--  These two functions are only needed to share s-taprop.adb with
--  FSU threads.
 
-   function Get_Page_Size return size_t;
-   function Get_Page_Size return Address;
+   function Get_Page_Size return int;
pragma Import (C, Get_Page_Size, "getpagesize");
--  Returns the size of a page
 


Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads (ada/68169)

2015-12-02 Thread Jan Sommer
Am Wednesday 02 December 2015, 08:13:20 schrieb Joel Sherrill:
> 
> On December 2, 2015 2:14:22 AM EST, Jeff Law <l...@redhat.com> wrote:
> >On 12/01/2015 12:56 PM, Jan Sommer wrote:
> >> Am Monday 30 November 2015, 16:19:30 schrieb Jeff Law:
> >>> On 11/30/2015 03:06 PM, Jan Sommer wrote:
> >>>> Could someone with write access please commit the patch?
> >>>> The paperwork with the FSF has gone through. If something else is
> >missing, please tell me.
> >>>> I won't be available next week.
> >>> I'm not sure what you built your patches again, but I can't apply
> >them
> >>> to the trunk.  Can you resend a patch as a diff against the trunk.
> >>>
> >>> Often I can fix things by hand, but this is Ada and I'd be much more
> >>> likely to botch something.
> >>
> >> I updated the patches again. They should now fit with the heads of
> >the respective branches again.
> >> Maybe the Changelog will be out of synch again.
> >> The patches are for the following branches:
> >> ada-68169_4.9.diff   -->  gcc-4_9-branch
> >> ada-68169_5.x.diff  -->   gcc-5-branch
> >> ada-68169_trunk.diff --> trunk
> >>
> >> Let me know if they apply this time. I used svn diff to create them
> >and used patch -p0 to test if they apply locally.
> >THanks.  I've committed this to the trunk based on Joel's comments.
> >
> >The gcc-5 branch is frozen for the upcoming release and gcc-4.9 is 
> >regression/doc fixes only.  It'll be up to the release managers whether
> >
> >or not to backport to those branches.
> 
> Thanks Jeff. 
> 
> I would consider this a regression. RTEMS changed the pthread_attr_t when we 
> added thread affinity and updating Ada to match slipped through. We knew it 
> needed attention for SMP but missed this critical piece to keep it working.
> 
> Jan.. Is there a gcc PR for this? To get it on a release branch, it is better 
> to have one.
> 

Yes, I created this one: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169



Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads (ada/68169)

2015-12-01 Thread Jan Sommer
Am Monday 30 November 2015, 16:19:30 schrieb Jeff Law:
> On 11/30/2015 03:06 PM, Jan Sommer wrote:
> > Could someone with write access please commit the patch?
> > The paperwork with the FSF has gone through. If something else is missing, 
> > please tell me.
> > I won't be available next week.
> I'm not sure what you built your patches again, but I can't apply them 
> to the trunk.  Can you resend a patch as a diff against the trunk.
> 
> Often I can fix things by hand, but this is Ada and I'd be much more 
> likely to botch something.

I updated the patches again. They should now fit with the heads of the 
respective branches again.
Maybe the Changelog will be out of synch again.
The patches are for the following branches:
ada-68169_4.9.diff   -->  gcc-4_9-branch
ada-68169_5.x.diff  -->   gcc-5-branch
ada-68169_trunk.diff --> trunk

Let me know if they apply this time. I used svn diff to create them and used 
patch -p0 to test if they apply locally.

Thank you,

  Jan

> 
> 
> jeff
> 
> 
Index: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 231125)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2015-12-01  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	* s-oscons-tmplt.c: Generate pthread constants for RTEMS
+	* s-osinte-rtems.ads: Declare pthread structs as opaque types in Ada
+	Fixes PR ada/68169
+
 2015-11-29  Matthias Klose  <d...@ubuntu.com>
 
 	PR ada/68564
Index: gcc/ada/s-oscons-tmplt.c
===
--- gcc/ada/s-oscons-tmplt.c	(Revision 231125)
+++ gcc/ada/s-oscons-tmplt.c	(Arbeitskopie)
@@ -154,7 +154,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#ifdef __linux__
+#if defined (__linux__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1441,7 +1441,8 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 CNS(CLOCK_RT_Ada, "")
 #endif
 
-#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
+#if defined (__APPLE__) || defined (__linux__) || defined (__rtems__) || \
+  defined (DUMMY)
 /*
 
--  Sizes of pthread data types
@@ -1484,7 +1485,7 @@ CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t
 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
 CND(PTHREAD_ONCE_SIZE,   "pthread_once_t")
 
-#endif /* __APPLE__ || __linux__ */
+#endif /* __APPLE__ || __linux__ || __rtems__*/
 
 /*
 
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 231125)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
 
+   subtype char_array is Interfaces.C.char_array;
+
type pthread_attr_t is record
-  is_initialized  : int;
-  stackaddr   : System.Address;
-  stacksize   : int;
-  contentionscope

Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads (ada/68169)

2015-11-30 Thread Jan Sommer
Could someone with write access please commit the patch?
The paperwork with the FSF has gone through. If something else is missing, 
please tell me.
I won't be available next week.

Best regards,

   Jan

Am Tuesday 24 November 2015, 08:47:49 schrieb Jan Sommer:
> It has gone through.
> That was why I resubmitted the patch.
> Joel can confirm. Apparently he is on a respective list and saw my paperwork 
> being cleared.
> 
> Best regards,
> 
>Jan
> 
> Am Tuesday 24 November 2015, 07:45:30 schrieb Sebastian Huber:
> > Hello Jan,
> > 
> > On 23/11/15 23:15, Jan Sommer wrote:
> > > If someone with commit rights could check and push the patches we might 
> > > get it into the next release.
> > 
> > what is the status of your copyright assignment to the FSF which is 
> > required to integrate changes into GCC?
> > 
> > 
> 
> ___
> devel mailing list
> de...@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



[PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads (ada/68169)

2015-11-23 Thread Jan Sommer
Just noticed that I forgot to crosspost this mail to the rtems-devel list.

If someone with commit rights could check and push the patches we might get it 
into the next release.

Cheers,

   Jan--- Begin Message ---
Hello,

The paperwork seems to have gone through.
Here is the patch again for the 4.9.x, 5.x and trunk respectively.
I just pulled the head of the corresponding branches and created a new diff, so 
it should apply properly.

Best regards,

   JanIndex: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 230563)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2015-11-18  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	* s-oscons-tmplt.c: Generate pthread constants for RTEMS
+	* s-osinte-rtems.ads: Declare pthread structs as opaque types in Ada
+	Fixes PR ada/68169
+
 2015-10-09  Eric Botcazou  <ebotca...@adacore.com>
 
 	* gcc-interface/Make-lang.in: Make sure that GNAT1_OBJS and not just
Index: gcc/ada/s-oscons-tmplt.c
===
--- gcc/ada/s-oscons-tmplt.c	(Revision 230563)
+++ gcc/ada/s-oscons-tmplt.c	(Arbeitskopie)
@@ -154,7 +154,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#ifdef __linux__
+#if defined (__linux__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1441,7 +1441,8 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 CNS(CLOCK_RT_Ada, "")
 #endif
 
-#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
+#if defined (__APPLE__) || defined (__linux__) || defined (__rtems__) || \
+  defined (DUMMY)
 /*
 
--  Sizes of pthread data types
@@ -1484,7 +1485,7 @@ CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t
 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
 CND(PTHREAD_ONCE_SIZE,   "pthread_once_t")
 
-#endif /* __APPLE__ || __linux__ */
+#endif /* __APPLE__ || __linux__ || __rtems__*/
 
 /*
 
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 230563)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
 
+   subtype char_array is Interfaces.C.char_array;
+
type pthread_attr_t is record
-  is_initialized  : int;
-  stackaddr   : System.Address;
-  stacksize   : int;
-  contentionscope : int;
-  inheritsched: int;
-  schedpolicy : int;
-  schedparam  : struct_sched_param;
-  cputime_clocked_allowed : int;
-  detatchstate: int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE);
end record;
pragma Convention (C, pthread_attr_t);
+   for pthread_attr_t'Alignment use Interfaces.C.double'Alignment;
 
type pthread_condattr_t is record
-  flags   : int;
-  process_shared  : int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE);
end record;

[PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads (ada/68169)

2015-11-18 Thread Jan Sommer
Hello,

The paperwork seems to have gone through.
Here is the patch again for the 4.9.x, 5.x and trunk respectively.
I just pulled the head of the corresponding branches and created a new diff, so 
it should apply properly.

Best regards,

   JanIndex: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 230563)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2015-11-18  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	* s-oscons-tmplt.c: Generate pthread constants for RTEMS
+	* s-osinte-rtems.ads: Declare pthread structs as opaque types in Ada
+	Fixes PR ada/68169
+
 2015-10-09  Eric Botcazou  <ebotca...@adacore.com>
 
 	* gcc-interface/Make-lang.in: Make sure that GNAT1_OBJS and not just
Index: gcc/ada/s-oscons-tmplt.c
===
--- gcc/ada/s-oscons-tmplt.c	(Revision 230563)
+++ gcc/ada/s-oscons-tmplt.c	(Arbeitskopie)
@@ -154,7 +154,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#ifdef __linux__
+#if defined (__linux__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1441,7 +1441,8 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 CNS(CLOCK_RT_Ada, "")
 #endif
 
-#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
+#if defined (__APPLE__) || defined (__linux__) || defined (__rtems__) || \
+  defined (DUMMY)
 /*
 
--  Sizes of pthread data types
@@ -1484,7 +1485,7 @@ CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t
 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
 CND(PTHREAD_ONCE_SIZE,   "pthread_once_t")
 
-#endif /* __APPLE__ || __linux__ */
+#endif /* __APPLE__ || __linux__ || __rtems__*/
 
 /*
 
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 230563)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
 
+   subtype char_array is Interfaces.C.char_array;
+
type pthread_attr_t is record
-  is_initialized  : int;
-  stackaddr   : System.Address;
-  stacksize   : int;
-  contentionscope : int;
-  inheritsched: int;
-  schedpolicy : int;
-  schedparam  : struct_sched_param;
-  cputime_clocked_allowed : int;
-  detatchstate: int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE);
end record;
pragma Convention (C, pthread_attr_t);
+   for pthread_attr_t'Alignment use Interfaces.C.double'Alignment;
 
type pthread_condattr_t is record
-  flags   : int;
-  process_shared  : int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE);
end record;
pragma Convention (C, pthread_condattr_t);
+   for pthread_condattr_t'Alignment use Interfaces.C.double'Alignment;
 
type pthread_mutexattr_t is record
-  is_initialized  : int;
-  process_shared  :

Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-11-04 Thread Jan Sommer
Am Tuesday 03 November 2015, 20:13:50 schrieb Arnaud Charlet:
> > > Your ChangeLog entry is not in the proper format, see sections 6.8.1 and
> > > 6.8.2 from http://www.gnu.org/prep/standards/standards.html
> > > 
> > > The diff itself is OK.
> > 
> > Ok, fixed this. See the new diff below.
> 
> This is now OK, you can go ahead and commit it.
> 

Attached are the 2 final patches. One for trunk and the other one for both the 
gcc-5-branch and the gcc-4_9-branch.
I don't have write access, so one of you would need to commit it.

Thanks,

   JanIndex: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog	(Revision 229739)
+++ gcc/ada/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2015-11-03  Jan Sommer <soja-li...@aries.uberspace.de>
+
+	* s-oscons-tmplt.c: Generate pthread constants for RTEMS
+	* s-osinte-rtems.ads: Declare pthread structs as opaque types in Ada
+	Fixes PR ada/68169
+
 2015-10-09  Eric Botcazou  <ebotca...@adacore.com>
 
 	* gcc-interface/Make-lang.in: Make sure that GNAT1_OBJS and not just
Index: gcc/ada/s-oscons-tmplt.c
===
--- gcc/ada/s-oscons-tmplt.c	(Revision 229739)
+++ gcc/ada/s-oscons-tmplt.c	(Arbeitskopie)
@@ -157,7 +157,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#ifdef __linux__
+#if defined (__linux__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1456,7 +1456,8 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 CNS(CLOCK_RT_Ada, "")
 #endif
 
-#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
+#if defined (__APPLE__) || defined (__linux__) || defined (__rtems__) || \
+  defined (DUMMY)
 /*
 
--  Sizes of pthread data types
@@ -1499,7 +1500,7 @@ CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t
 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
 CND(PTHREAD_ONCE_SIZE,   "pthread_once_t")
 
-#endif /* __APPLE__ || __linux__ */
+#endif /* __APPLE__ || __linux__ || __rtems__*/
 
 /*
 
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads	(Revision 229739)
+++ gcc/ada/s-osinte-rtems.ads	(Arbeitskopie)
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
 
+   subtype char_array is Interfaces.C.char_array;
+
type pthread_attr_t is record
-  is_initialized  : int;
-  stackaddr   : System.Address;
-  stacksize   : int;
-  contentionscope : int;
-  inheritsched: int;
-  schedpolicy : int;
-  schedparam  : struct_sched_param;
-  cputime_clocked_allowed : int;
-  detatchstate: int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE);
end record;
pragma Convention (C, pthread_attr_t);
+   for pthread_attr_t'Alignment use Interfaces.C.double'Alignment;
 
type pthread_condattr_t is record
- 

Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-11-03 Thread Jan Sommer
Am Monday 02 November 2015, 12:39:57 schrieb Sebastian Huber:
> 
> On 31/10/15 16:47, Jan Sommer wrote:
> > Hi,
> >
> > This patch changes the Ada-declaration of the pthread-related structs such 
> > as pthread_attr_t from a field-equivalent declaration to just reserving the 
> > right amount of memory.
> > It is only rtems related and essentially copies the way how the types are 
> > defined in s-osinte-linux.ads. It makes the declarations independent of a 
> > particular newlib-version and fixes the bug I filed here:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169
> 
> [...]
> 
> >  -
> >  -- Signals --
> > @@ -448,6 +450,7 @@ package System.OS_Interface is
> > ss_low_priority : int;
> > ss_replenish_period : timespec;
> > ss_initial_budget   : timespec;
> > +  sched_ss_max_repl   : int;
> >  end record;
> >  pragma Convention (C, struct_sched_param);
> 
> Why is this structure not changed to an opaque size + alignment type 
> like the other structures?
> 

There is no corresponding size constant in s-oscons.ads. The linux version of 
s-osinte.ads uses a record declaration too.

> >   
> > @@ -621,43 +624,34 @@ private
> >  end record;
> >  pragma Convention (C, timespec);
> >   
> > -   CLOCK_REALTIME :  constant clockid_t := 1;
> > -   CLOCK_MONOTONIC : constant clockid_t := 4;
> > +   CLOCK_REALTIME :  constant clockid_t := 
> > System.OS_Constants.CLOCK_REALTIME;
> > +   CLOCK_MONOTONIC : constant clockid_t := 
> > System.OS_Constants.CLOCK_MONOTONIC;
> > +
> > +   subtype char_array is Interfaces.C.char_array;
> >   
> >  type pthread_attr_t is record
> > -  is_initialized  : int;
> > -  stackaddr   : System.Address;
> > -  stacksize   : int;
> > -  contentionscope : int;
> > -  inheritsched: int;
> > -  schedpolicy : int;
> > -  schedparam  : struct_sched_param;
> > -  cputime_clocked_allowed : int;
> > -  detatchstate: int;
> > +  Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE);
> >  end record;
> >  pragma Convention (C, pthread_attr_t);
> > +   for pthread_attr_t'Alignment use Interfaces.C.unsigned_long'Alignment;
> >   
> >  type pthread_condattr_t is record
> > -  flags   : int;
> > -  process_shared  : int;
> > +  Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE);
> >  end record;
> >  pragma Convention (C, pthread_condattr_t);
> > +   for pthread_condattr_t'Alignment use Interfaces.C.int'Alignment;
> >   
> >  type pthread_mutexattr_t is record
> > -  is_initialized  : int;
> > -  process_shared  : int;
> > -  prio_ceiling: int;
> > -  protocol: int;
> > -  mutex_type  : int;
> > -  recursive   : int;
> > -   end record;
> > +  Data : char_array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE);
> > +   end  record;
> >  pragma Convention (C, pthread_mutexattr_t);
> > +   for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment;
> [...]
> 
> The alignment is sometimes int and sometimes unsigned long. I would 
> change this to long long or double throughout, e.g. if we change the CPU 
> mask type to uint64_t, then the alignment specified here is no longer 
> correct.
> 

Thanks for the tip. I will change that.

Best regards,

   Jan



Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-11-03 Thread Jan Sommer
Am Tuesday 03 November 2015, 18:10:53 schrieb Arnaud Charlet:
> > Let's try again. This time I made the diff against trunk with the changes
> > Sebastian recommended, included a ChangeLog and used svn-diff.
> > If this patch goes through, please let me know how the backporting works.
> 
> Your ChangeLog entry is not in the proper format, see sections 6.8.1 and
> 6.8.2 from http://www.gnu.org/prep/standards/standards.html
> 
> The diff itself is OK.
> 

Ok, fixed this. See the new diff below.

> You can use svn merge to merge changes on other branches, or try to
> apply your diff using the "patch" command, and adjust for any merge
> conflict.
> 

Will do. Do I send a patch for each branch to the list or do I add these 
changes to this patch?

Best regards,

   Jan


Index: gcc/ada/ChangeLog
===
--- gcc/ada/ChangeLog   (Revision 229715)
+++ gcc/ada/ChangeLog   (Arbeitskopie)
@@ -1,3 +1,8 @@
+2015-11-03  Jan Sommer <soja-li...@aries.uberspace.de>
+
+   * s-oscons-tmplt.c: Generate pthread constants for RTEMS
+   * s-osinte-rtems.ads: Declare pthread structs as opaque types in Ada
+
 2015-10-29  Andrew MacLeod  <amacl...@redhat.com>
 
* gcc-interface/decl.c: Reorder #include's and remove duplicates.
Index: gcc/ada/s-oscons-tmplt.c
===
--- gcc/ada/s-oscons-tmplt.c(Revision 229715)
+++ gcc/ada/s-oscons-tmplt.c(Arbeitskopie)
@@ -157,7 +157,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#if defined (__linux__) || defined (__ANDROID__)
+#if defined (__linux__) || defined (__ANDROID__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1458,7 +1458,7 @@ CNS(CLOCK_RT_Ada, "")
 #endif
 
 #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \
-  || defined (DUMMY)
+  || defined (__rtems__) || defined (DUMMY)
 /*
 
--  Sizes of pthread data types
@@ -1501,7 +1501,7 @@ CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t
 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
 CND(PTHREAD_ONCE_SIZE,   "pthread_once_t")
 
-#endif /* __APPLE__ || __linux__ || __ANDROID__ */
+#endif /* __APPLE__ || __linux__ || __ANDROID__ || __rtems__ */
 
 /*
 
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads  (Revision 229715)
+++ gcc/ada/s-osinte-rtems.ads  (Arbeitskopie)
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
 
+   subtype char_array is Interfaces.C.char_array;
+
type pthread_attr_t is record
-  is_initialized  : int;
-  stackaddr   : System.Address;
-  stacksize   : int;
-  contentionscope : int;
-  inheritsched: int;
-  schedpolicy : int;
-  schedparam  : struct_sched_param;
-  cputime_clocked_allowed : int;
-  detatchstate

[PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-11-03 Thread Jan Sommer
Hi,

Let's try again. This time I made the diff against trunk with the changes 
Sebastian recommended, included a ChangeLog and used svn-diff.
If this patch goes through, please let me know how the backporting works.

Best regards,

   Jan

Index: ChangeLog
===
--- ChangeLog   (Revision 229709)
+++ ChangeLog   (Arbeitskopie)
@@ -1,3 +1,10 @@
+
+2015-11-03  Jan Sommer <soja-li...@aries.uberspace.de>
+
+   Use opaque types for Ada-declaration of pthread types
+   in Gnat for Rtems.
+   PR ada/68169
+
 2015-10-23  Steve Ellcey  <sell...@imgtec.com>
 
* MAINTAINERS: Update email address.
Index: gcc/ada/s-oscons-tmplt.c
===
--- gcc/ada/s-oscons-tmplt.c(Revision 229709)
+++ gcc/ada/s-oscons-tmplt.c(Arbeitskopie)
@@ -157,7 +157,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#if defined (__linux__) || defined (__ANDROID__)
+#if defined (__linux__) || defined (__ANDROID__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1458,7 +1458,7 @@ CNS(CLOCK_RT_Ada, "")
 #endif
 
 #if defined (__APPLE__) || defined (__linux__) || defined (__ANDROID__) \
-  || defined (DUMMY)
+  || defined (__rtems__) || defined (DUMMY)
 /*
 
--  Sizes of pthread data types
@@ -1501,7 +1501,7 @@ CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t
 CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
 CND(PTHREAD_ONCE_SIZE,   "pthread_once_t")
 
-#endif /* __APPLE__ || __linux__ || __ANDROID__ */
+#endif /* __APPLE__ || __linux__ || __ANDROID__ || __rtems__ */
 
 /*
 
Index: gcc/ada/s-osinte-rtems.ads
===
--- gcc/ada/s-osinte-rtems.ads  (Revision 229709)
+++ gcc/ada/s-osinte-rtems.ads  (Arbeitskopie)
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
 
+   subtype char_array is Interfaces.C.char_array;
+
type pthread_attr_t is record
-  is_initialized  : int;
-  stackaddr   : System.Address;
-  stacksize   : int;
-  contentionscope : int;
-  inheritsched: int;
-  schedpolicy : int;
-  schedparam  : struct_sched_param;
-  cputime_clocked_allowed : int;
-  detatchstate: int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_ATTR_SIZE);
end record;
pragma Convention (C, pthread_attr_t);
+   for pthread_attr_t'Alignment use Interfaces.C.double'Alignment;
 
type pthread_condattr_t is record
-  flags   : int;
-  process_shared  : int;
+  Data : char_array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE);
end record;
pragma Convention (C, pthread_condattr_t);
+   for pthread_condattr_t'Alignment use Interfaces.C.double'Alignment;
 
type pthread_mutexattr_t is record
-  is_initialized  : int;
-  process_shared  : int;
-  prio_ceiling: int;
-  protocol: int;
-  mutex_t

Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-11-02 Thread Jan Sommer
Am Saturday 31 October 2015, 18:11:47 schrieb Arnaud Charlet:
> > > This patch changes the Ada-declaration of the pthread-related structs
> > > such as pthread_attr_t from a field-equivalent declaration to just
> > > reserving the right amount of memory.
> > > It is only rtems related and essentially copies the way how the types are
> > > defined in s-osinte-linux.ads. It makes the declarations independent
> > > of a particular newlib-version and fixes the bug I filed here:
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169
> > > 
> > > CC are the rtems developers for discussion.
> > 
> > I forgot to add: The patch is based on the current gcc 4.9 branch
> 
> Well you need to submit patches against trunk (and if needed backport them)
> rather than the other way around.
> 
> Also, you need to provide a ChangeLog in the proper format.
> 

Ok, I don't have time today. I will make a patch against trunk and will try 
again with the correct format tomorrow.
How does the backporting work?
It's my first contribution to gcc, so bare with me ;-)

Best regards,

   Jan



Re: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-10-31 Thread Jan Sommer
Am Saturday 31 October 2015, 16:47:35 schrieb Jan Sommer:
> Hi,
> 
> This patch changes the Ada-declaration of the pthread-related structs such as 
> pthread_attr_t from a field-equivalent declaration to just reserving the 
> right amount of memory.
> It is only rtems related and essentially copies the way how the types are 
> defined in s-osinte-linux.ads. It makes the declarations independent of a 
> particular newlib-version and fixes the bug I filed here:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169
> 
> CC are the rtems developers for discussion.
> 

I forgot to add: The patch is based on the current gcc 4.9 branch


[PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads

2015-10-31 Thread Jan Sommer
Hi,

This patch changes the Ada-declaration of the pthread-related structs such as 
pthread_attr_t from a field-equivalent declaration to just reserving the right 
amount of memory.
It is only rtems related and essentially copies the way how the types are 
defined in s-osinte-linux.ads. It makes the declarations independent of a 
particular newlib-version and fixes the bug I filed here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169

CC are the rtems developers for discussion.

Best regards,

   Jan>From 1092dda339a12d3f7d437335e93dcdea540051c8 Mon Sep 17 00:00:00 2001
From: Jan Sommer <soja-li...@aries.uberspace.de>
Date: Sat, 31 Oct 2015 16:09:32 +0100
Subject: [PATCH 1/2] Add rtems to the list of platforms for which
 Ada-constants of pthread-types are generated

Constant values for the sizes of pthread-types will be generated in s-oscons.ads for rtems.

Related to bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169
---
 gcc/ada/s-oscons-tmplt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index 5a034d5..5c26890 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -154,7 +154,7 @@ pragma Style_Checks ("M32766");
 # include <_types.h>
 #endif
 
-#ifdef __linux__
+#if defined (__linux__) || defined (__rtems__)
 # include 
 # include 
 #endif
@@ -1441,7 +1441,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 CNS(CLOCK_RT_Ada, "")
 #endif
 
-#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
+#if defined (__APPLE__) || defined (__linux__) || defined (__rtems__) || defined (DUMMY)
 /*
 
--  Sizes of pthread data types
-- 
2.5.0

>From 6b445bc37bf59641f46c01ec64a248efb5ec40f4 Mon Sep 17 00:00:00 2001
From: Jan Sommer <soja-li...@aries.uberspace.de>
Date: Sat, 31 Oct 2015 16:25:14 +0100
Subject: [PATCH 2/2] Update type definitions to use the constant values from
 s-oscons.ads

Currently the pthread type definitions list all fields of the corresponding c-struct in Ada.
However, at least pthread_attr_t has more fields in current newlib than in the Ada declaration here.

This change will declare the pthread-related structs in the same way as in s-osinte-linux.ads by using fixed length char-arrays with the length obtained from s-oscons.ads.
This way the declaration is independent of a certain changes in newlib.

It also replaces some hardcoded errnos with the corresponding constants from s-oscons.ads

Fixes bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68169
---
 gcc/ada/s-osinte-rtems.ads | 50 --
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads
index 8b9ae12..992254f 100644
--- a/gcc/ada/s-osinte-rtems.ads
+++ b/gcc/ada/s-osinte-rtems.ads
@@ -51,6 +51,8 @@
 --  It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
+
 package System.OS_Interface is
pragma Preelaborate;
 
@@ -60,6 +62,7 @@ package System.OS_Interface is
subtype rtems_id   is Interfaces.C.unsigned;
 
subtype intis Interfaces.C.int;
+   subtype char   is Interfaces.C.char;
subtype short  is Interfaces.C.short;
subtype long   is Interfaces.C.long;
subtype unsigned   is Interfaces.C.unsigned;
@@ -68,7 +71,6 @@ package System.OS_Interface is
subtype unsigned_char  is Interfaces.C.unsigned_char;
subtype plain_char is Interfaces.C.plain_char;
subtype size_t is Interfaces.C.size_t;
-
---
-- Errno --
---
@@ -76,11 +78,11 @@ package System.OS_Interface is
function errno return int;
pragma Import (C, errno, "__get_errno");
 
-   EAGAIN: constant := 11;
-   EINTR : constant := 4;
-   EINVAL: constant := 22;
-   ENOMEM: constant := 12;
-   ETIMEDOUT : constant := 116;
+   EAGAIN: constant := System.OS_Constants.EAGAIN;
+   EINTR : constant := System.OS_Constants.EINTR;
+   EINVAL: constant := System.OS_Constants.EINVAL;
+   ENOMEM: constant := System.OS_Constants.ENOMEM;
+   ETIMEDOUT : constant := System.OS_Constants.ETIMEDOUT;
 
-
-- Signals --
@@ -448,6 +450,7 @@ package System.OS_Interface is
   ss_low_priority : int;
   ss_replenish_period : timespec;
   ss_initial_budget   : timespec;
+  sched_ss_max_repl   : int;
end record;
pragma Convention (C, struct_sched_param);
 
@@ -621,43 +624,34 @@ private
end record;
pragma Convention (C, timespec);
 
-   CLOCK_REALTIME :  constant clockid_t := 1;
-   CLOCK_MONOTONIC : constant clockid_t := 4;
+   CLOCK_REALTIME :  constant clockid_t := System.OS_Constants.CLOCK_REALTIME;
+   CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC;
+
+   subtype char_array is Interfaces.C.char_array;
 
type pthread