From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88632 invoked by alias); 20 Jul 2018 12:25:48 -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 88555 invoked by uid 10080); 20 Jul 2018 12:25:48 -0000 Date: Fri, 20 Jul 2018 12:25:00 -0000 Message-ID: <20180720122548.88552.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] ctype: Fix bitfield types on 16-bit targets X-Act-Checkin: newlib-cygwin X-Git-Author: Sebastian Huber X-Git-Refname: refs/heads/master X-Git-Oldrev: e9f223877f42c31353bd8b522596cb5fe1b87388 X-Git-Newrev: 46ba1675c457324b0eeef4670a09101ef3f34c50 X-SW-Source: 2018-q3/txt/msg00019.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=46ba1675c457324b0eeef4670a09101ef3f34c50 commit 46ba1675c457324b0eeef4670a09101ef3f34c50 Author: Sebastian Huber Date: Fri Jul 20 13:04:56 2018 +0200 ctype: Fix bitfield types on 16-bit targets This prevents errors like this: newlib/libc/ctype/categories.c:6:3: error: width of 'first' exceeds its type unsigned int first: 24; ^ Signed-off-by: Sebastian Huber Diff: --- newlib/libc/ctype/categories.c | 5 +++-- newlib/libc/ctype/towctrans_l.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/newlib/libc/ctype/categories.c b/newlib/libc/ctype/categories.c index c237324..85328ef 100644 --- a/newlib/libc/ctype/categories.c +++ b/newlib/libc/ctype/categories.c @@ -1,10 +1,11 @@ #include +#include #include "categories.h" struct _category { enum category cat: 8; - unsigned int first: 24; - unsigned short delta; + uint_least32_t first: 24; + uint_least16_t delta; } __attribute__((packed)); static const struct _category categories[] = { diff --git a/newlib/libc/ctype/towctrans_l.c b/newlib/libc/ctype/towctrans_l.c index 9759cf7..42085ac 100644 --- a/newlib/libc/ctype/towctrans_l.c +++ b/newlib/libc/ctype/towctrans_l.c @@ -1,6 +1,7 @@ /* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */ #include <_ansi.h> #include +#include //#include #include "local.h" @@ -35,10 +36,10 @@ enum {TO1, TOLO, TOUP, TOBOTH}; enum {EVENCAP, ODDCAP}; static struct caseconv_entry { - unsigned int first: 21; - unsigned short diff: 8; - unsigned char mode: 2; - int delta: 17; + uint_least32_t first: 21; + uint_least8_t diff: 8; + uint_least8_t mode: 2; + uint_least32_t delta: 17; } __attribute__ ((packed)) caseconv_table [] = { #include "caseconv.t"