ARM-software / CMSIS_5

CMSIS Version 5 Development Repository
http://arm-software.github.io/CMSIS_5/index.html
Apache License 2.0
1.35k stars 1.08k forks source link

Redefinitions of __NO_RETURN in RTOS/RTX #1488

Open utsavm9 opened 2 years ago

utsavm9 commented 2 years ago

I am using this gcc for a Cortex M4

arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]

I am getting a warning when compiling CMSIS Core and CMSIS RTOS:

In file included from cmsis//5.4.0/CMSIS/RTOS/RTX/SRC/rt_CMSIS.c:54:0:
cmsis//5.4.0/CMSIS/RTOS/RTX/INC/cmsis_os.h:75:0: error: "__NO_RETURN" redefined [-Werror]
 #define __NO_RETURN __attribute__((noreturn))

In file included from cmsis//5.4.0/CMSIS/Core/Include/cmsis_compiler.h:48:0,
                 from cmsis//5.4.0/CMSIS/Core/Include/core_cm4.h:162,
                 from cmsis//5.4.0/CMSIS/RTOS/RTX/SRC/rt_CMSIS.c:29:
cmsis//5.4.0/CMSIS/Core/Include/cmsis_gcc.h:53:0: note: this is the location of the previous definition
   #define __NO_RETURN                            __attribute__((__noreturn__))

The issue is that rt_CMSIS.c is redefining __NO_RETURN multiple times:

https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/RTOS/RTX/SRC/rt_CMSIS.c#L29 https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/core_cm4.h#L162 https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/cmsis_compiler.h#L54 https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/cmsis_gcc.h#L53 (which is guarded by a #ifndef)

But that file also gets a definition of __NO_RETURN from:

https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/RTOS/RTX/SRC/rt_CMSIS.c#L54 https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/RTOS/RTX/INC/cmsis_os.h#L75

and

https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/RTOS/RTX/SRC/rt_CMSIS.c#L138

Can these last two definitions also be guarded by an ifndef?

JonatanAntoni commented 2 years ago

Hi @utsavm9,

RTX4 is not maintained anymore. I suggest to use RTX5 instead.

Cheers, Jonatan