mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-13 13:54:05 +08:00
system: Add WARN_UNUSED_RESULT
I'd like to have the option of marking functions with __attribute__ ((__warn_unused_result__)), so this patch adds a macro. And use it for maybe_wrap_with_location, it's always a bug if the return value is not used, which happened to me and got me confused. gcc/ChangeLog: * system.h (WARN_UNUSED_RESULT): Define for GCC >= 3.4. * tree.h (maybe_wrap_with_location): Add WARN_UNUSED_RESULT.
This commit is contained in:
parent
f8f575d759
commit
876b45db81
@ -789,6 +789,12 @@ extern void fancy_abort (const char *, int, const char *)
|
||||
#define ALWAYS_INLINE inline
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= 3004
|
||||
#define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
|
||||
#else
|
||||
#define WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
/* Use gcc_unreachable() to mark unreachable locations (like an
|
||||
unreachable default case of a switch. Do not use gcc_assert(0). */
|
||||
#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
|
||||
|
@ -1214,7 +1214,7 @@ get_expr_source_range (tree expr)
|
||||
extern void protected_set_expr_location (tree, location_t);
|
||||
extern void protected_set_expr_location_if_unset (tree, location_t);
|
||||
|
||||
extern tree maybe_wrap_with_location (tree, location_t);
|
||||
WARN_UNUSED_RESULT extern tree maybe_wrap_with_location (tree, location_t);
|
||||
|
||||
extern int suppress_location_wrappers;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user