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 <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber 2018-07-20 13:04:56 +02:00
parent e9f223877f
commit 46ba1675c4
2 changed files with 8 additions and 6 deletions

View File

@ -1,10 +1,11 @@
#include <wctype.h> #include <wctype.h>
#include <stdint.h>
#include "categories.h" #include "categories.h"
struct _category { struct _category {
enum category cat: 8; enum category cat: 8;
unsigned int first: 24; uint_least32_t first: 24;
unsigned short delta; uint_least16_t delta;
} __attribute__((packed)); } __attribute__((packed));
static const struct _category categories[] = { static const struct _category categories[] = {

View File

@ -1,6 +1,7 @@
/* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */ /* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
#include <_ansi.h> #include <_ansi.h>
#include <wctype.h> #include <wctype.h>
#include <stdint.h>
//#include <errno.h> //#include <errno.h>
#include "local.h" #include "local.h"
@ -35,10 +36,10 @@
enum {TO1, TOLO, TOUP, TOBOTH}; enum {TO1, TOLO, TOUP, TOBOTH};
enum {EVENCAP, ODDCAP}; enum {EVENCAP, ODDCAP};
static struct caseconv_entry { static struct caseconv_entry {
unsigned int first: 21; uint_least32_t first: 21;
unsigned short diff: 8; uint_least8_t diff: 8;
unsigned char mode: 2; uint_least8_t mode: 2;
int delta: 17; uint_least32_t delta: 17;
} __attribute__ ((packed)) } __attribute__ ((packed))
caseconv_table [] = { caseconv_table [] = {
#include "caseconv.t" #include "caseconv.t"