From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80161 invoked by alias); 14 Mar 2018 10:54:02 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 80144 invoked by uid 9078); 14 Mar 2018 10:54:01 -0000 Date: Wed, 14 Mar 2018 10:54:00 -0000 Message-ID: <20180314105401.80142.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] ctype: align size of category bit fields to small targets needs X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: edcf783dc2fc89f32a29443ceb5a362d0ee6910c X-Git-Newrev: 134f93f313db95c394b925716717031a05b2a6d3 X-SW-Source: 2018-q1/txt/msg00058.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=134f93f313db95c394b925716717031a05b2a6d3 commit 134f93f313db95c394b925716717031a05b2a6d3 Author: Corinna Vinschen Date: Wed Mar 14 10:36:34 2018 +0100 ctype: align size of category bit fields to small targets needs E.g. arm ABI requires -fshort-enums for bare-metal toolchains. Given there are only 29 category enums, the compiler chooses an 8 bit enum type, so a size of 11 bits for the bitfield leads to a compile time error: error: width of 'cat' exceeds its type enum category cat: 11; ^~~ Fix this by aligning the size of the category members to byte borders. Signed-off-by: Corinna Vinschen Diff: --- newlib/libc/ctype/categories.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/ctype/categories.c b/newlib/libc/ctype/categories.c index db285d7..c237324 100644 --- a/newlib/libc/ctype/categories.c +++ b/newlib/libc/ctype/categories.c @@ -2,8 +2,8 @@ #include "categories.h" struct _category { - enum category cat: 11; - unsigned int first: 21; + enum category cat: 8; + unsigned int first: 24; unsigned short delta; } __attribute__((packed));