From 9e5d55e2b0a80208f4febe49199b771445b9fa73 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 12 May 2017 22:46:47 +0200 Subject: path.c: Remove invalid FUNC_ATTR_NONNULL_RET References https://github.com/neovim/neovim/pull/6514#issuecomment-301235265 --- src/nvim/path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/path.c b/src/nvim/path.c index 12952f49db..045902e1c6 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -435,7 +435,7 @@ bool add_pathsep(char *p) /// @return [allocated] Copy of absolute path to `fname` or NULL when /// `fname` is NULL. char *FullName_save(const char *fname, bool force) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC + FUNC_ATTR_MALLOC { if (fname == NULL) { return NULL; @@ -453,7 +453,7 @@ char *FullName_save(const char *fname, bool force) /// @param name An absolute or relative path. /// @return The absolute path of `name`. char_u *save_absolute_path(const char_u *name) - FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL + FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { if (!path_is_absolute_path(name)) { return (char_u *)FullName_save((char *)name, true); -- cgit From 8d987809328569a3cca293af17ce33236a8c7055 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 12 May 2017 23:08:36 +0200 Subject: func_attr.h: clang 3.7+: REAL_FATTR_NONNULL_RET Closes #1627 --- src/nvim/func_attr.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h index cc94a41f80..3b9cb3e52e 100644 --- a/src/nvim/func_attr.h +++ b/src/nvim/func_attr.h @@ -113,16 +113,19 @@ # define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__))) # define REAL_FATTR_NORETURN __attribute__((noreturn)) -# ifdef __clang__ -// clang only +# if defined(__clang__) && __clang__ == 1 +// clang +# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)) +# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull)) +# endif # elif defined(__INTEL_COMPILER) -// intel only +// intel compiler # else # define GCC_VERSION \ (__GNUC__ * 10000 + \ __GNUC_MINOR__ * 100 + \ __GNUC_PATCHLEVEL__) -// gcc only +// gcc # define REAL_FATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) # define REAL_FATTR_ALLOC_SIZE_PROD(x, y) __attribute__((alloc_size(x, y))) # if GCC_VERSION >= 40900 -- cgit From c77c54f1bc8f2a251d6be35d09fe309d653e671f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 13 May 2017 01:22:53 +0200 Subject: func_attr.h: use NVIM_HAS_ATTRIBUTE --- src/nvim/func_attr.h | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h index 3b9cb3e52e..f1a1d9a563 100644 --- a/src/nvim/func_attr.h +++ b/src/nvim/func_attr.h @@ -41,6 +41,8 @@ // $ gcc -E -dM - 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)) -# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull)) -# endif -# elif defined(__INTEL_COMPILER) -// intel compiler -# else -# define GCC_VERSION \ - (__GNUC__ * 10000 + \ - __GNUC_MINOR__ * 100 + \ - __GNUC_PATCHLEVEL__) -// gcc +# if NVIM_HAS_ATTRIBUTE(returns_nonnull) +# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull)) +# endif + +# if NVIM_HAS_ATTRIBUTE(alloc_size) # define REAL_FATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) # define REAL_FATTR_ALLOC_SIZE_PROD(x, y) __attribute__((alloc_size(x, y))) -# if GCC_VERSION >= 40900 -# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull)) -# endif # endif # endif -// define function attributes that haven't been defined for this specific -// compiler. +// Define attributes that are not defined for this compiler. # ifndef REAL_FATTR_MALLOC # define REAL_FATTR_MALLOC -- cgit