From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17578 invoked by alias); 12 Nov 2014 13:08:04 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 17568 invoked by uid 89); 12 Nov 2014 13:08:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp14.uk.ibm.com Received: from e06smtp14.uk.ibm.com (HELO e06smtp14.uk.ibm.com) (195.75.94.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 12 Nov 2014 13:08:02 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Nov 2014 13:07:58 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 12 Nov 2014 13:07:57 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id E8D3F17D8047 for ; Wed, 12 Nov 2014 13:08:05 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sACD7uGN60686442 for ; Wed, 12 Nov 2014 13:07:56 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sACD7u8C023686 for ; Wed, 12 Nov 2014 08:07:56 -0500 Received: from bl3ahm9f.de.ibm.com (dyn-9-152-212-123.boeblingen.de.ibm.com [9.152.212.123]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id sACD7uTT023673 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 12 Nov 2014 08:07:56 -0500 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1XoXeN-0006cw-Hg; Wed, 12 Nov 2014 14:07:55 +0100 Date: Wed, 12 Nov 2014 13:08:00 -0000 From: Dominik Vogt To: libffi-discuss@sourceware.org Subject: [RFC] Proposal for m*vc build issue (#138) Message-ID: <20141112130755.GA24721@linux.vnet.ibm.com> Reply-To: libffi-discuss@sourceware.org Mail-Followup-To: libffi-discuss@sourceware.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14111213-0017-0000-0000-000001CF7619 X-IsSubscribed: yes X-SW-Source: 2014/txt/msg00217.txt.bz2 --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 325 I've attached a patch implementing option 4 from here: https://github.com/atgreen/libffi/issues/138 Please proof read the patch and let me know what you think. It might be good to specifically double check the detection of a compiler with complex support using macros. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany --GvXjxJ+pjyke8COw Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Detect-compiler-s-_Complex-support-by-checking-__STD.patch" Content-length: 1581 >From e854b00c2fb86a5f65e08d299bea64883cefb99c Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Tue, 11 Nov 2014 13:55:22 +0100 Subject: [PATCH] Detect compiler's _Complex support by checking __STDC_NO_COMPLEX__. --- src/types.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/types.c b/src/types.c index ef4f151..5c7bd27 100644 --- a/src/types.c +++ b/src/types.c @@ -44,6 +44,7 @@ maybe_const ffi_type ffi_type_##name = { \ id, NULL \ } +#if !defined __STDC_NO_COMPLEX__ && defined __STDC_VERSION__ && (__STDC_VERSION__ >= 199901L) #define FFI_COMPLEX_TYPEDEF(name, type, maybe_const) \ static ffi_type *ffi_elements_complex_##name [2] = { \ (ffi_type *)(&ffi_type_##name), NULL \ @@ -58,6 +59,24 @@ maybe_const ffi_type ffi_type_complex_##name = { \ FFI_TYPE_COMPLEX, \ (ffi_type **)ffi_elements_complex_##name \ } +#else +/* Bogus definition for compilers without C99 complex support. */ +#define FFI_COMPLEX_TYPEDEF(name, type, maybe_const) \ +static ffi_type *ffi_elements_complex_##name [2] = { \ + (ffi_type *)(&ffi_type_##name), NULL \ +}; \ +struct struct_align_complex_##name { \ + char c; \ + type x; \ + type y; \ +}; \ +maybe_const ffi_type ffi_type_complex_##name = { \ + 2 * sizeof(type), \ + offsetof(struct struct_align_complex_##name, x), \ + FFI_TYPE_COMPLEX, \ + (ffi_type **)ffi_elements_complex_##name \ +} +#endif /* Size and alignment are fake here. They must not be 0. */ const ffi_type ffi_type_void = { -- 1.8.4.2 --GvXjxJ+pjyke8COw--