luoliwoshang / llgo

A Go compiler based on LLVM in order to better integrate Go with the C ecosystem including Python
Apache License 2.0
2 stars 0 forks source link

Anonymous bit fields in structures cause crashes due to duplicate name fields and supports merging multiple bit fields into one underlying type, such as unsigned int. #104

Open tsingbx opened 1 week ago

tsingbx commented 1 week ago

_structs.txt

1、Supports merging multiple bit fields into one underlying type, such as unsigned int. 2、The ast file should not contain code that the compiler ignores. For example, #ifdef XXX code #endif. The code here should be ignored when XXX is not defined, and the ast file should not contain this code.

luoliwoshang commented 1 week ago
#define _STRUCT_FP_CONTROL  struct fp_control
_STRUCT_FP_CONTROL
{
    unsigned short      invalid :1,
                    denorm  :1,
                zdiv    :1,
                ovrfl   :1,
                undfl   :1,
                precis  :1,
                    :2,
                pc  :2,
#define FP_PREC_24B     0
#define FP_PREC_53B     2
#define FP_PREC_64B     3
                rc  :2,
#define FP_RND_NEAR     0
#define FP_RND_DOWN     1
#define FP_RND_UP       2
#define FP_CHOP         3
                /*inf*/ :1,
                    :3;
};