diff options
| author | Mattias Andrée <m@maandree.se> | 2025-12-04 19:25:47 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2025-12-04 19:25:47 +0100 |
| commit | 2bf851de6dd3a64f91a72a9afba2b3637dbbe154 (patch) | |
| tree | 5326b90653cb19bbe3749522c95d33ac736167bf /common.h | |
| download | libj2-2bf851de6dd3a64f91a72a9afba2b3637dbbe154.tar.gz libj2-2bf851de6dd3a64f91a72a9afba2b3637dbbe154.tar.bz2 libj2-2bf851de6dd3a64f91a72a9afba2b3637dbbe154.tar.xz | |
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | common.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/common.h b/common.h new file mode 100644 index 0000000..876d2ef --- /dev/null +++ b/common.h @@ -0,0 +1,29 @@ +/* See LICENSE file for copyright and license details. */ +#include "libj2.h" + +#if defined(__GNUC__) +# define CONST __attribute__((__const__)) +# define PURE __attribute__((__pure__)) +#else +# define CONST +# define PURE +#endif + +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* broken warning, spams false positives */ +# pragma clang diagnostic ignored "-Wimplicit-void-ptr-cast" /* C++-incompatiblity warning, bad idea, specially in non-header files */ +#endif + +#ifdef TEST +# include <stdlib.h> +# include <stdio.h> +# include <string.h> +# include <time.h> +# define EXPECT(EXPR)\ + do {\ + if (EXPR)\ + break;\ + fprintf(stderr, "Assertion failed at %s:%i: %s\n", __FILE__, __LINE__, #EXPR);\ + exit(1);\ + } while (0) +#endif |
