mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03: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:
@@ -170,6 +170,7 @@
|
||||
/* Define to 1 if mbrtowc attempts to convert invalid UTF-8 sequences */
|
||||
#cmakedefine HAVE_BROKEN_MBRTOWC_UTF8 1
|
||||
|
||||
/* Support __warn_unused on function return values. */
|
||||
#if __GNUC__ >= 3
|
||||
#ifndef __warn_unused
|
||||
#define __warn_unused __attribute__ ((warn_unused_result))
|
||||
@@ -177,3 +178,14 @@
|
||||
#else
|
||||
#define __warn_unused
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user