diff options
author | James McCoy <jamessan@jamessan.com> | 2017-05-20 12:37:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-20 12:37:18 -0400 |
commit | 6a7514feaada0f46a1d16a37760847610e825dad (patch) | |
tree | 20ac84940f7bba7bb15bd7ddc6f4a66ac0439439 /src/nvim/func_attr.h | |
parent | bde46fdeceec8f9dd675f0e31080d732308573d9 (diff) | |
parent | c77c54f1bc8f2a251d6be35d09fe309d653e671f (diff) | |
download | rneovim-6a7514feaada0f46a1d16a37760847610e825dad.tar.gz rneovim-6a7514feaada0f46a1d16a37760847610e825dad.tar.bz2 rneovim-6a7514feaada0f46a1d16a37760847610e825dad.zip |
Merge pull request #6735 from justinmk/funcattr
clang 3.6+ REAL_FATTR_NONNULL_RET
Diffstat (limited to 'src/nvim/func_attr.h')
-rw-r--r-- | src/nvim/func_attr.h | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h index cc94a41f80..f1a1d9a563 100644 --- a/src/nvim/func_attr.h +++ b/src/nvim/func_attr.h @@ -41,6 +41,8 @@ // $ gcc -E -dM - </dev/null // $ echo | clang -dM -E - +#include "nvim/macros.h" + #ifdef FUNC_ATTR_MALLOC # undef FUNC_ATTR_MALLOC #endif @@ -96,8 +98,7 @@ #ifndef DID_REAL_ATTR # define DID_REAL_ATTR # ifdef __GNUC__ -// place defines for all gnulikes here, for now that's gcc, clang and -// intel. +// For all gnulikes: gcc, clang, intel. // place these after the argument list of the function declaration // (not definition), like so: @@ -113,26 +114,17 @@ # define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__))) # define REAL_FATTR_NORETURN __attribute__((noreturn)) -# ifdef __clang__ -// clang only -# elif defined(__INTEL_COMPILER) -// intel only -# else -# define GCC_VERSION \ - (__GNUC__ * 10000 + \ - __GNUC_MINOR__ * 100 + \ - __GNUC_PATCHLEVEL__) -// gcc only +# 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 |