#ifndef NASM_COMPILER_H
#define NASM_COMPILER_H …
#ifdef __GNUC__
# undef __STRICT_ANSI__
#endif
#define _MBCS …
#ifdef HAVE_CONFIG_H
# include "config/config.h"
#else
# if defined(_MSC_VER) && (_MSC_VER >= 1310)
# include "config/msvc.h"
# elif defined(__WATCOMC__)
# include "config/watcom.h"
# else
# include "config/unknown.h"
# endif
# include "config/unconfig.h"
#endif
#define __STDC_CONSTANT_MACROS …
#define __STDC_LIMIT_MACROS …
#define __STDC_FORMAT_MACROS …
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
# include "nasmint.h"
#endif
#include <assert.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
# include <sys/endian.h>
#elif defined(HAVE_MACHINE_ENDIAN_H)
# include <machine/endian.h>
#endif
#if defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
# undef WORDS_LITTLEENDIAN
# undef WORDS_BIGENDIAN
#define WORDS_BIGENDIAN …
#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
# undef WORDS_LITTLEENDIAN
# undef WORDS_BIGENDIAN
#define WORDS_LITTLEENDIAN …
#elif defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
# undef WORDS_LITTLEENDIAN
# undef WORDS_BIGENDIAN
# if BYTE_ORDER == LITTLE_ENDIAN
#define WORDS_LITTLEENDIAN …
# elif BYTE_ORDER == BIG_ENDIAN
#define WORDS_BIGENDIAN …
# endif
#endif
#if defined(__386__) || defined(__i386__) || defined(__x86_64__) \
|| defined(_M_IX86) || defined(_M_X64)
#define X86_MEMORY …
# undef WORDS_BIGENDIAN
# undef WORDS_LITTLEENDIAN
#define WORDS_LITTLEENDIAN …
#else
#define X86_MEMORY …
#endif
#ifndef HAVE_SNPRINTF
# ifdef HAVE__SNPRINTF
#define snprintf …
# else
int snprintf(char *, size_t, const char *, ...);
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef HAVE__VSNPRINTF
#define vsnprintf …
# else
int vsnprintf(char *, size_t, const char *, va_list);
# endif
#endif
#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
#if !defined(HAVE_STRCHRNUL) || !HAVE_DECL_STRCHRNUL
char *strrchrnul(const char *, int);
#endif
#ifndef __cplusplus
# ifdef HAVE_STDBOOL_H
# include <stdbool.h>
# elif defined(HAVE__BOOL)
bool;
#define false …
#define true …
# else
typedef enum bool { false, true } bool;
# endif
#endif
#define nullas(p) …
#define null_offset(p) …
#ifndef offsetof
#define offsetof …
#endif
#ifdef typeof
#define HAVE_TYPEOF …
#endif
#ifndef offsetin
# ifdef HAVE_TYPEOF
#define offsetin(p,m) …
# else
#define offsetin …
# endif
#endif
#ifndef container_of
#define container_of(p, c, m) …
#endif
#if defined(HAVE_STRCASECMP) && !HAVE_DECL_STRCASECMP
int strcasecmp(const char *, const char *);
#endif
#if defined(HAVE_STRICMP) && !HAVE_DECL_STRICMP
int stricmp(const char *, const char *);
#endif
#if defined(HAVE_STRNCASECMP) && !HAVE_DECL_STRNCASECMP
int strncasecmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRNICMP) && !HAVE_DECL_STRNICMP
int strnicmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRSEP) && !HAVE_DECL_STRSEP
char *strsep(char **, const char *);
#endif
#if !HAVE_DECL_STRNLEN
size_t strnlen(const char *s, size_t maxlen);
#endif
#ifndef HAVE_MEMPCPY
static inline void *mempcpy(void *dst, const void *src, size_t n)
{
return (char *)memcpy(dst, src, n) + n;
}
#endif
#ifndef HAVE_STDC_INLINE
# ifdef __GNUC__
# ifdef __GNUC_STDC_INLINE__
#define HAVE_STDC_INLINE
# else
#define HAVE_GNU_INLINE
# endif
# elif defined(__GNUC_GNU_INLINE__)
#define HAVE_GNU_INLINE
# elif defined(_MSC_VER)
#define HAVE_MSVC_INLINE
# elif defined(__STDC_VERSION__)
# if __STDC_VERSION__ >= 199901L
#define HAVE_STDC_INLINE
# endif
# endif
#endif
#ifdef HAVE_STDC_INLINE
#define extern_inline …
#elif defined(HAVE_GNU_INLINE)
#define extern_inline …
#define inline_prototypes
#elif defined(HAVE_MSVC_INLINE)
#define extern_inline …
#else
#define inline_prototypes
#endif
#if HAVE___BUILTIN_EXPECT
#define likely(x) …
#define unlikely(x) …
#else
#define likely …
#define unlikely …
#endif
#define safe_alloc …
#define safe_alloc_ptr …
#define safe_malloc(s) …
#define safe_malloc2(s1,s2) …
#define safe_realloc(s) …
#define safe_malloc_ptr(s) …
#define safe_malloc2_ptr(s1,s2) …
#define safe_realloc_ptr(s) …
#ifdef HAVE_STDNORETURN_H
# include <stdnoreturn.h>
#define no_return …
#elif defined(_MSC_VER)
#define no_return …
#else
#define no_return …
#endif
#define fatal_func …
#define fatal_func_ptr …
#define printf_func(fmt, list) …
#define printf_func_ptr(fmt, list) …
#ifdef HAVE___BUILTIN_CONSTANT_P
# if defined(__GNUC__) && (__GNUC__ >= 5)
#define is_constant …
# else
#define is_constant(x) …
# endif
#else
#define is_constant …
#endif
#if defined(__GNUC__) && (__GNUC__ >= 3)
#define not_pedantic_start …
#define not_pedantic_end …
#else
#define not_pedantic_start
#define not_pedantic_end
#endif
#ifdef HAVE___BUILTIN_CHOOSE_EXPR
#define if_constant(x,y) …
#else
#define if_constant …
#endif
#ifndef va_copy
# ifdef __va_copy
#define va_copy …
# else
#define va_copy …
# endif
#endif
#ifndef SIZE_MAX
#define SIZE_MAX …
#endif
#ifdef __WATCOMC__
#define BOGUS_CASE …
static inline unsigned int watcom_switch_hack(uint64_t x)
{
if (x > (uint64_t)UINT_MAX)
return BOGUS_CASE;
else
return (unsigned int)x;
}
# define switch(x) switch(sizeof(x) > sizeof(unsigned int) \
? watcom_switch_hack(x) : (unsigned int)(x))
# define default case BOGUS_CASE: default
#endif
#endif