From 134f93f313db95c394b925716717031a05b2a6d3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 14 Mar 2018 10:36:34 +0100 Subject: [PATCH] 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 --- 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 db285d7a5..c237324ec 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));