Skip to content

Commit

Permalink
config.h: added RET_NONNULL for returns_nonnull function attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Sep 1, 2024
1 parent 56ff2cc commit 0672a75
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@
# define DEPRECATED
#endif

// TODO: GCC apparently also supports this but there is no documentation on it
// returns_nonnull
#if __has_cpp_attribute (gnu::returns_nonnull)
# define RET_NONNULL [[gnu::returns_nonnull]]
#elif (defined(__clang__) && ((__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ >= 7))))
# define RET_NONNULL __attribute__((returns_nonnull))
#else
# define RET_NONNULL
#endif

#define REQUIRES(msg, ...) class=typename std::enable_if<__VA_ARGS__::value>::type

#include <string>
Expand Down

0 comments on commit 0672a75

Please sign in to comment.