Warnings about pack_struct_end.h and IAR

I’ve a project in IAR which use freeRTOS+TCP. When I compile there were a lot of warnings like this:

FreeRTOS_IP_Private.h",229  Warning[Pe1644]:
          definition at end of file not followed by a semicolon or a declarator

      }

I have incuded pack_struct_start.h and pack_struct_end.h in my project and they are used but it seems IAR compiler doesn’t like the pack_struct_end.h which only have a ;

The problem is solve if I include a semicolon after the } in the end of structs but I don’t understand why the pack_struct_end.h file is not working.

Are you including these files explicitly? Can you share complete build log?

This is the code (an example, the same warning appears any time pack_struct_end.h is included) that raise the warning:

#include "pack_struct_start.h"
    struct xUDP_PACKET
    {
        EthernetHeader_t xEthernetHeader; /**< UDP-Packet ethernet header  0 + 14 = 14 */
        IPHeader_t xIPHeader;             /**< UDP-Packet IP header        14 + 20 = 34 */
        UDPHeader_t xUDPHeader;           /**< UDP-Packet UDP header       34 +  8 = 42 */
    }

    #include "pack_struct_end.h"
    typedef struct xUDP_PACKET UDPPacket_t;

I’ve included the IAR pack_struct files included in TCP library.

Are you using the IAR specific file? FreeRTOS-Plus-TCP/pack_struct_end.h at main · FreeRTOS/FreeRTOS-Plus-TCP · GitHub

Yes, I am. This is the preprocessor output of this struct:

__packed
    struct xUDP_PACKET
    {
        EthernetHeader_t xEthernetHeader;  
        IPHeader_t xIPHeader;              
        UDPHeader_t xUDPHeader;            
    }























 






 

;
    typedef struct xUDP_PACKET UDPPacket_t;

I created an IAR project with FreeRTOS+TCP and I am able to repro this warning. I have also verified the preprocessor output and this seems like an incorrect warning from the compiler. If I remove the semi-colon from the pack_struct_end.h, it results in an error confirming that the compiler does see the semi colon.

So we can conclude that this warning is not important and you can safely suppress it.

Thanks.

1 Like