From patchwork Mon Nov 23 22:15:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Sommer X-Patchwork-Id: 547776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7F24D140291 for ; Tue, 24 Nov 2015 09:15:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=tz0OHkPe; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=tNCzm8mDhkz20C6n NrVL3ozlMZui+V5SnzWdZdDn9GUhLOuDR9LppM9hki/wDiZGL1HXwE/7mt+oc5qw 9lo6H3Abso+WqCIFybZA3yRFPX1hlTUpCFpR8/1pK+p7hEOnSA3BE6g6j47to10x d2u1N4dNUIZJ7tkCWcbzu50ktic= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=zYNUeZoJ6EOccvCdcg2/8v exUgU=; b=tz0OHkPenXR8KyjNliBlIIlIWmlAULTy9E7IckY5N5LUfirAvzRWZ3 aEmTSNtQFzgSoKsd4pxtiaQpTuTZ1UnP1K4ILGm1MKWmSFcrisLIhCRdLYThxHAS j43MC+u1rcHwsIDJTBuXH+QFslbgB2lfwLo6mMqyONK+f31ijw3pI= Received: (qmail 24078 invoked by alias); 23 Nov 2015 22:15:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 24063 invoked by uid 89); 23 Nov 2015 22:15:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: aries.uberspace.de Received: from aries.uberspace.de (HELO aries.uberspace.de) (95.143.172.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 23 Nov 2015 22:15:41 +0000 Received: (qmail 31436 invoked from network); 23 Nov 2015 22:15:37 -0000 Received: from localhost (HELO kubuntu.localnet) (127.0.0.1) by aries.uberspace.de with SMTP; 23 Nov 2015 22:15:37 -0000 From: Jan Sommer To: gcc-patches@gcc.gnu.org, devel@rtems.org Subject: [PATCH] Fix declaration of pthread-structs in s-osinte-rtems.ads (ada/68169) Date: Mon, 23 Nov 2015 23:15:34 +0100 Message-ID: <3667951.xxJfb3I2z2@kubuntu> User-Agent: KMail/5.0.2 (Linux/4.2.0-18-generic; KDE/5.15.0; x86_64; ; ) MIME-Version: 1.0 X-IsSubscribed: yes 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 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, Jan Index: gcc/ada/ChangeLog =================================================================== --- gcc/ada/ChangeLog (Revision 230563) +++ gcc/ada/ChangeLog (Arbeitskopie) @@ -1,3 +1,9 @@ +2015-11-18 Jan Sommer + + * 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-18 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Use case #1 Index: gcc/ada/s-oscons-tmplt.c =================================================================== --- gcc/ada/s-oscons-tmplt.c (Revision 230563) +++ 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 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 int is 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_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.double'Alignment; type pthread_rwlockattr_t is record - is_initialized : int; - process_shared : int; + Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCKATTR_SIZE); end record; pragma Convention (C, pthread_rwlockattr_t); + for pthread_rwlockattr_t'Alignment use Interfaces.C.double'Alignment; type pthread_t is new rtems_id;