Fix SAFE_BUFFERS attribute for GCC

This commit is contained in:
Nekotekina 2021-02-09 12:33:50 +03:00
parent 3e496f6625
commit 4f8cac731b
7 changed files with 33 additions and 29 deletions

View file

@ -24,11 +24,15 @@ using namespace std::literals;
#endif
#ifdef _MSC_VER
#define SAFE_BUFFERS __declspec(safebuffers)
#define SAFE_BUFFERS(...) __declspec(safebuffers) __VA_ARGS__
#define NEVER_INLINE __declspec(noinline)
#define FORCE_INLINE __forceinline
#else // not _MSC_VER
#define SAFE_BUFFERS __attribute__((no_stack_protector))
#ifdef __clang__
#define SAFE_BUFFERS(...) __attribute__((no_stack_protector)) __VA_ARGS__
#else
#define SAFE_BUFFERS(...) __VA_ARGS__ __attribute__((__optimize__("no-stack-protector")))
#endif
#define NEVER_INLINE __attribute__((noinline)) inline
#define FORCE_INLINE __attribute__((always_inline)) inline
#endif // _MSC_VER