zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.73k stars 6.56k forks source link

sys: util: Macro name collision with CMSIS DSP #64318

Closed spe-ciellt closed 1 year ago

spe-ciellt commented 1 year ago

Describe the bug The macro names ROUND_UP() and ROUND_DOWN() are both defined in include/sys/util.h and in the CMSIS DSP library. In the CMSIS DSP library they are protected by #ifndef/#endif, while they are not protected in include/sys/util.h.

To Reproduce If the CMSIS DSP library is enabled one get compilation warnings/errors if arm_math.h is included before zephyr/kernel.h. If you sort inclusion files in alphabetical order this will happen.

Expected behavior No compilation problems when using the CMSIS DSP library.

Impact Changing the order of inclusion fixed the compilation error. But I wonder if this gives other problems?

Environment (please complete the following information):

Additional context I have a pull request for adding #ifndef/#endif to include/sys/util.h. But maybe that is the wrong solution and the best solution is to rename the macro names to avoid this problem?

The pull request is at https://github.com/zephyrproject-rtos/zephyr/pull/64314

spe-ciellt commented 1 year ago

Closed with reference to Zephyr macro name collision rule in the pull request.