diff options
author | Daniel Lange <DLange@git.local> | 2024-01-10 11:17:08 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2024-01-10 11:17:08 +0100 |
commit | e7372d18a1a661d8c3dba9f51e1f17b5f94171a7 (patch) | |
tree | e8270dd60ec096bee8157dbadf029e15ed584592 /Compat.h | |
parent | 937052b231259a47d881d539ad5748245ef55b99 (diff) | |
download | debian_htop-e7372d18a1a661d8c3dba9f51e1f17b5f94171a7.tar.gz debian_htop-e7372d18a1a661d8c3dba9f51e1f17b5f94171a7.tar.bz2 debian_htop-e7372d18a1a661d8c3dba9f51e1f17b5f94171a7.zip |
New upstream version 3.3.0
Diffstat (limited to 'Compat.h')
-rw-r--r-- | Compat.h | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -7,10 +7,9 @@ Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ -#include "config.h" // IWYU pragma: keep - +#include <assert.h> // IWYU pragma: keep #include <fcntl.h> -#include <stddef.h> +#include <stddef.h> // IWYU pragma: keep #include <unistd.h> #include <sys/stat.h> // IWYU pragma: keep @@ -56,4 +55,31 @@ ssize_t Compat_readlinkat(int dirfd, char* buf, size_t bufsize); +ssize_t Compat_readlink(openat_arg_t dirfd, + const char* pathname, + char* buf, + size_t bufsize); + +/* + * static_assert() hack for pre-C11 + * TODO: drop after moving to -std=c11 or newer + */ + +/* C11 guarantees _Static_assert is a keyword */ +#if (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112L +# if !defined(_Static_assert) +# define _Static_assert(expr, msg) \ + extern int (*__Static_assert_function (void)) \ + [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] +# endif +#endif + +/* C23 will guarantee static_assert is a keyword or a macro */ +/* FIXME: replace 202300L with proper value once C23 is published */ +#if (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202300L +# if !defined(static_assert) +# define static_assert(expr, msg) _Static_assert(expr, msg) +# endif +#endif + #endif /* HEADER_Compat */ |