diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-25 11:47:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-26 10:35:30 +0200 |
commit | 24b2c636a230c04ab4b9c6ed7d041f6420f959f1 (patch) | |
tree | 400edf162c26e51817c2ade75bbd259ae320d99f /include/sal | |
parent | 59793d67d4c0324730e30d71d94ba5173643d79c (diff) |
create SAL_RETURNS_NONNULL annotation
and apply it to some methods in OString and OUString
Change-Id: I30e91f961b6d310799d3641f68b7ed54b3080f3a
Reviewed-on: https://gerrit.libreoffice.org/38020
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/sal')
-rw-r--r-- | include/sal/types.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/sal/types.h b/include/sal/types.h index 30939f130281..b6d6730e88a5 100644 --- a/include/sal/types.h +++ b/include/sal/types.h @@ -687,6 +687,22 @@ inline char16_t const * SAL_U(wchar_t const * p) /// @endcond #endif + +/** Indicate where function/methods that return a pointer always + return a non-nullptr value. + + Note that MSVC supports this feature via it's SAL _Ret_notnull_ + annotation, but since it's in a completely different place on + the function declaration, it's a little hard to support both. + + @since LibreOffice 5.5 +*/ +#if (defined __GNUC__ && __GNUC__ > 4) || defined __clang__ +#define SAL_RETURNS_NONNULL __attribute__((returns_nonnull)) +#else +#define SAL_RETURNS_NONNULL +#endif + #endif // INCLUDED_SAL_TYPES_H /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |