Closed wallacegibbon closed 2 years ago
which will cause many compiling warnings in g++.
Could you show me what warning is throw out by g++? thanks
OK, here are the warnings copied from my terminal:
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h: In function 'void SysTimer_SetLoadValue(uint64_t)':
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h:123:15: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
123 | __SW(addr + 4, (uint32_t)(value >> 32));
| ~~~~~^~~
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h: In function 'uint64_t SysTimer_GetLoadValue()':
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h:148:23: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
148 | high0 = __LW(addr + 4);
| ~~~~~^~~
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h:150:22: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
150 | high = __LW(addr + 4);
| ~~~~~^~~
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h: In function 'void SysTimer_SetCompareValue(uint64_t)':
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h:180:19: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
180 | __SW(addr + 4, (uint32_t)(value >> 32));
| ~~~~~^~~
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h:189:19: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
189 | __SW(addr + 4, (uint32_t)(value >> 32));
| ~~~~~^~~
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h: In function 'uint64_t SysTimer_GetCompareValue()':
./nuclei-sdk/NMSIS/Core/Include/core_feature_timer.h:218:26: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
218 | high = __LW(addr + 4);
| ~~~~~^~~
Fixed
In
NMSIS/Core/Include/core_feature_timer.h
, there are codes like:which will cause many compiling warnings in g++.
When doing arithmetic operations,
void *
will be treated aschar *
in GCC, but it is not defined in the C standard, I guess it will be better to replace them by something likeor