Nuclei-Software / nuclei-sdk

Nuclei RISC-V Software Development Kit
https://doc.nucleisys.com/nuclei_sdk
Apache License 2.0
117 stars 50 forks source link

Register keyword removal #47

Closed gsauthof closed 1 year ago

gsauthof commented 1 year ago

I noticed that some headers use the register keyword, e.g.:

https://github.com/Nuclei-Software/nuclei-sdk/blob/b188abafa42e3a4405c298f97ad5b740cbe8215e/NMSIS/Core/Include/core_feature_base.h#L1487-L1502

AFAICS, those register keywords are superfluous because the following inline assembler directives specify the register-constraint for those variables.

However, OTOH, the asm register constraint can't be left out because the C register keyword is just a hint (in contrast to the GCC local register variable extension which is only supposed to be used if constraints aren't sufficient).

So I suggest to simply remove those register keywords.


Background: The register keyword was deprecated in C++ 17 and hence GCC warns about this when compiling with C++17 features enabled, even when wrapping the gd32vf103 headers in extern "C" { }.

As a workaround I #define register before including and gd32vf103 headers and so far I don't see any issues.

At least for now, one can also compile with -Wno-register.

fanghuaqi commented 1 year ago

Hi @gsauthof , thank you for the suggestion, I will take a try with removing it, see whether affect other source code.

fanghuaqi commented 1 year ago

See latest develop branch, register keywords are removed