From de025c86d180a28f7ffb0db60bc7aa1996affedc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 30 Aug 2015 15:19:38 +0200 Subject: add __warning and __slibc_warning macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/slibc/features.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'include') 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 @@ -68,6 +68,16 @@ #endif +/** + * 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 @@ -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 -- cgit v1.2.3-70-g09d2