diff options
-rw-r--r-- | include/slibc/features.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/slibc/features.h b/include/slibc/features.h index b6fc406..864754d 100644 --- a/include/slibc/features.h +++ b/include/slibc/features.h @@ -69,6 +69,16 @@ /** + * Macro used to exclude code unless `_SLIBC_SOURCE` is set. + */ +#if defined(_SLIBC_SOURCE) +# define __SLIBC_ONLY(...) __VA_ARGS__ +#else +# define __SLIBC_ONLY(...) /* ignore */ +#endif + + +/** * Mark a function, variable or type as deprecated, * with a message that tells the user why the the * function is deprecated, or functions to use instead. @@ -81,12 +91,14 @@ /** - * Macro used to exclude code unless `_SLIBC_SOURCE` is set. + * Warn if a function, variable or type is used. */ -#if defined(_SLIBC_SOURCE) -# define __SLIBC_ONLY(...) __VA_ARGS__ +#if !defined(_SLIBC_SUPPRESS_WARNINGS) +# define __warning(msg) __GCC_ONLY(__attribute__((warning(msg)))) +# define __slibc_warning(msg) __SLIBC_ONLY(__warning(msg)) #else -# define __SLIBC_ONLY(...) /* ignore */ +# define __warning(msg) /* ignore */ +# define __slibc_warning(msg) /* ignore */ #endif |