2007-04-14 03:58:42 +08:00
|
|
|
/* ----------------------------------------------------------------------- *
|
|
|
|
*
|
|
|
|
* Copyright 2007 The NASM Authors - All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-12-29 22:44:23 +08:00
|
|
|
* it under the terms of the license given in the file "LICENSE"
|
2007-04-14 03:58:42 +08:00
|
|
|
* distributed in the NASM archive.
|
|
|
|
*
|
|
|
|
* ----------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* compiler.h
|
|
|
|
*
|
|
|
|
* Compiler-specific macros for NASM. Feel free to add support for
|
|
|
|
* other compilers in here.
|
2007-10-03 12:53:51 +08:00
|
|
|
*
|
|
|
|
* This header file should be included before any other header.
|
2007-04-14 03:58:42 +08:00
|
|
|
*/
|
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
#ifndef NASM_COMPILER_H
|
|
|
|
#define NASM_COMPILER_H 1
|
2007-04-14 04:06:41 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2007-04-14 03:58:42 +08:00
|
|
|
|
2007-10-12 03:50:24 +08:00
|
|
|
/* This is required to get the standard <inttypes.h> macros when compiling
|
|
|
|
with a C++ compiler. This must be defined *before* <inttypes.h> is
|
|
|
|
included, directly or indirectly. */
|
|
|
|
#define __STDC_CONSTANT_MACROS 1
|
|
|
|
#define __STDC_LIMIT_MACROS 1
|
|
|
|
#define __STDC_FORMAT_MACROS 1
|
|
|
|
|
2007-04-14 03:58:42 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define HAVE_GNUC_4
|
|
|
|
# endif
|
|
|
|
# if __GNUC__ >= 3
|
|
|
|
# define HAVE_GNUC_3
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
# define _unused __attribute__((unused))
|
|
|
|
#else
|
|
|
|
# define _unused
|
|
|
|
#endif
|
|
|
|
|
2007-09-18 04:53:14 +08:00
|
|
|
/* Some versions of MSVC have these only with underscores in front */
|
2007-09-29 01:50:20 +08:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdarg.h>
|
2007-10-03 12:53:51 +08:00
|
|
|
#include <stdio.h>
|
2007-09-29 01:50:20 +08:00
|
|
|
|
|
|
|
#ifndef HAVE_SNPRINTF
|
|
|
|
# ifdef HAVE__SNPRINTF
|
|
|
|
# define snprintf _snprintf
|
|
|
|
# else
|
|
|
|
int snprintf(char *, size_t, const char *, ...);
|
|
|
|
# endif
|
2007-09-18 04:53:14 +08:00
|
|
|
#endif
|
|
|
|
|
2007-09-29 01:50:20 +08:00
|
|
|
#ifndef HAVE_VSNPRINTF
|
|
|
|
# ifdef HAVE__VSNPRINT
|
|
|
|
# define vsnprintf _vsnprintf
|
|
|
|
# else
|
|
|
|
int vsnprintf(char *, size_t, const char *, va_list);
|
|
|
|
# endif
|
2007-09-18 04:53:14 +08:00
|
|
|
#endif
|
|
|
|
|
2007-10-11 05:58:45 +08:00
|
|
|
#ifndef __cplusplus /* C++ has false, true, bool as keywords */
|
|
|
|
# ifdef HAVE_STDBOOL_H
|
|
|
|
# include <stdbool.h>
|
|
|
|
# else
|
|
|
|
typedef enum { false, true } bool;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2007-10-27 09:49:29 +08:00
|
|
|
/* Some misguided platforms hide the defs for these */
|
|
|
|
#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
|
|
|
|
|
2007-11-14 01:37:59 +08:00
|
|
|
/*
|
|
|
|
* Define this to 1 for faster performance if this is a littleendian
|
|
|
|
* platform which can do unaligned memory references. It is safe
|
|
|
|
* to leave it defined to 0 even if that is true.
|
|
|
|
*/
|
2008-02-17 07:28:02 +08:00
|
|
|
#if defined(__386__) || defined(__i386__) || defined(__x86_64__)
|
2007-11-14 01:37:59 +08:00
|
|
|
# define X86_MEMORY 1
|
|
|
|
#else
|
|
|
|
# define X86_MEMORY 0
|
|
|
|
#endif
|
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
#endif /* NASM_COMPILER_H */
|