2022-09-16 14:03:14 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-09-26 20:09:41 +08:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
#include <sal.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-07-25 14:53:04 +08:00
|
|
|
#if defined(__has_attribute) && __has_attribute(__warn_unused_result__)
|
|
|
|
|
#define FF_C_NODISCARD __attribute__((__warn_unused_result__))
|
2023-09-26 20:09:41 +08:00
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
|
#define FF_C_NODISCARD _Check_return_
|
2022-09-16 14:03:14 +08:00
|
|
|
#else
|
|
|
|
|
#define FF_C_NODISCARD
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-07-25 14:53:04 +08:00
|
|
|
#if defined(__has_attribute) && __has_attribute(__format__)
|
2022-09-16 14:03:14 +08:00
|
|
|
#define FF_C_PRINTF(formatStrIndex, argsStartIndex) __attribute__((__format__ (printf, formatStrIndex, argsStartIndex)))
|
|
|
|
|
#else
|
|
|
|
|
#define FF_C_PRINTF(formatStrIndex, argsStartIndex)
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-07-25 14:53:04 +08:00
|
|
|
#if defined(__has_attribute) && __has_attribute(__format__)
|
2022-09-16 14:03:14 +08:00
|
|
|
#define FF_C_SCANF(formatStrIndex, argsStartIndex) __attribute__((__format__ (scanf, formatStrIndex, argsStartIndex)))
|
|
|
|
|
#else
|
|
|
|
|
#define FF_C_SCANF(formatStrIndex, argsStartIndex)
|
|
|
|
|
#endif
|
2025-07-25 14:53:04 +08:00
|
|
|
|
|
|
|
|
#if defined(__has_attribute) && __has_attribute(__nonnull__)
|
|
|
|
|
#define FF_C_NONNULL(argIndex, ...) __attribute__((__nonnull__(argIndex, ##__VA_ARGS__)))
|
|
|
|
|
#else
|
|
|
|
|
#define FF_C_NONNULL(argIndex, ...)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(__has_attribute) && __has_attribute(__returns_nonnull__)
|
|
|
|
|
#define FF_C_RETURNS_NONNULL __attribute__((__returns_nonnull__))
|
|
|
|
|
#else
|
|
|
|
|
#define FF_C_RETURNS_NONNULL
|
|
|
|
|
#endif
|