diff options
author | aunsane <aunsane@gmail.com> | 2018-03-03 16:35:09 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-03-03 16:35:33 +0300 |
commit | fa58f69fe117640e29cefb1b699bede4d045bc2f (patch) | |
tree | a1bf8406d63e2b246bebdc572ceccfaabcffa359 /protocols/Tox/libtox/src/toxcore/ccompat.h | |
parent | 0e8f5a3aa5f5e73b413c5646444751783e367f2b (diff) |
Tox:
- updated toxcore due to release v0.2
- removed message correction
- reworked nodes update
Diffstat (limited to 'protocols/Tox/libtox/src/toxcore/ccompat.h')
-rw-r--r-- | protocols/Tox/libtox/src/toxcore/ccompat.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/protocols/Tox/libtox/src/toxcore/ccompat.h b/protocols/Tox/libtox/src/toxcore/ccompat.h index e72e66ae58..1ceb5a5a87 100644 --- a/protocols/Tox/libtox/src/toxcore/ccompat.h +++ b/protocols/Tox/libtox/src/toxcore/ccompat.h @@ -4,13 +4,6 @@ #ifndef CCOMPAT_H #define CCOMPAT_H -// Marking GNU extensions to avoid warnings. -#if defined(__GNUC__) -#define GNU_EXTENSION __extension__ -#else -#define GNU_EXTENSION -#endif - // Variable length arrays. // VLA(type, name, size) allocates a variable length array with automatic // storage duration. VLA_SIZE(name) evaluates to the runtime size of that array @@ -20,7 +13,7 @@ // "function") is used. Note the semantic difference: alloca'd memory does not // get freed at the end of the declaration's scope. Do not use VLA() in loops or // you may run out of stack space. -#if !defined(_MSC_VER) && __STDC_VERSION__ >= 199901L +#if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L // C99 VLAs. #define VLA(type, name, size) type name[size] #define SIZEOF_VLA sizeof @@ -29,6 +22,11 @@ // Emulation using alloca. #ifdef _WIN32 #include <malloc.h> +#elif defined(__FreeBSD__) +#include <stdlib.h> +#if !defined(alloca) && defined(__GNUC__) +#define alloca __builtin_alloca +#endif #else #include <alloca.h> #endif @@ -40,4 +38,14 @@ #endif +#ifndef __cplusplus +#define nullptr NULL +#endif + +#ifdef __GNUC__ +#define GNU_PRINTF __attribute__((__format__(__printf__, 6, 7))) +#else +#define GNU_PRINTF +#endif + #endif /* CCOMPAT_H */ |