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

Enabling user control of compiler analysis for non ISO statements #1140

Merged
merged 5 commits into from May 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/FreeRTOS_Sockets.c
Expand Up @@ -2901,7 +2901,9 @@ BaseType_t FreeRTOS_setsockopt( Socket_t xSocket,
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-111 */
/* coverity[misra_c_2012_rule_11_8_violation] */
/* coverity[misra_c_2012_rule_11_1_violation] */
ipconfigISO_STRICTNESS_VIOLATION_START;
pxSocket->pxUserWakeCallback = ( SocketWakeupCallback_t ) pvOptionValue;
ipconfigISO_STRICTNESS_VIOLATION_END;
xReturn = 0;
break;
#endif /* ipconfigSOCKET_HAS_USER_WAKE_CALLBACK */
Expand Down
37 changes: 37 additions & 0 deletions source/include/FreeRTOSIPConfigDefaults.h
Expand Up @@ -3374,6 +3374,43 @@ STATIC_ASSERT( ipconfigDNS_SEND_BLOCK_TIME_TICKS <= portMAX_DELAY );

/*---------------------------------------------------------------------------*/

/*
* ipconfigISO_STRICTNESS_VIOLATION_START, ipconfigISO_STRICTNESS_VIOLATION_END
*
* Type: compiler pragma injection macros
*
* These two macros enclose parts of the source that contain intentional
* deviations from the ISO C standard. Users, and AI (I welcome our robot
* overlords!), can use this to customize static analysis settings such as
* the `-pedantic` flag in GCC. These should appear in very few places within
* the FreeRTOS TCP source and should enclose only a line or two at a time.
* When first introduced, these macros enclosed a single line of source code in
* the sockets implementation.
*
* GCC example
*
* In gcc, to allow the Free RTOS TCP code to compile with `-pedantic` you can
* define these macros as such:
*
* ```
* // Last tested in GCC 10
* #define ipconfigISO_STRICTNESS_VIOLATION_START _Pragma("GCC diagnostic push") \
* _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
*
* #define ipconfigISO_STRICTNESS_VIOLATION_END _Pragma("GCC diagnostic pop")
* ```
*/

#ifndef ipconfigISO_STRICTNESS_VIOLATION_START
#define ipconfigISO_STRICTNESS_VIOLATION_START
#endif

#ifndef ipconfigISO_STRICTNESS_VIOLATION_END
#define ipconfigISO_STRICTNESS_VIOLATION_END
#endif

/*---------------------------------------------------------------------------*/

/* Should only be included here, ensures trace config is set first. */
#include "IPTraceMacroDefaults.h"

Expand Down