This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SEGGER Embedded Studio v6.20 compiler warning

Hi DevZone,

I recently updated my version of SEGGER Embedded Studio for ARM to v6.20. Now, warnings that were not shown before are caught.

I want to ignore the warning triggered specifically when giving reference to a member of a packed struct I am getting the following warning:

<taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Waddress-of-packed-member]>

 

Example:

typedef struct __attribute__((__packed__))
{
    uint16_t a;                   
    uint16_t b;                   
} ExampleStruct;

void ExampleFunction(uint16_t* var)
{
    // Place data at given pointer address
}

int main(void)
{
    ExampleStruct exampleStruct;

    ExampleFunction(&exampleStruct.a);
    ExampleFunction(&exampleStruct.b);

    return 0;
}

Is it possible to omit certain compiler warnings, or to specify to the compiler that I am doing this intentionally?

Related