From dd78b02e4397a340bd491cb2e7b22ec4cb44bf40 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Thu, 7 Dec 2023 18:05:35 +0300 Subject: [PATCH 1/5] Enable -Wpedantic for GCC by default --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26d65651b..7d655b337 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,7 +201,7 @@ add_compile_options( $<$:-Wall> $<$:-Wextra> $<$:-Werror> - $<$:-Wpedantic> + $<$:-Wpedantic> $<$:-Wconversion> $<$:-Wunused-variable> $<$:-Weverything> @@ -217,6 +217,9 @@ add_compile_options( $<$:-Wno-extra-semi-stmt> $<$:-Wno-missing-noreturn> $<$:-Wno-cast-align> + + # Suppressions required to build clean with GCC. + $<$:-Wno-declaration-after-statement> ) ######################################################################## From c2112efe2735736902d41fbee0e0fe0efe084112 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Wed, 10 Jan 2024 14:03:50 +0300 Subject: [PATCH 2/5] cmake: add -Wno-pedantic for FreeRTOS_Sockets.c && GCC --- source/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0740d4da5..4d1ac23b9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -95,6 +95,11 @@ target_include_directories( freertos_plus_tcp SYSTEM include ) +# Suppressions required to build clean with GCC +if(CMAKE_C_COMPILER_ID STREQUAL GNU) + set_source_files_properties(FreeRTOS_Sockets.c PROPERTIES COMPILE_FLAGS -Wno-pedantic) +endif() + target_link_libraries( freertos_plus_tcp PUBLIC freertos_config From c320380c9980a16d95d409c0474bb4d1422788c7 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 10 Jan 2024 13:31:22 +0530 Subject: [PATCH 3/5] Fix warnings with enum eFrameProcessingResult --- source/include/FreeRTOS_IPv4.h | 10 ---------- source/include/FreeRTOS_IPv4_Private.h | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/source/include/FreeRTOS_IPv4.h b/source/include/FreeRTOS_IPv4.h index 3244a2895..233620d37 100644 --- a/source/include/FreeRTOS_IPv4.h +++ b/source/include/FreeRTOS_IPv4.h @@ -43,7 +43,6 @@ /* Forward declarations. */ struct xNETWORK_BUFFER; -enum eFrameProcessingResult; struct xIP_PACKET; #define ipSIZE_OF_IPv4_HEADER 20U @@ -97,15 +96,6 @@ BaseType_t xIsIPv4Loopback( uint32_t ulAddress ); */ BaseType_t xBadIPv4Loopback( const IPHeader_t * const pxIPHeader ); -/* The function 'prvAllowIPPacket()' checks if a packets should be processed. */ -enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * const pxIPPacket, - const struct xNETWORK_BUFFER * const pxNetworkBuffer, - UBaseType_t uxHeaderLength ); - -/* Check if the IP-header is carrying options. */ -enum eFrameProcessingResult prvCheckIP4HeaderOptions( struct xNETWORK_BUFFER * const pxNetworkBuffer ); - - /* *INDENT-OFF* */ #ifdef __cplusplus } /* extern "C" */ diff --git a/source/include/FreeRTOS_IPv4_Private.h b/source/include/FreeRTOS_IPv4_Private.h index bb09c801b..fd1cc922c 100644 --- a/source/include/FreeRTOS_IPv4_Private.h +++ b/source/include/FreeRTOS_IPv4_Private.h @@ -125,6 +125,15 @@ struct xTCP_PACKET #include "pack_struct_end.h" typedef struct xTCP_PACKET TCPPacket_t; + +/* The function 'prvAllowIPPacket()' checks if a packets should be processed. */ +enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * const pxIPPacket, + const struct xNETWORK_BUFFER * const pxNetworkBuffer, + UBaseType_t uxHeaderLength ); + +/* Check if the IP-header is carrying options. */ +enum eFrameProcessingResult prvCheckIP4HeaderOptions( struct xNETWORK_BUFFER * const pxNetworkBuffer ); + /* *INDENT-OFF* */ #ifdef __cplusplus } /* extern "C" */ From 5d503c1bf97792c90a30d1d0104f560549358419 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 10 Jan 2024 14:43:44 +0530 Subject: [PATCH 4/5] Fix unit tests --- test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c | 1 + test/unit-test/FreeRTOS_IP/ut.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c index 3b1b28715..ddcaed26a 100644 --- a/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c +++ b/test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c @@ -46,6 +46,7 @@ #include "mock_FreeRTOS_IP.h" #include "mock_FreeRTOS_IP_Private.h" +#include "mock_FreeRTOS_IPv4_Private.h" #include "mock_FreeRTOS_IP_Utils.h" #include "mock_FreeRTOS_IP_Timers.h" #include "mock_FreeRTOS_TCP_IP.h" diff --git a/test/unit-test/FreeRTOS_IP/ut.cmake b/test/unit-test/FreeRTOS_IP/ut.cmake index f26cfaff3..b2a33dac1 100644 --- a/test/unit-test/FreeRTOS_IP/ut.cmake +++ b/test/unit-test/FreeRTOS_IP/ut.cmake @@ -33,6 +33,7 @@ list(APPEND mock_list "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_TCP_IP.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_UDP_IP.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Private.h" + "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IPv4_Private.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/NetworkBufferManagement.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/NetworkInterface.h" "${MODULE_ROOT_DIR}/test/unit-test/${project_name}/IP_list_macros.h" From 5de95b62cf16013510863119805ec09e1274e8f7 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 10 Jan 2024 15:43:44 +0530 Subject: [PATCH 5/5] Fix unit tests --- test/unit-test/FreeRTOS_IPv4_DiffConfig/ut.cmake | 1 - test/unit-test/FreeRTOS_IPv4_DiffConfig1/ut.cmake | 1 - 2 files changed, 2 deletions(-) diff --git a/test/unit-test/FreeRTOS_IPv4_DiffConfig/ut.cmake b/test/unit-test/FreeRTOS_IPv4_DiffConfig/ut.cmake index a0614a58f..0b6b4970d 100644 --- a/test/unit-test/FreeRTOS_IPv4_DiffConfig/ut.cmake +++ b/test/unit-test/FreeRTOS_IPv4_DiffConfig/ut.cmake @@ -17,7 +17,6 @@ list(APPEND mock_list "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Timers.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Utils.h" - "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IPv4_Private.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_Routing.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_ARP.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_ICMP.h" diff --git a/test/unit-test/FreeRTOS_IPv4_DiffConfig1/ut.cmake b/test/unit-test/FreeRTOS_IPv4_DiffConfig1/ut.cmake index a72d11f80..0fa613c7d 100644 --- a/test/unit-test/FreeRTOS_IPv4_DiffConfig1/ut.cmake +++ b/test/unit-test/FreeRTOS_IPv4_DiffConfig1/ut.cmake @@ -17,7 +17,6 @@ list(APPEND mock_list "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Timers.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP_Utils.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IP.h" - "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_IPv4_Private.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_Routing.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_ARP.h" "${CMAKE_BINARY_DIR}/Annexed_TCP/FreeRTOS_ICMP.h"