From patchwork Mon Sep 18 14:42:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 814968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-84684-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="KO6oi23h"; dkim-atps=neutral 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 3xwpdv0rz4z9s7F for ; Tue, 19 Sep 2017 00:43:14 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=sdJCh/3tGSCapgo0aUgPXFKT5MKFOX3 pE0CWGrEOqFwOgoSnU+0xs4x/skeBxjT1EK1j1Zm41Wm9/9mEFfnTLkLY+4DVuE7 19Sutbx3AoX/qfj+75GYdXVqsvA9yOY2TDOGpxOxrNW1lgsYb9UuhE1kkta5pKzF 5Tbfac2GZzOs= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Prjfkpia1wQmP9ZRlfmCBjWkVzM=; b=KO6oi 23h3BssDwJ7l6OHBBgcKQXwj5p3kZAoxRIW7k023OwzKyNHxHECvyvuHo/woFZDH hbA/7Q1xlq/ylJCgr60wTjshWG9BHmyVfHKrlW/EqxllYzX7Evw7I3x/BnvmO/15 HhdhJeNukx6c9q3Lmx31aIIwrsVKsQTpx2be4g= Received: (qmail 26646 invoked by alias); 18 Sep 2017 14:43:08 -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 25309 invoked by uid 89); 18 Sep 2017 14:43:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f181.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=xX5XtwVwSQxL89L5UfdtATIw2jrxOLknUzTWLh+A7G4=; b=iRy4P0WFSjwP2ivBABJSrSd52OZUEgvw1u/YPhQiD+7m0S4O6bK5FQ2WuRl/Gasbrm Zwafbg1J6LusA64Axy/2X/AL3xho8XNEwqqKAcx7MiO39rkyy7Y7PXP9fGZ6Cc5DKYdj +mLgF2CXAa+kOGBbl6pKdJa4HaViYFtDbDkzh/bx6a2ZigcFgeTJp1rLTAz10R56gET7 lliH2ANht2i7cGM31A7FhhjT+vmNbb9gq/ZGbMaH1YwlhsnSAXvVR9jmGwMp5LrJ9TGr EKjRBQ8flxXMReGFPCri2cr/rk8GucwERiQsd6r5hV+NjyM9lnBHDMFGJLrHdFpILGkO jAzg== X-Gm-Message-State: AHPjjUiDxQaJ5/1XmtBYi3/mNqP/PZRO6bEUWHowggN5IgLux3ofgG1h QwGEAEYBp+KiaZjvJrhLEQ== X-Google-Smtp-Source: AOwi7QDhUepFLnPyxdF9BYQeSBrM/tgcF8pj448Lg3D6t1InwuAPhwhtpEgYQjfof0WbZnaYXLkVXg== X-Received: by 10.200.4.16 with SMTP id v16mr53093882qtg.265.1505745783621; Mon, 18 Sep 2017 07:43:03 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/2] Use C11 _Alignas on scratch_buffer internal buffer Date: Mon, 18 Sep 2017 11:42:54 -0300 Message-Id: <1505745774-29303-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1505745774-29303-1-git-send-email-adhemerval.zanella@linaro.org> References: <1505745774-29303-1-git-send-email-adhemerval.zanella@linaro.org> Checked on x86_64-linux-gnu. * include/scratch_buffer.h (scratch_buffer): Use C11 _Alignas on __space field definition if compiler supports it. --- ChangeLog | 3 +++ include/scratch_buffer.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/scratch_buffer.h b/include/scratch_buffer.h index bb04662..2e0c8b5 100644 --- a/include/scratch_buffer.h +++ b/include/scratch_buffer.h @@ -60,13 +60,18 @@ #include #include #include +#include /* Scratch buffer. Must be initialized with scratch_buffer_init before its use. */ struct scratch_buffer { void *data; /* Pointer to the beginning of the scratch area. */ size_t length; /* Allocated space at the data pointer, in bytes. */ +#if __alignas_is_defined + _Alignas (max_align_t) char __space[1024]; +#else max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)]; +#endif }; /* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space