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 <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2018-03-14 10:36:34 +01:00
parent edcf783dc2
commit 134f93f313
1 changed files with 2 additions and 2 deletions

View File

@ -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));