summaryrefslogtreecommitdiff
path: root/include/sal/types.h
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-09 08:55:07 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-09 10:28:56 +0200
commita0e0b8372920e24672bb199e8e697fbc1cb8f5f2 (patch)
tree12f6daf456321c04e92f0dadd9c8da26f3b0a55e /include/sal/types.h
parent5f040a4b0d1f50e3d619a8f147b36c79c375783e (diff)
SAL_RETURNS_NONNULL: handle old clang not understanding returns_nonnull attr
Seen on the macOS baseline. Change-Id: Ibfd4a848b2f31bb782a83c523c72ccf7de4e0e6d Reviewed-on: https://gerrit.libreoffice.org/40902 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'include/sal/types.h')
-rw-r--r--include/sal/types.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/sal/types.h b/include/sal/types.h
index 52066bf40f7d..a138a90858df 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -707,7 +707,11 @@ inline char16_t const * SAL_U(wchar_t const * p)
@since LibreOffice 5.5
*/
-#if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && __GNUC__ > 4) || defined __clang__)
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#if defined LIBO_INTERNAL_ONLY && ((defined __GNUC__ && __GNUC__ > 4) || (defined __clang__ && __has_attribute(returns_nonnull)))
#define SAL_RETURNS_NONNULL __attribute__((returns_nonnull))
#else
#define SAL_RETURNS_NONNULL