From patchwork Sat Feb 25 20:58:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 732442 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 3vW0h772jYz9s85 for ; Sun, 26 Feb 2017 07:59:03 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="lmWTP9ay"; 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 :mime-version:content-type:date:subject:cc:to:message-id; q=dns; s=default; b=MBv89qJ6rFA91xhuhxbE5gxP0tWicZC9vSXtUKa8tu1vghAR8F ic5a8Fx1uq9TCZ1Ih5U/h19n685FBrarJJpI7Ul4I0qoeItS1VOYa4wGuWRGnYHu ICpBr9YitJCq7UqRrL1EMwbWbogOx7wEwbZAt2icC00iSxkAUPO+sIfh8= 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 :mime-version:content-type:date:subject:cc:to:message-id; s= default; bh=e61o0TC/Wq6GcRXSIBSazu9QEfU=; b=lmWTP9ayrQ59xD5Pwu0o /LN3NkGZNY5Cpcl0OmD/f2j6H1RWYl0ilEfyDfJgtGF5vkECO7JsPgisrS36rjEh tI3D1QAct55Gwe8BuS9UmfDGZJaUjUD1QTTzgAtYuTFvxMIWOW8BrHhN8Hso07aw RhkeUjZjCnwwndTMjN1Ncww= Received: (qmail 100438 invoked by alias); 25 Feb 2017 20:58:54 -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 100422 invoked by uid 89); 25 Feb 2017 20:58:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=D*bell.net, sk:dave.an, sk:davean, daveanglinbellnet X-HELO: mtlfep01.bell.net Received: from belmont79srvr.owm.bell.net (HELO mtlfep01.bell.net) (184.150.200.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 25 Feb 2017 20:58:51 +0000 Received: from bell.net mtlfep01 184.150.200.30 by mtlfep01.bell.net with ESMTP id <20170225205849.TRIU15701.mtlfep01.bell.net@mtlspm01.bell.net> for ; Sat, 25 Feb 2017 15:58:49 -0500 Received: from [192.168.2.10] (really [174.91.91.223]) by mtlspm01.bell.net with ESMTP id <20170225205849.IMQT15556.mtlspm01.bell.net@[192.168.2.10]>; Sat, 25 Feb 2017 15:58:49 -0500 From: John David Anglin Mime-Version: 1.0 (Apple Message framework v1085) Date: Sat, 25 Feb 2017 15:58:49 -0500 Subject: [committed] New hppa-hpux11 pthread.h fix Cc: bkorb@gnu.org To: GCC Patches Message-Id: <200DA5B3-F3FE-47BD-AB48-120774B1CB07@bell.net> The attached change fixes PR target/68739. As noted in comment #2, the standard for libstdc++ requires a constexpr constructor for mutexes. On hpux, we don't have a constexpr constructor because of of the void * casts in the PTHREAD_MUTEX_INITIALIZER define and the void * element in the pthread_mutex struct. The attached patch changes the void * element to long in the pthread_mutex struct and removes the void * cast from the initializer. This keeps the layout the same as before. As far as I can tell, this field is only used internally so the type change shouldn't affect application code. Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11. Committed to trunk. Dave --- John David Anglin dave.anglin@bell.net 2017-02-25 John David Anglin PR target/68739 * inclhack.def (hpux11_pthread_pointer): New fix. (hpux11_pthread_const): Adjust to remove void * cast from define. * fixincl.x: Regenerate. Index: inclhack.def =================================================================== --- inclhack.def (revision 245737) +++ inclhack.def (working copy) @@ -2366,16 +2366,34 @@ }; /* - * Fix C99 constant in __POINTER_SET define. + * The definitions for PTHREAD_MUTEX_INITIALIZER and similar initializers + * in pthread.h need to be constant expressions to be standard complient. + * As a result, we need to remove the void * casts in the initializers + * (see hpux11_pthread_const) and to change the __(M|C|RW)POINTER defines + * to use the long type. */ fix = { + hackname = hpux11_pthread_pointer; + mach = "*-hp-hpux11.[0-3]*"; + files = sys/pthread.h; + select = "(void[ \t]*\\*)(m|c|rw)(_ptr)"; + + c_fix = format; + c_fix_arg = "long\t%2%3"; + test_text = "#define __MPOINTER\t\tvoid\t *m_ptr"; +}; + +/* + * Remove void pointer cast and fix C99 constant in __POINTER_SET defines. + */ +fix = { hackname = hpux11_pthread_const; mach = "*-hp-hpux11.[0-3]*"; files = sys/pthread.h; - select = "^#define[ \t]*__POINTER_SET[ \t]*\\(\\(void \\*\\) 1LL\\)"; + select = "^(#define[ \t]+__POINTER_SET[ \t0,]*)(.*\\))"; c_fix = format; - c_fix_arg = "#define __POINTER_SET\t\t((void *) 1L)"; + c_fix_arg = "%11"; test_text = "#define __POINTER_SET\t\t((void *) 1LL)"; }; Index: tests/base/sys/pthread.h =================================================================== --- tests/base/sys/pthread.h (revision 245737) +++ tests/base/sys/pthread.h (working copy) @@ -14,8 +14,13 @@ #endif /* HPUX11_LWP_RWLOCK_VALID_CHECK */ +#if defined( HPUX11_PTHREAD_POINTER_CHECK ) +#define __MPOINTER long m_ptr +#endif /* HPUX11_PTHREAD_POINTER_CHECK */ + + #if defined( HPUX11_PTHREAD_CONST_CHECK ) -#define __POINTER_SET ((void *) 1L) +#define __POINTER_SET 1 #endif /* HPUX11_PTHREAD_CONST_CHECK */