Skip to content

Commit

Permalink
Fix #298: Fix minor warnings in OSAL code
Browse files Browse the repository at this point in the history
Fix warnings that are triggered by compiling the OSAL coverage
unit test with strict settings.

- The OS_FPUExcAttachHandler function needs to be prototyped
  as accepting a function pointer (not void*)
- Const-Correctness on OS_ModuleLoad_Impl()
- Use void* instead of char* for buffer pointer as the specific
  type is not known
- Cast the function passed into taskSpawn on VxWorks
  • Loading branch information
jphickey committed Dec 9, 2019
1 parent 155e9eb commit 3110d25
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/os/inc/osapi-os-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ int32 OS_ExcDisable (int32 ExceptionNumber);
* @returns OS_SUCCESS on success, or appropriate error code
* OS_ERR_NOT_IMPLEMENTED on platforms that do not support this function
*/
int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler ,
int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler,
int32 parameter);

/*-------------------------------------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion src/os/portable/os-impl-posix-dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int32 OS_SymbolLookup_Impl( cpuaddr *SymbolAddress, const char *SymbolName )
* See description in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path )
int32 OS_ModuleLoad_Impl ( uint32 module_id, const char *translated_path )
{
int32 status = OS_ERROR;

Expand Down
2 changes: 1 addition & 1 deletion src/os/posix/osapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,7 @@ static int OS_PriorityRemap(uint32 InputPri)
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler,
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler,
int32 parameter)
{
/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/osapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr )
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler,
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler,
int32 parameter)
{
/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/rtems/osloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static bool OS_rtems_rtl_check_unresolved (rtems_rtl_unresolv_rec_t* rec,
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path )
int32 OS_ModuleLoad_Impl ( uint32 module_id, const char *translated_path )
{
int32 status = OS_ERROR;
int unresolved;
Expand Down
4 changes: 2 additions & 2 deletions src/os/shared/os-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ int32 OS_SetLocalTime_Impl(const OS_time_t *time_struct);
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path );
int32 OS_ModuleLoad_Impl ( uint32 module_id, const char *translated_path );

/*----------------------------------------------------------------
Expand Down Expand Up @@ -1874,7 +1874,7 @@ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr );
* FPU API low-level handlers
* These may also not be implementable on some platforms
*/
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler,
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler,
int32 parameter);
int32 OS_FPUExcEnable_Impl(int32 ExceptionNumber);
int32 OS_FPUExcDisable_Impl(int32 ExceptionNumber);
Expand Down
2 changes: 1 addition & 1 deletion src/os/shared/osapi-fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* See description in API and header file for detail
*
*-----------------------------------------------------------------*/
int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler ,
int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler ,
int32 parameter)
{
if (ExceptionHandler == NULL)
Expand Down
4 changes: 2 additions & 2 deletions src/os/vxworks/osapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ VX_MUTEX_SEMAPHORE(OS_console_mut_mem);

typedef struct
{
char * const mem;
void * const mem;
SEM_ID vxid;
} VxWorks_GlobalMutex_t;

Expand Down Expand Up @@ -1538,7 +1538,7 @@ int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr )
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, void * ExceptionHandler,
int32 OS_FPUExcAttachHandler_Impl(uint32 ExceptionNumber, osal_task_entry ExceptionHandler,
int32 parameter)
{
/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/vxworks/osloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ int32 OS_SymbolTableDump_Impl ( const char *local_filename, uint32 SizeLimit )
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_ModuleLoad_Impl ( uint32 local_id, char *translated_path )
int32 OS_ModuleLoad_Impl ( uint32 local_id, const char *translated_path )
{
int32 return_code;
int fd;
Expand Down
2 changes: 1 addition & 1 deletion src/os/vxworks/ostimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id)
OSAL_TIMEBASE_TASK_PRIORITY, /* priority */
OSAL_TIMEBASE_TASK_OPTION_WORD, /* task option word */
OSAL_TIMEBASE_TASK_STACK_SIZE, /* size (bytes) of stack needed */
OS_VxWorks_TimeBaseTask,
(FUNCPTR)OS_VxWorks_TimeBaseTask,
global->active_id, /* 1st arg is ID */
0,0,0,0,0,0,0,0,0);

Expand Down
6 changes: 2 additions & 4 deletions src/ut-stubs/osapi-utstub-fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@
* Stub function for OS_FPUExcAttachHandler()
*
*****************************************************************************/
int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler ,
int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, osal_task_entry ExceptionHandler ,
int32 parameter)
{
int32 status;

UT_Stub_RegisterContext(UT_KEY(OS_FPUExcAttachHandler), ExceptionHandler);

status = UT_DEFAULT_IMPL(OS_FPUExcAttachHandler);
status = UT_DEFAULT_IMPL_ARGS(OS_FPUExcAttachHandler, ExceptionNumber, ExceptionHandler, parameter);

return status;
}
Expand Down

0 comments on commit 3110d25

Please sign in to comment.