From patchwork Thu Apr 2 08:15:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 457561 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 E4EF6140083 for ; Thu, 2 Apr 2015 19:16:03 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=sourceware.org header.i=@sourceware.org header.b=nE03zHHv; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type; q=dns; s=default; b= cUZk45d9isH34dVgz0L75hlhH40nqrdExea6OJQVWXKTBgnZ9vUy4x/h53mHBY4I 7sQvJBK1RhbYDRMPegZC7hGDe1anlVHSV8MEpHSW+a0ntbkgusQ5Gqn49MkjwOu/ vKBjsVxJXMTiQj5Cw7Yjq6UTYDBGH8VpYZnvEOPwBIw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type; s=default; bh=ao/Q azAWAfTQ2QUMStr7AlZhz1o=; b=nE03zHHvZYGv8BYcj+XJPhlja/fuElM+/kX4 L0FA+6zpITLNFjYi2dN8KfzzVxyO5gS2jINBJdPFbANTjTGqCYDvy3zYL2D1hz2b Zz+IrtIEtMlA7eB0cM2bnyhb8aY4jGxAA2diuj8ve+QmhKgxIBLwpAAjE2QXZW8F bT1QFv8= Received: (qmail 50119 invoked by alias); 2 Apr 2015 08:15:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 50101 invoked by uid 89); 2 Apr 2015 08:15:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <551CFAB8.2000005@redhat.com> Date: Thu, 02 Apr 2015 10:15:52 +0200 From: Florian Weimer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Andreas Schwab CC: GNU C Library Subject: Re: [PATCH] Define libc_max_align_t References: <551C1A60.4080507@redhat.com> <87h9szqzi9.fsf@igel.home> <551C6E87.2090607@redhat.com> In-Reply-To: On 04/02/2015 09:38 AM, Andreas Schwab wrote: > Florian Weimer writes: > >> On 04/02/2015 12:01 AM, Andreas Schwab wrote: >>> Florian Weimer writes: >>> >>>> +/* This mirrors the C11 max_align_t type provided by GCC, but it is >>>> + also available in C99 mode. */ >>>> +typedef struct { >>>> + long long ll __attribute__ ((__aligned__ (__alignof__ (long long)))); >>>> + long double ld __attribute__ ((__aligned__ (__alignof__ (long double)))); >>>> +} libc_max_align_t; >>> >>> Why aren't the attributes no-ops? >> >> Quoting Joseph: >> >> “The attributes there are because some targets may give types lower >> alignment inside structures and unions than outside; 32-bit x86 in >> particular.” > > This should probably be added to the comment. Well, the GCC folks thought it wasn't necessary, but I agree that a comment cannot hurt. Is this okay? From 1d39ccadab8f2c11ac54242c9faaf0396f760c15 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 2 Apr 2015 10:07:04 +0200 Subject: [PATCH] Define libc_max_align_t for internal use --- ChangeLog | 4 ++++ include/libc-internal.h | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index c687d13..b0a48ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-04-02 Florian Weimer + + * include/libc-internal.h (libc_max_align_t): Define. + 2015-04-02 Mel Gorman [BZ #17195] diff --git a/include/libc-internal.h b/include/libc-internal.h index bca59a4..b37388e 100644 --- a/include/libc-internal.h +++ b/include/libc-internal.h @@ -107,4 +107,13 @@ extern void __init_misc (int, char **, char **); #define DIAG_IGNORE_NEEDS_COMMENT(version, option) \ _Pragma (_DIAG_STR (GCC diagnostic ignored option)) +/* This mirrors the C11 max_align_t type provided by GCC, but it is + also available in C99 mode. The aligned attributes are required + because some ABIs have reduced alignment requirements for struct + and union members. */ +typedef struct { + long long ll __attribute__ ((__aligned__ (__alignof__ (long long)))); + long double ld __attribute__ ((__aligned__ (__alignof__ (long double)))); +} libc_max_align_t; + #endif /* _LIBC_INTERNAL */ -- 2.1.0