f0efd92502
At present it is possible to call the CMSE functions for checking addresses (such as cmse_check_address_range) and forget to check/use the return value. This patch makes the interfaces more robust against programmer error by marking these functions with the warn_unused_result attribute. With this set, any use of these functions that does not use the result will produce a warning. This produces a warning on default warn levels when the result of the cmse functions is not used. For the following function: void foo() { int *data; cmse_check_address_range((int*)data, 0, 0); } The following warning is emitted: warning: ignoring return value of 'cmse_check_address_range' declared with attribute 'warn_unused_result' [-Wunused-result] 6 | cmse_check_address_range((int*)data, 0, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gcc/ChangeLog: 2019-07-31 Joel Hutton <Joel.Hutton@arm.com> * config/arm/arm_cmse.h (cmse_nonsecure_caller): Add warn_unused_result attribute. (cmse_check_address_range): Add warn_unused_result attribute. libgcc/ChangeLog: 2019-07-31 Joel Hutton <Joel.Hutton@arm.com> * config/arm/cmse.c (cmse_check_address_range): Add warn_unused_result attribute. 2019-07-31 Joel Hutton <Joel.Hutton@arm.com> * gcc.target/arm/cmse/cmse-17.c: New test. From-SVN: r273924 |
||
---|---|---|
.. | ||
bpabi-lib.h | ||
bpabi-v6m.S | ||
bpabi.c | ||
bpabi.S | ||
cmse_nonsecure_call.S | ||
cmse.c | ||
crtfastmath.c | ||
crti.S | ||
crtn.S | ||
fp16.c | ||
freebsd-atomic.c | ||
ieee754-df.S | ||
ieee754-sf.S | ||
lib1funcs.S | ||
libgcc-bpabi.ver | ||
libunwind.S | ||
linux-atomic-64bit.c | ||
linux-atomic.c | ||
pr-support.c | ||
sfp-machine.h | ||
symbian-lib.h | ||
t-arm | ||
t-bpabi | ||
t-elf | ||
t-freebsd | ||
t-linux | ||
t-linux-eabi | ||
t-netbsd | ||
t-netbsd-eabi | ||
t-softfp | ||
t-strongarm-elf | ||
t-symbian | ||
t-vxworks7 | ||
t-wince-pe | ||
unaligned-funcs.c | ||
unwind-arm-vxworks.c | ||
unwind-arm.c | ||
unwind-arm.h |