#pragma once #if !defined(__APPLE__)#define _XOPEN_SOURCE 700#endif #if defined(__APPLE__)#include <machine/endian.h>#else#include <endian.h>#endif#include <assert.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <float.h>#include <inttypes.h>#include <limits.h>#include <locale.h>#include <math.h>#include <setjmp.h>#include <stdbool.h>#include <stdarg.h>#include <stdio.h>#include <stddef.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <sys/mman.h>#include <sys/stat.h>#include <sys/time.h>#include <sys/types.h>#include <time.h>#include <unistd.h>#include <wctype.h>#include <wchar.h> #if defined(__linux__)#define __os_name__ "linux"#elif defined(__OpenBSD__)#define __os_name__ "openbsd"#elif defined(__FreeBSD__)#define __os_name__ "freebsd"#elif defined(__NetBSD__)#define __os_name__ "netbsd"#elif defined(__DragonFly__)#define __os_name__ "dragonflybsd"#elif defined(__APPLE__)#define __os_name__ "macosx"#elif defined(__HAIKU__)#define __os_name__ "haiku"#else#define __os_name__ "unknown"#endif extern char *os_version;#define __os_version__ os_version #if !defined(__SIZEOF_POINTER__)#error pointer size unknown#elif __SIZEOF_POINTER__ == 8#define BITS64#if defined(__aarch64__)#define FWD_BIT (1ULL<<55)#endif#endif typedef sigjmp_buf sl_jmp_buf;#define sl_setjmp(e) sigsetjmp((e), 0)#define sl_longjmp(e, v) siglongjmp((e), (v))#define exits(status) do{ \ const char *s = (status); \ exit(s == nil ? 0 : 1); \}while(0)#define sysfatal(...) do{ \ fprintf(stderr, __VA_ARGS__); \ exit(1); \}while(0) #define getcallerpc(a) (uintptr)__builtin_extract_return_addr(__builtin_return_address(0))#define sys_setcallpc(arg) do{sl.cpc = getcallerpc(&arg);}while(0)void sys_setcurrpc(int dummy); #define nil NULL#define USED(x) ((void)(x))#define nelem(x) (int)(sizeof(x)/sizeof((x)[0])) #define PATHSEP '/'#define PATHSEPSTRING "/"#define PATHLISTSEP ':'#define PATHLISTSEPSTRING ":"#define ISPATHSEP(c) ((c) == '/') // FIXME: __clang__ because no idea how to check if ubsan is enabled.#if !defined(__clang__) && (defined(__386__) || defined(__x86_64__) || defined(__aarch64__))#define MEM_UNALIGNED_ACCESS#endif #include "cc_gnuc.h"#include "mem.h"#include "mp.h"#include "utf.h"
#pragma once
#if !defined(__APPLE__)
#define _XOPEN_SOURCE 700
#endif
#if defined(__APPLE__)
#include <machine/endian.h>
#else
#include <endian.h>
#endif
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <wctype.h>
#include <wchar.h>
#if defined(__linux__)
#define __os_name__ "linux"
#elif defined(__OpenBSD__)
#define __os_name__ "openbsd"
#elif defined(__FreeBSD__)
#define __os_name__ "freebsd"
#elif defined(__NetBSD__)
#define __os_name__ "netbsd"
#elif defined(__DragonFly__)
#define __os_name__ "dragonflybsd"
#elif defined(__APPLE__)
#define __os_name__ "macosx"
#elif defined(__HAIKU__)
#define __os_name__ "haiku"
#else
#define __os_name__ "unknown"
#endif
extern char *os_version;
#define __os_version__ os_version
#if !defined(__SIZEOF_POINTER__)
#error pointer size unknown
#elif __SIZEOF_POINTER__ == 8
#define BITS64
#if defined(__aarch64__)
#define FWD_BIT (1ULL<<55)
#endif
#endif
typedef sigjmp_buf sl_jmp_buf;
#define sl_setjmp(e) sigsetjmp((e), 0)
#define sl_longjmp(e, v) siglongjmp((e), (v))
#define exits(status) do{ \
const char *s = (status); \
exit(s == nil ? 0 : 1); \
}while(0)
#define sysfatal(...) do{ \
fprintf(stderr, __VA_ARGS__); \
exit(1); \
}while(0)
#define getcallerpc(a) (uintptr)__builtin_extract_return_addr(__builtin_return_address(0))
#define sys_setcallpc(arg) do{sl.cpc = getcallerpc(&arg);}while(0)
void sys_setcurrpc(int dummy);
#define nil NULL
#define USED(x) ((void)(x))
#define nelem(x) (int)(sizeof(x)/sizeof((x)[0]))
#define PATHSEP '/'
#define PATHSEPSTRING "/"
#define PATHLISTSEP ':'
#define PATHLISTSEPSTRING ":"
#define ISPATHSEP(c) ((c) == '/')
// FIXME: __clang__ because no idea how to check if ubsan is enabled.
#if !defined(__clang__) && (defined(__386__) || defined(__x86_64__) || defined(__aarch64__))
#define MEM_UNALIGNED_ACCESS
#endif
#include "cc_gnuc.h"
#include "mem.h"
#include "mp.h"
#include "utf.h"