-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support removal of register storage class specifier in C++17 #345
Comments
May I ask you to be slightly more specific, please? Please be aware that CMSIS itself it intended to be ANSI-C (C99) and not C++. Simply removing the storage class Using CMSIS from C++ should be possible when compiling all .c files in C-Mode. Inline functions defined in header files should be compiled as |
As of C++17 the existing solution does not work. CMSIS Core headers like The change to the The change can probably be conditional on using C++ at an affected version (as suggested) and isolated to compiler-specific headers like Some information on the reason for the change is here. As that material indicates gcc completely ignores the |
Thanks for the details. I can know comprehend the issues you face. Its all about the inline functions using raw assembly instructions for special function register accesses like
In other function we already skipped the Is it feasible for you to provide the changes in terms of a pull request? Thanks again for your contribution. |
Yes, I can do a PR sometime in the next week or so. Not sure whether I'll be able to test cmsis_armclang but if not will note that in the PR. |
Avoid using the register storage class specifier in core headers when compiling for C++ versions from which it has been removed, starting with C++17. Retain it for C and earlier C++ releases. See: http://en.cppreference.com/w/cpp/language/storage_duration Closes issue ARM-software#345
Alternative pull request which removes the keyword wherever possible - #365 |
In C++17 `register` keyword was removed. Current gcc 8.1.0 produces following warning if `-std=c++17` flag is used: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] GCC almost completely ignores `register` keyword, with rare exception of `-O0` when additional copy from/to stack may be generated. For simplicity of the codebase it is better to just remove this problematic keyword where it is not strictly required. See: http://en.cppreference.com/w/cpp/language/storage_duration Closes issue #345
Thanks @FreddieChopin for your contribution. |
@JonatanAntoni @FreddieChopin The merged changes work for my application. Thanks. |
ARMCLANG编译需要修改cmbacktrace源码: 大部分defined(__CC_ARM) => defined(__CC_ARM) || defined(__CLANG_ARM) 少数保留不变,使用GNUC分支的代码(因为AC6没有AC5的__asm) c++11需要增加编译指令-Wno-deprecated-register c++17需要去掉register修饰符(添加extern "C"未能解决),关于register修饰符的问题:ARM-software/CMSIS_5#345 SConscript去掉AC6不支持的--c99。 env工具不自带addr2line工具,需要从cmbacktrace官方仓库下载。 如果使用ULOG则一定要启用ULOG_USING_ISR_LOG,否则fault中断无法输出内容。
In C++17 `register` keyword was removed. Current gcc 8.1.0 produces following warning if `-std=c++17` flag is used: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] GCC almost completely ignores `register` keyword, with rare exception of `-O0` when additional copy from/to stack may be generated. For simplicity of the codebase it is better to just remove this problematic keyword where it is not strictly required. See: http://en.cppreference.com/w/cpp/language/storage_duration Closes issue ARM-software#345
Prior to C++17 the
register
storage class specifier was deprecated; in C++17 it has been removed, making attempts to compile with CMSIS 5.3 with gcc--std=c++17
fail. Something like the following is needed in every header that uses that feature, along with the corresponding modifications at all use-points.See: http://en.cppreference.com/w/cpp/language/storage_duration
The text was updated successfully, but these errors were encountered: