Run uncrustify with github workflows (#369)

* uncrustify with github workflows

* Fix find expression

* Add uncrustify configuration file

* Uncrustify some files

* uncrustify some more files

* uncrustify more files

* Fix whitespace at end of lines

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
This commit is contained in:
alfred gedeon 2021-07-28 17:53:10 -07:00 committed by GitHub
parent 85a23127cc
commit ce81bcb33f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 375 additions and 184 deletions

160
.github/uncrustify.cfg vendored Normal file
View File

@ -0,0 +1,160 @@
# Uncrustify-0.67
input_tab_size = 4 # unsigned number
output_tab_size = 4 # unsigned number
sp_arith = force # ignore/add/remove/force
sp_assign = force # ignore/add/remove/force
sp_assign_default = force # ignore/add/remove/force
sp_before_assign = force # ignore/add/remove/force
sp_after_assign = force # ignore/add/remove/force
sp_enum_assign = force # ignore/add/remove/force
sp_enum_before_assign = force # ignore/add/remove/force
sp_enum_after_assign = force # ignore/add/remove/force
sp_pp_stringify = add # ignore/add/remove/force
sp_bool = force # ignore/add/remove/force
sp_compare = force # ignore/add/remove/force
sp_inside_paren = force # ignore/add/remove/force
sp_paren_paren = force # ignore/add/remove/force
sp_paren_brace = force # ignore/add/remove/force
sp_before_ptr_star = force # ignore/add/remove/force
sp_before_unnamed_ptr_star = force # ignore/add/remove/force
sp_between_ptr_star = remove # ignore/add/remove/force
sp_after_ptr_star = force # ignore/add/remove/force
sp_before_byref = force # ignore/add/remove/force
sp_after_byref = remove # ignore/add/remove/force
sp_after_byref_func = remove # ignore/add/remove/force
sp_before_angle = remove # ignore/add/remove/force
sp_inside_angle = remove # ignore/add/remove/force
sp_after_angle = force # ignore/add/remove/force
sp_before_sparen = remove # ignore/add/remove/force
sp_inside_sparen = force # ignore/add/remove/force
sp_after_sparen = force # ignore/add/remove/force
sp_sparen_brace = force # ignore/add/remove/force
sp_before_semi_for = remove # ignore/add/remove/force
sp_before_semi_for_empty = add # ignore/add/remove/force
sp_after_semi_for_empty = force # ignore/add/remove/force
sp_before_square = remove # ignore/add/remove/force
sp_before_squares = remove # ignore/add/remove/force
sp_inside_square = force # ignore/add/remove/force
sp_after_comma = force # ignore/add/remove/force
sp_after_cast = force # ignore/add/remove/force
sp_inside_paren_cast = force # ignore/add/remove/force
sp_sizeof_paren = remove # ignore/add/remove/force
sp_inside_braces_enum = force # ignore/add/remove/force
sp_inside_braces_struct = force # ignore/add/remove/force
sp_inside_braces = force # ignore/add/remove/force
sp_inside_braces_empty = remove # ignore/add/remove/force
sp_type_func = force # ignore/add/remove/force
sp_func_proto_paren = remove # ignore/add/remove/force
sp_func_def_paren = remove # ignore/add/remove/force
sp_inside_fparens = remove # ignore/add/remove/force
sp_inside_fparen = force # ignore/add/remove/force
sp_fparen_brace = add # ignore/add/remove/force
sp_func_call_paren = remove # ignore/add/remove/force
sp_func_class_paren = remove # ignore/add/remove/force
sp_return_paren = remove # ignore/add/remove/force
sp_attribute_paren = remove # ignore/add/remove/force
sp_defined_paren = remove # ignore/add/remove/force
sp_macro = force # ignore/add/remove/force
sp_macro_func = force # ignore/add/remove/force
sp_brace_typedef = force # ignore/add/remove/force
sp_before_dc = remove # ignore/add/remove/force
sp_after_dc = remove # ignore/add/remove/force
sp_cond_colon = force # ignore/add/remove/force
sp_cond_question = force # ignore/add/remove/force
sp_case_label = force # ignore/add/remove/force
sp_endif_cmt = force # ignore/add/remove/force
sp_before_tr_emb_cmt = force # ignore/add/remove/force
sp_num_before_tr_emb_cmt = 1 # unsigned number
indent_columns = 4 # unsigned number
indent_with_tabs = 0 # unsigned number
indent_align_string = true # false/true
indent_class = true # false/true
indent_class_colon = true # false/true
indent_member = 3 # unsigned number
indent_switch_case = 4 # unsigned number
indent_case_brace = 3 # number
nl_assign_leave_one_liners = true # false/true
nl_class_leave_one_liners = true # false/true
nl_start_of_file = remove # ignore/add/remove/force
nl_end_of_file = force # ignore/add/remove/force
nl_end_of_file_min = 1 # unsigned number
nl_assign_brace = add # ignore/add/remove/force
nl_func_var_def_blk = 1 # unsigned number
nl_fcall_brace = add # ignore/add/remove/force
nl_enum_brace = force # ignore/add/remove/force
nl_struct_brace = force # ignore/add/remove/force
nl_union_brace = force # ignore/add/remove/force
nl_if_brace = add # ignore/add/remove/force
nl_brace_else = add # ignore/add/remove/force
nl_else_brace = add # ignore/add/remove/force
nl_getset_brace = force # ignore/add/remove/force
nl_for_brace = add # ignore/add/remove/force
nl_while_brace = add # ignore/add/remove/force
nl_do_brace = add # ignore/add/remove/force
nl_switch_brace = add # ignore/add/remove/force
nl_multi_line_define = true # false/true
nl_before_case = true # false/true
nl_after_case = true # false/true
nl_func_type_name = remove # ignore/add/remove/force
nl_func_proto_type_name = remove # ignore/add/remove/force
nl_func_paren = remove # ignore/add/remove/force
nl_func_def_paren = remove # ignore/add/remove/force
nl_func_decl_start = remove # ignore/add/remove/force
nl_func_def_start = remove # ignore/add/remove/force
nl_func_decl_args = add # ignore/add/remove/force
nl_func_def_args = add # ignore/add/remove/force
nl_func_decl_end = remove # ignore/add/remove/force
nl_func_def_end = remove # ignore/add/remove/force
nl_fdef_brace = add # ignore/add/remove/force
nl_after_semicolon = true # false/true
nl_after_brace_open = true # false/true
nl_after_brace_close = true # false/true
nl_squeeze_ifdef = true # false/true
nl_before_if = force # ignore/add/remove/force
nl_after_if = force # ignore/add/remove/force
nl_before_for = force # ignore/add/remove/force
nl_after_for = force # ignore/add/remove/force
nl_before_while = force # ignore/add/remove/force
nl_after_while = force # ignore/add/remove/force
nl_before_switch = force # ignore/add/remove/force
nl_after_switch = force # ignore/add/remove/force
nl_before_do = force # ignore/add/remove/force
nl_after_do = force # ignore/add/remove/force
nl_max = 4 # unsigned number
nl_after_func_proto_group = 1 # unsigned number
nl_after_func_body_class = 2 # unsigned number
nl_before_block_comment = 2 # unsigned number
eat_blanks_after_open_brace = true # false/true
eat_blanks_before_close_brace = true # false/true
nl_after_return = true # false/true
pos_bool = trail # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force
align_var_def_amp_style = 1 # unsigned number
align_var_def_thresh = 16 # unsigned number
align_assign_thresh = 12 # unsigned number
align_struct_init_span = 3 # unsigned number
align_typedef_gap = 3 # unsigned number
align_typedef_span = 5 # unsigned number
align_typedef_star_style = 1 # unsigned number
align_typedef_amp_style = 1 # unsigned number
align_right_cmt_span = 3 # unsigned number
align_nl_cont = true # false/true
align_pp_define_gap = 4 # unsigned number
align_pp_define_span = 3 # unsigned number
cmt_cpp_to_c = true # false/true
cmt_star_cont = true # false/true
mod_full_brace_do = add # ignore/add/remove/force
mod_full_brace_for = add # ignore/add/remove/force
mod_full_brace_if = add # ignore/add/remove/force
mod_full_brace_while = add # ignore/add/remove/force
mod_full_paren_if_bool = true # false/true
mod_remove_extra_semicolon = true # false/true
mod_add_long_ifdef_endif_comment = 10 # unsigned number
mod_add_long_ifdef_else_comment = 10 # unsigned number
mod_case_brace = remove # ignore/add/remove/force
mod_remove_empty_return = true # false/true
pp_indent = force # ignore/add/remove/force
pp_indent_at_level = true # false/true
pp_indent_count = 4 # unsigned number
pp_space = remove # ignore/add/remove/force
pp_if_indent_code = true # false/true
# option(s) with 'not default' value: 158

View File

@ -34,6 +34,27 @@ jobs:
else
exit 1
fi
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Uncrustify
run: sudo apt-get install uncrustify
- name: Run Uncrustify
run: |
uncrustify --version
find . \( -name portable \) -prune -false -o -iname "*.[hc]" -exec uncrustify --check -c .github/uncrustify.cfg {} +
- name: Check For Trailing Whitespace
run: |
set +e
grep --exclude="README.md" --exclude-dir="portable" -rnI -e "[[:blank:]]$" .
if [ "$?" = "0" ]; then
echo "Files have trailing whitespace."
exit 1
else
exit 0
fi
url-check:
runs-on: ubuntu-latest
steps:

View File

@ -130,7 +130,8 @@
#ifdef INCLUDE_xTaskDelayUntil
#ifdef INCLUDE_vTaskDelayUntil
/* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
/* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
* compatibility is maintained if only one or the other is defined, but
* there is a conflict if both are defined. */
#error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
@ -139,7 +140,8 @@
#ifndef INCLUDE_xTaskDelayUntil
#ifdef INCLUDE_vTaskDelayUntil
/* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
/* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
* the project's FreeRTOSConfig.h probably pre-dates the introduction of
* xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
* INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
@ -906,6 +908,7 @@
#endif
#ifndef configRUN_TIME_COUNTER_TYPE
/* Defaults to uint32_t for backward compatibility, but can be overridden in
* FreeRTOSConfig.h if uint32_t is too restrictive. */

View File

@ -308,7 +308,7 @@ typedef struct xLIST
* \ingroup LinkedList
*/
#define listREMOVE_ITEM( pxItemToRemove ) \
{ \
{ \
/* The list item knows which list it is in. Obtain the list from the list \
* item. */ \
List_t * const pxList = ( pxItemToRemove )->pxContainer; \
@ -323,7 +323,7 @@ typedef struct xLIST
\
( pxItemToRemove )->pxContainer = NULL; \
( pxList->uxNumberOfItems )--; \
}
}
/*
* Inline version of vListInsertEnd() to provide slight optimisation for
@ -348,7 +348,7 @@ typedef struct xLIST
* \ingroup LinkedList
*/
#define listINSERT_END( pxList, pxNewListItem ) \
{ \
{ \
ListItem_t * const pxIndex = ( pxList )->pxIndex; \
\
/* Only effective when configASSERT() is also defined, these tests may catch \
@ -370,7 +370,7 @@ typedef struct xLIST
( pxNewListItem )->pxContainer = ( pxList ); \
\
( ( pxList )->uxNumberOfItems )++; \
}
}
/*
* Access function to obtain the owner of the first entry in a list. Lists

View File

@ -65,9 +65,9 @@
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
#elif portBYTE_ALIGNMENT == 1
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
#else
#else /* if portBYTE_ALIGNMENT == 32 */
#error "Invalid portBYTE_ALIGNMENT definition"
#endif
#endif /* if portBYTE_ALIGNMENT == 32 */
#ifndef portUSING_MPU_WRAPPERS
#define portUSING_MPU_WRAPPERS 0
@ -178,9 +178,9 @@ void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
#if( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
void *pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
void vPortFreeStack( void *pv ) PRIVILEGED_FUNCTION;
#if ( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
void * pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
void vPortFreeStack( void * pv ) PRIVILEGED_FUNCTION;
#else
#define pvPortMallocStack pvPortMalloc
#define vPortFreeStack vPortFree

View File

@ -59,7 +59,7 @@
#define taskCHECK_FOR_STACK_OVERFLOW() \
{ \
/* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING) \
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
{ \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \
@ -75,7 +75,7 @@
{ \
\
/* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING) \
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
{ \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \

View File

@ -357,7 +357,7 @@ typedef enum
/**
* task. h
* <pre>
* TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
* TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
* const char *pcName,
* uint32_t ulStackDepth,
* void *pvParameters,
@ -860,9 +860,9 @@ BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
* return a value.
*/
#define vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) \
{ \
{ \
( void ) xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); \
}
}
/**
@ -1611,7 +1611,7 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
#if ( configCHECK_FOR_STACK_OVERFLOW > 0 )
/**
/**
* task.h
* <pre>void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); </pre>
*
@ -1628,7 +1628,8 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
#endif
#if ( configUSE_TICK_HOOK > 0 )
/**
/**
* task.h
* <pre>void vApplicationTickHook( void ); </pre>
*
@ -1639,7 +1640,8 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
#endif
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/**
/**
* task.h
* <pre>void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) </pre>
*

View File

@ -1328,7 +1328,7 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/**
/**
* task.h
* <pre>void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) </pre>
*

View File

@ -314,6 +314,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
}
taskEXIT_CRITICAL();
}
else
@ -345,12 +346,12 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
if( ( uxQueueLength > ( UBaseType_t ) 0 ) &&
( pxStaticQueue != NULL ) &&
/* A queue storage area should be provided if the item size is not 0, and
* should not be provided if the item size is 0. */
( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0 ) ) ) &&
( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0 ) ) ) )
{
#if ( configASSERT_DEFINED == 1 )
{
/* Sanity check that the size of the structure used to declare a

View File

@ -503,14 +503,15 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )
configASSERT( pxStreamBuffer );
/* The code below reads xTail and then xHead. This is safe if the stream
buffer is updated once between the two reads - but not if the stream buffer
is updated more than once between the two reads - hence the loop. */
* buffer is updated once between the two reads - but not if the stream buffer
* is updated more than once between the two reads - hence the loop. */
do
{
xOriginalTail = pxStreamBuffer->xTail;
xSpace = pxStreamBuffer->xLength + pxStreamBuffer->xTail;
xSpace -= pxStreamBuffer->xHead;
} while( xOriginalTail != pxStreamBuffer->xTail );
xSpace -= ( size_t ) 1;
if( xSpace >= pxStreamBuffer->xLength )
@ -1009,7 +1010,7 @@ static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,
if( xCount != ( size_t ) 0 )
{
/* Read the actual data and update the tail to mark the data as officially consumed. */
pxStreamBuffer->xTail = prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) pvRxData, xCount, xNextTail); /*lint !e9079 Data storage area is implemented as uint8_t array for ease of sizing, indexing and alignment. */
pxStreamBuffer->xTail = prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) pvRxData, xCount, xNextTail ); /*lint !e9079 Data storage area is implemented as uint8_t array for ease of sizing, indexing and alignment. */
}
return xCount;

View File

@ -297,6 +297,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
#endif
#if ( configUSE_NEWLIB_REENTRANT == 1 )
/* Allocate a Newlib reent structure that is specific to this task.
* Note Newlib support has been included by popular demand, but is not
* used by the FreeRTOS maintainers themselves. FreeRTOS is not
@ -916,6 +917,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
/* This is used as an array index so must ensure it's not too large. */
configASSERT( uxPriority < configMAX_PRIORITIES );
if( uxPriority >= ( UBaseType_t ) configMAX_PRIORITIES )
{
uxPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U;
@ -5295,10 +5297,10 @@ TickType_t uxTaskResetEventItemValue( void )
return ulReturn;
}
#endif
#endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
/*-----------------------------------------------------------*/
static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
const BaseType_t xCanBlockIndefinitely )
{
TickType_t xTimeToWake;

View File

@ -521,7 +521,7 @@
/* Insert the timer into the appropriate list for the next expiry time.
* If the next expiry time has already passed, advance the expiry time,
* call the callback function, and try again. */
while ( prvInsertTimerInActiveList( pxTimer, ( xExpiredTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xExpiredTime ) != pdFALSE )
while( prvInsertTimerInActiveList( pxTimer, ( xExpiredTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xExpiredTime ) != pdFALSE )
{
/* Advance the expiry time. */
xExpiredTime += pxTimer->xTimerPeriodInTicks;
@ -540,6 +540,7 @@
/* Remove the timer from the list of active timers. A check has already
* been performed to ensure the list is not empty. */
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
/* If the timer is an auto-reload timer then calculate the next