aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-30 15:19:38 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-30 15:19:38 +0200
commitde025c86d180a28f7ffb0db60bc7aa1996affedc (patch)
tree64edd62c58de1b2421d16a32837f047869266469
parentadd __SLIBC_ONLY macro (diff)
downloadslibc-de025c86d180a28f7ffb0db60bc7aa1996affedc.tar.gz
slibc-de025c86d180a28f7ffb0db60bc7aa1996affedc.tar.bz2
slibc-de025c86d180a28f7ffb0db60bc7aa1996affedc.tar.xz
add __warning and __slibc_warning macros
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--include/slibc/features.h20
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