Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with -Wpedantic on GCC #1059

Merged
merged 5 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ add_compile_options(
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wpedantic>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wconversion>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wunused-variable>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
Expand All @@ -217,6 +217,9 @@ add_compile_options(
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-extra-semi-stmt>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-missing-noreturn>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-cast-align>

# Suppressions required to build clean with GCC.
$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-declaration-after-statement>
)

########################################################################
Expand Down
5 changes: 5 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions source/include/FreeRTOS_IPv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

/* Forward declarations. */
struct xNETWORK_BUFFER;
enum eFrameProcessingResult;
struct xIP_PACKET;

#define ipSIZE_OF_IPv4_HEADER 20U
Expand Down Expand Up @@ -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" */
Expand Down
9 changes: 9 additions & 0 deletions source/include/FreeRTOS_IPv4_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" */
Expand Down
1 change: 1 addition & 0 deletions test/unit-test/FreeRTOS_IP/FreeRTOS_IP_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions test/unit-test/FreeRTOS_IP/ut.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion test/unit-test/FreeRTOS_IPv4_DiffConfig/ut.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion test/unit-test/FreeRTOS_IPv4_DiffConfig1/ut.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down