@@ -116,11 +116,13 @@ typedef void (*__cmse_fptr)(void);
}
__extension__ static __inline __attribute__ ((__always_inline__))
+__attribute__ ((__warn_unused_result__))
cmse_address_info_t
__cmse_TT_fptr (__cmse_fptr __p)
__CMSE_TT_ASM ()
__extension__ static __inline __attribute__ ((__always_inline__))
+__attribute__ ((__warn_unused_result__))
cmse_address_info_t
cmse_TT (void *__p)
__CMSE_TT_ASM ()
@@ -128,11 +130,13 @@ __CMSE_TT_ASM ()
#define cmse_TTT_fptr(p) (__cmse_TTT_fptr ((__cmse_fptr)(p)))
__extension__ static __inline __attribute__ ((__always_inline__))
+__attribute__ ((__warn_unused_result__))
cmse_address_info_t
__cmse_TTT_fptr (__cmse_fptr __p)
__CMSE_TT_ASM (t)
__extension__ static __inline __attribute__ ((__always_inline__))
+__attribute__ ((__warn_unused_result__))
cmse_address_info_t
cmse_TTT (void *__p)
__CMSE_TT_ASM (t)
@@ -142,11 +146,13 @@ __CMSE_TT_ASM (t)
#define cmse_TTA_fptr(p) (__cmse_TTA_fptr ((__cmse_fptr)(p)))
__extension__ static __inline __attribute__ ((__always_inline__))
+__attribute__ ((__warn_unused_result__))
cmse_address_info_t
__cmse_TTA_fptr (__cmse_fptr __p)
__CMSE_TT_ASM (a)
__extension__ static __inline __attribute__ ((__always_inline__))
+__attribute__ ((__warn_unused_result__))
cmse_address_info_t
cmse_TTA (void *__p)
__CMSE_TT_ASM (a)
@@ -154,17 +160,18 @@ __CMSE_TT_ASM (a)
#define cmse_TTAT_fptr(p) (__cmse_TTAT_fptr ((__cmse_fptr)(p)))
__extension__ static __inline cmse_address_info_t
-__attribute__ ((__always_inline__))
+__attribute__ ((__always_inline__, __warn_unused_result__))
__cmse_TTAT_fptr (__cmse_fptr __p)
__CMSE_TT_ASM (at)
__extension__ static __inline cmse_address_info_t
-__attribute__ ((__always_inline__))
+__attribute__ ((__always_inline__, __warn_unused_result__))
cmse_TTAT (void *__p)
__CMSE_TT_ASM (at)
/* FIXME: diagnose use outside cmse_nonsecure_entry functions. */
-__extension__ static __inline int __attribute__ ((__always_inline__))
+__extension__ static __inline int
+__attribute__ ((__always_inline__, __warn_unused_result__))
cmse_nonsecure_caller (void)
{
return __builtin_arm_cmse_nonsecure_caller ();
@@ -184,7 +191,7 @@ cmse_nonsecure_caller (void)
#define CMSE_MPU_READWRITE 1
#define CMSE_MPU_READ 8
-__extension__ void *
+__extension__ void * __attribute__ ((__warn_unused_result__))
cmse_check_address_range (void *, size_t, int);
#define cmse_check_pointed_object(p, f) \
@@ -43,3 +43,12 @@ typedef void __attribute__ ((cmse_nonsecure_call)) baz2 (long long a, int b, str
typedef struct span __attribute__ ((cmse_nonsecure_call)) qux2 (void); /* { dg-error "not available to functions that return value on the stack" } */
typedef void __attribute__ ((cmse_nonsecure_call)) norf2 (int a, ...); /* { dg-error "not available to functions with variable number of arguments" } */
+
+#include <arm_cmse.h>
+
+void foo3 (void * p, size_t s, int r)
+{
+ cmse_TT (p); /* { dg-warning "ignoring return value of" } */
+ cmse_check_address_range (p, s, r); /* { dg-warning "ignoring return value of" } */
+ cmse_nonsecure_caller (); /* { dg-warning "ignoring return value of" } */
+}