aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorJoel Hutton <Joel.Hutton@arm.com>2019-07-31 08:56:35 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2019-07-31 08:56:35 +0000
commitf0efd92502a0eb33c8f8f9e1ea03b25a714b2d72 (patch)
tree07a1f2d0cb396e93b11d345531d37071cc7a521b /gcc/config.gcc
parentce52e0ffb4f1ea7bd4fb99aea5dda75d260e438f (diff)
downloadgcc-f0efd92502a0eb33c8f8f9e1ea03b25a714b2d72.zip
gcc-f0efd92502a0eb33c8f8f9e1ea03b25a714b2d72.tar.gz
gcc-f0efd92502a0eb33c8f8f9e1ea03b25a714b2d72.tar.bz2
[Arm][CMSE]Add warn_unused_return attribute to cmse functions
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
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions