blob: 3b36e97a1e403046aefaa92f5f0398996dd3e62f [file] [log] [blame]
H. Peter Anvinc1494ac2007-04-13 19:58:42 +00001/* ----------------------------------------------------------------------- *
2 *
3 * Copyright 2007 The NASM Authors - All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the license given in the file "License"
7 * distributed in the NASM archive.
8 *
9 * ----------------------------------------------------------------------- */
10
11/*
12 * compiler.h
13 *
14 * Compiler-specific macros for NASM. Feel free to add support for
15 * other compilers in here.
H. Peter Anvinfe501952007-10-02 21:53:51 -070016 *
17 * This header file should be included before any other header.
H. Peter Anvinc1494ac2007-04-13 19:58:42 +000018 */
19
H. Peter Anvinfe501952007-10-02 21:53:51 -070020#ifndef NASM_COMPILER_H
21#define NASM_COMPILER_H 1
H. Peter Anvinc40f89e2007-04-13 20:06:41 +000022
23#ifdef HAVE_CONFIG_H
24# include "config.h"
25#endif
H. Peter Anvinc1494ac2007-04-13 19:58:42 +000026
27#ifdef __GNUC__
28# if __GNUC__ >= 4
29# define HAVE_GNUC_4
30# endif
31# if __GNUC__ >= 3
32# define HAVE_GNUC_3
33# endif
34#endif
35
36#ifdef __GNUC__
37# define _unused __attribute__((unused))
38#else
39# define _unused
40#endif
41
H. Peter Anvinb8af9aa2007-09-17 13:53:14 -070042/* Some versions of MSVC have these only with underscores in front */
H. Peter Anvin304b6052007-09-28 10:50:20 -070043#include <stddef.h>
44#include <stdarg.h>
H. Peter Anvinfe501952007-10-02 21:53:51 -070045#include <stdio.h>
H. Peter Anvinb8af9aa2007-09-17 13:53:14 -070046
H. Peter Anvin304b6052007-09-28 10:50:20 -070047#ifndef HAVE_SNPRINTF
48# ifdef HAVE__SNPRINTF
49# define snprintf _snprintf
50# else
51int snprintf(char *, size_t, const char *, ...);
52# endif
H. Peter Anvinb8af9aa2007-09-17 13:53:14 -070053#endif
54
H. Peter Anvin304b6052007-09-28 10:50:20 -070055#ifndef HAVE_VSNPRINTF
56# ifdef HAVE__VSNPRINT
57# define vsnprintf _vsnprintf
58# else
59int vsnprintf(char *, size_t, const char *, va_list);
60# endif
H. Peter Anvinb8af9aa2007-09-17 13:53:14 -070061#endif
62
H. Peter Anvin6867acc2007-10-10 14:58:45 -070063#ifndef __cplusplus /* C++ has false, true, bool as keywords */
64# ifdef HAVE_STDBOOL_H
65# include <stdbool.h>
66# else
67typedef enum { false, true } bool;
68# endif
69#endif
70
H. Peter Anvinfe501952007-10-02 21:53:51 -070071#endif /* NASM_COMPILER_H */