Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GCC(G++) compiler warning in cmsis_gcc.h in NRF5-SDK14.2 (when compiling with C++17)

Hy,

i get two warnings from my c++-compiler (arm-none-eabi-g++ (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904) if I use the header cmsis_gcc.h in the NRF5 SDK 14.2.0 with C++17:

nrf_sdk-src/components/toolchain/cmsis/include/cmsis_gcc.h:150:21: error: ISO C++1z does not allow 'register' storage class specifier [-Wregister] register uint32_t result;

nrf_sdk-src/components/toolchain/cmsis/include/cmsis_gcc.h:175:21: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister] register uint32_t result;

It is clear, that you can supress the warning by adding the compiler flag -Wno-register, but since this keyword doesn't have any meaning in the C++ world, it may be better, to remove it completely or enable it only for C-compilers, if really needed.

Since according to http://en.cppreference.com/w/cpp/keyword/register, the register keyword doesn't have any meaning in C++ before version 17 and in C++17 and later it is marked as deprecated.

Therefore, it would be good, if it is removed, if the file is used in a C++-compiler to conform future standards, because the register keyword may be used in the future for other purposes.

Thanks.

Parents Reply Children
Related