简体   繁体   中英

MPLAB X error, 'packed' attribute ignored for field of type 'BYTE in usb_hal_pic24.h

Just installed MPLAB X and imported a project I'm working on. I got this error, and because it's an application library file, I'm not too keen on modifying it. The code it refers to is:

// BDT Entry Layout
typedef union __BDT
{
union
{
    struct
    {
        BYTE CNT         __attribute__ ((packed));
        BD_STAT     STAT __attribute__ ((packed));
    };
    struct
    {
        WORD        count:10;   //test
        BYTE        :6;
        WORD        ADR; //Buffer Address
        };
    };
    DWORD           Val;
    WORD            v[2];
} BDT_ENTRY;

I'd like to know how to modify this or my settings so that I can compile. I do not get this error in MPLAB.

__attribute__ ((packed)) is safe to comment out.

// BDT Entry Layout
typedef union __BDT
{
    union
    {
        struct
        {
            BYTE CNT    ; //__attribute__ ((packed)); suppress compiler warnings
            BD_STAT     STAT __attribute__ ((packed));
        };
        struct
        {
            WORD        count:10;   //test
            BYTE        :6;
            WORD        ADR; //Buffer Address
        };
    };
    DWORD           Val;
    WORD            v[2];
} BDT_ENTRY;

I had to modify the USB hardware abstraction layer to get things to compile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM