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
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
bpabi-lib.h | Loading commit data... | |
bpabi-v6m.S | Loading commit data... | |
bpabi.S | Loading commit data... | |
bpabi.c | Loading commit data... | |
cmse.c | Loading commit data... | |
cmse_nonsecure_call.S | Loading commit data... | |
crtfastmath.c | Loading commit data... | |
crti.S | Loading commit data... | |
crtn.S | Loading commit data... | |
fp16.c | Loading commit data... | |
freebsd-atomic.c | Loading commit data... | |
ieee754-df.S | Loading commit data... | |
ieee754-sf.S | Loading commit data... | |
lib1funcs.S | Loading commit data... | |
libgcc-bpabi.ver | Loading commit data... | |
libunwind.S | Loading commit data... | |
linux-atomic-64bit.c | Loading commit data... | |
linux-atomic.c | Loading commit data... | |
pr-support.c | Loading commit data... | |
sfp-machine.h | Loading commit data... | |
symbian-lib.h | Loading commit data... | |
t-arm | Loading commit data... | |
t-bpabi | Loading commit data... | |
t-elf | Loading commit data... | |
t-freebsd | Loading commit data... | |
t-linux | Loading commit data... | |
t-linux-eabi | Loading commit data... | |
t-netbsd | Loading commit data... | |
t-netbsd-eabi | Loading commit data... | |
t-softfp | Loading commit data... | |
t-strongarm-elf | Loading commit data... | |
t-symbian | Loading commit data... | |
t-vxworks7 | Loading commit data... | |
t-wince-pe | Loading commit data... | |
unaligned-funcs.c | Loading commit data... | |
unwind-arm-vxworks.c | Loading commit data... | |
unwind-arm.c | Loading commit data... | |
unwind-arm.h | Loading commit data... |