mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 14:37:13 +08:00
Introduce __warn_unused_type
This is like __warn_unused, but it says that any time this type is returned from a function it must be used. This will help enforce error handling.
This commit is contained in:
parent
e5cff1a2db
commit
364c6001dc
|
@ -170,6 +170,7 @@
|
||||||
/* Define to 1 if mbrtowc attempts to convert invalid UTF-8 sequences */
|
/* Define to 1 if mbrtowc attempts to convert invalid UTF-8 sequences */
|
||||||
#cmakedefine HAVE_BROKEN_MBRTOWC_UTF8 1
|
#cmakedefine HAVE_BROKEN_MBRTOWC_UTF8 1
|
||||||
|
|
||||||
|
/* Support __warn_unused on function return values. */
|
||||||
#if __GNUC__ >= 3
|
#if __GNUC__ >= 3
|
||||||
#ifndef __warn_unused
|
#ifndef __warn_unused
|
||||||
#define __warn_unused __attribute__ ((warn_unused_result))
|
#define __warn_unused __attribute__ ((warn_unused_result))
|
||||||
|
@ -177,3 +178,14 @@
|
||||||
#else
|
#else
|
||||||
#define __warn_unused
|
#define __warn_unused
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Like __warn_unused, but applies to a type.
|
||||||
|
At the moment only clang supports this as a type attribute.
|
||||||
|
*/
|
||||||
|
#if defined(__clang__) && __has_attribute(warn_unused_result)
|
||||||
|
#ifndef __warn_unused_type
|
||||||
|
#define __warn_unused_type __attribute__ ((warn_unused_result))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define __warn_unused_type
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user