That PR does fix that specific compilation error, but the bigger issue of FreeRTOS-Plus-TCP dictating what compilation flags consumers use to build freertos_plus_tcp
(specifically the C standard that is used and the warnings/errors that are enabled) remains. As mentioned in my original post, the minimal project I provided only reproduces some of the compilation issues I am encountering. My actual project is being built using arm-none-eabi-gcc
(9.2.1) for an Arm Cortex-M4F processor (ATSAME54P20A), and I am encountering the following compilation issues:
[ 59%] Building C object freertos/freertos-plus-tcp/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_ARP.c.obj
In file included from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/FreeRTOS_ARP.c:44:
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:211:9: error: type of bit-field 'bActive' is a GCC extension [-Werror=pedantic]
211 | bActive : 1, /**< This timer is running and must be processed. */
| ^~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:212:9: error: type of bit-field 'bExpired' is a GCC extension [-Werror=pedantic]
212 | bExpired : 1; /**< Timer has expired and a task must be processed. */
| ^~~~~~~~
In file included from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Utils.h:50,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:488,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/FreeRTOS_ARP.c:44:
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_Routing.h:109:17: error: type of bit-field 'bInterfaceUp' is a GCC extension [-Werror=pedantic]
109 | bInterfaceUp : 1, /**< Non-zero as soon as the interface is up. */
| ^~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_Routing.h:110:17: error: type of bit-field 'bCallDownEvent' is a GCC extension [-Werror=pedantic]
110 | bCallDownEvent : 1; /**< The down-event must be called. */
| ^~~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_Routing.h:197:17: error: type of bit-field 'bIsDefault' is a GCC extension [-Werror=pedantic]
197 | bIsDefault : 1, /**< This bit will be removed. */
| ^~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_Routing.h:204:13: error: type of bit-field 'bIPv6' is a GCC extension [-Werror=pedantic]
204 | bIPv6 : 1, /**< This end-point has an IP-address of type IPv6. */
| ^~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_Routing.h:206:17: error: type of bit-field 'bCallDownHook' is a GCC extension [-Werror=pedantic]
206 | bCallDownHook : 1, /**< The network down hook-must be called for this end-point. */
| ^~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_Routing.h:208:13: error: type of bit-field 'bEndPointUp' is a GCC extension [-Werror=pedantic]
208 | bEndPointUp : 1; /**< The end-point is up. */
| ^~~~~~~~~~~
In file included from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:39,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Utils.h:51,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:488,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/FreeRTOS_ARP.c:44:
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:62:17: error: type of bit-field 'ucTransmitCount' is a GCC extension [-Werror=pedantic]
62 | ucTransmitCount : 8, /**< Number of times the segment has been transmitted, used to calculate the RTT */
| ^~~~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:63:17: error: type of bit-field 'ucDupAckCount' is a GCC extension [-Werror=pedantic]
63 | ucDupAckCount : 8, /**< Counts the number of times that a higher segment was ACK'd. After 3 times a Fast Retransmission takes place */
| ^~~~~~~~~~~~~
In file included from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:39,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Utils.h:51,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:488,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/FreeRTOS_ARP.c:44:
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:64:17: error: type of bit-field 'bOutstanding' is a GCC extension [-Werror=pedantic]
64 | bOutstanding : 1, /**< It the peer's turn, we're just waiting for an ACK */
| ^~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:65:17: error: type of bit-field 'bAcked' is a GCC extension [-Werror=pedantic]
65 | bAcked : 1, /**< This segment has been acknowledged */
| ^~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:66:17: error: type of bit-field 'bIsForRx' is a GCC extension [-Werror=pedantic]
66 | bIsForRx : 1; /**< pdTRUE if segment is used for reception */
| ^~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:102:17: error: type of bit-field 'bHasInit' is a GCC extension [-Werror=pedantic]
102 | bHasInit : 1, /**< The window structure has been initialised */
| ^~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:103:17: error: type of bit-field 'bSendFullSize' is a GCC extension [-Werror=pedantic]
103 | bSendFullSize : 1, /**< May only send packets with a size equal to MSS (for optimisation) */
| ^~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_TCP_WIN.h:104:17: error: type of bit-field 'bTimeStamps' is a GCC extension [-Werror=pedantic]
104 | bTimeStamps : 1; /**< Socket is supposed to use TCP time-stamps. This depends on the */
| ^~~~~~~~~~~
In file included from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Utils.h:51,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:488,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/FreeRTOS_ARP.c:44:
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:537:17: error: type of bit-field 'bMssChange' is a GCC extension [-Werror=pedantic]
537 | bMssChange : 1, /**< This socket has seen a change in MSS */
| ^~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:538:17: error: type of bit-field 'bPassAccept' is a GCC extension [-Werror=pedantic]
538 | bPassAccept : 1, /**< See comment here above. */
| ^~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:539:17: error: type of bit-field 'bPassQueued' is a GCC extension [-Werror=pedantic]
539 | bPassQueued : 1, /**< See comment here above. */
| ^~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:540:17: error: type of bit-field 'bReuseSocket' is a GCC extension [-Werror=pedantic]
540 | bReuseSocket : 1, /**< When a listening socket gets a connection, do not create a new instance but keep on using it */
| ^~~~~~~~~~~~
In file included from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Utils.h:51,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP.h:488,
from /home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/FreeRTOS_ARP.c:44:
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:541:17: error: type of bit-field 'bCloseAfterSend' is a GCC extension [-Werror=pedantic]
541 | bCloseAfterSend : 1, /**< As soon as the last byte has been transmitted, finalise the connection
| ^~~~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:543:17: error: type of bit-field 'bUserShutdown' is a GCC extension [-Werror=pedantic]
543 | bUserShutdown : 1, /**< User requesting a graceful shutdown */
| ^~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:544:17: error: type of bit-field 'bCloseRequested' is a GCC extension [-Werror=pedantic]
544 | bCloseRequested : 1, /**< Request to finalise the connection */
| ^~~~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:545:17: error: type of bit-field 'bLowWater' is a GCC extension [-Werror=pedantic]
545 | bLowWater : 1, /**< high-water level has been reached. Cleared as soon as 'rx-count < lo-water' */
| ^~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:546:17: error: type of bit-field 'bWinChange' is a GCC extension [-Werror=pedantic]
546 | bWinChange : 1, /**< The value of bLowWater has changed, must send a window update */
| ^~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:547:17: error: type of bit-field 'bSendKeepAlive' is a GCC extension [-Werror=pedantic]
547 | bSendKeepAlive : 1, /**< When this flag is true, a TCP keep-alive message must be send */
| ^~~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:548:17: error: type of bit-field 'bWaitKeepAlive' is a GCC extension [-Werror=pedantic]
548 | bWaitKeepAlive : 1, /**< When this flag is true, a TCP keep-alive reply is expected */
| ^~~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:549:17: error: type of bit-field 'bConnPrepared' is a GCC extension [-Werror=pedantic]
549 | bConnPrepared : 1, /**< Connecting socket: Message has been prepared */
| ^~~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:551:17: error: type of bit-field 'bConnPassed' is a GCC extension [-Werror=pedantic]
551 | bConnPassed : 1, /**< Connecting socket: Socket has been passed in a successful select() */
| ^~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:553:13: error: type of bit-field 'bFinAccepted' is a GCC extension [-Werror=pedantic]
553 | bFinAccepted : 1, /**< This socket has received (or sent) a FIN and accepted it */
| ^~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:554:17: error: type of bit-field 'bFinSent' is a GCC extension [-Werror=pedantic]
554 | bFinSent : 1, /**< We've sent out a FIN */
| ^~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:555:17: error: type of bit-field 'bFinRecv' is a GCC extension [-Werror=pedantic]
555 | bFinRecv : 1, /**< We've received a FIN from our peer */
| ^~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:556:17: error: type of bit-field 'bFinAcked' is a GCC extension [-Werror=pedantic]
556 | bFinAcked : 1, /**< Our FIN packet has been acked */
| ^~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:557:17: error: type of bit-field 'bFinLast' is a GCC extension [-Werror=pedantic]
557 | bFinLast : 1, /**< The last ACK (after FIN and FIN+ACK) has been sent or will be sent by the peer */
| ^~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:558:17: error: type of bit-field 'bRxStopped' is a GCC extension [-Werror=pedantic]
558 | bRxStopped : 1, /**< Application asked to temporarily stop reception */
| ^~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:559:17: error: type of bit-field 'bMallocError' is a GCC extension [-Werror=pedantic]
559 | bMallocError : 1, /**< There was an error allocating a stream */
| ^~~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:560:17: error: type of bit-field 'bWinScaling' is a GCC extension [-Werror=pedantic]
560 | bWinScaling : 1; /**< A TCP-Window Scaling option was offered and accepted in the SYN phase. */
| ^~~~~~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:654:18: error: type of bit-field 'bIsIPv6' is a GCC extension [-Werror=pedantic]
654 | uint32_t bIsIPv6 : 1; /**< Non-zero in case the connection is using IPv6. */
| ^~~~~~~
/home/apcountryman/projects/apcountryman/workbench/c/atsame54-xpro-freertos-tcp-echo/freertos/freertos-plus-tcp/source/include/FreeRTOS_IP_Private.h:655:18: error: type of bit-field 'bSomeFlag' is a GCC extension [-Werror=pedantic]
655 | uint32_t bSomeFlag : 1;
| ^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [freertos/freertos-plus-tcp/source/CMakeFiles/freertos_plus_tcp.dir/build.make:63: freertos/freertos-plus-tcp/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_ARP.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1066: freertos/freertos-plus-tcp/source/CMakeFiles/freertos_plus_tcp.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I haven’t looked at the declarations for every one of these bit fields, but the type of at least some of them is uint32_t
. With the compiler and standard library used by my project, uint32_t
is an alias for unsigned long
not unsigned int
which leads to these compilation issues (see Bit-fields - cppreference.com and c - warning when using bitfield with unsigned char - Stack Overflow). While the FreeRTOS-Plus-TCP source code could be modified to resolve these compilation issues, a far simpler solution is to not force consumers of FreeRTOS-Plus-TCP to use -Wpedantic
when building freertos_plus_tcp
.
While the forced use of -Wpedantic
is causing my compilation issues, the other compilation options FreeRTOS-Plus-TCP forces consumers to use when building freertos_plus_tcp
could cause compilation issues for projects that use other compilers and standard libraries. This happened with FreeRTOS-Kernel (CMake default compiler options and Microchip XC16 compatibility - #2 by ActoryOu) which led to FreeRTOS-Kernel no longer dictating what compilation flags consumers use to build freertos_kernel
. The same needs to be done for FreeRTOS-Plus-TCP.
test/build-combination/CMakeLists.txt
configures the compilation options used when compiling freertos_plus_tcp
(see FreeRTOS-Plus-TCP/test/build-combination/CMakeLists.txt at 1bc37d3e901dc585217877f0adbf0c9f456c6c34 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub) which, as elaborated on above, can cause problems for consumers of FreeRTOS-Plus-TCP.