H. Peter Anvin | c1494ac | 2007-04-13 19:58:42 +0000 | [diff] [blame] | 1 | /* ----------------------------------------------------------------------- * |
| 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. |
| 16 | */ |
| 17 | |
| 18 | #ifndef COMPILER_H |
H. Peter Anvin | c40f89e | 2007-04-13 20:06:41 +0000 | [diff] [blame] | 19 | #define COMPILER_H 1 |
| 20 | |
| 21 | #ifdef HAVE_CONFIG_H |
| 22 | # include "config.h" |
| 23 | #endif |
H. Peter Anvin | c1494ac | 2007-04-13 19:58:42 +0000 | [diff] [blame] | 24 | |
| 25 | #ifdef __GNUC__ |
| 26 | # if __GNUC__ >= 4 |
| 27 | # define HAVE_GNUC_4 |
| 28 | # endif |
| 29 | # if __GNUC__ >= 3 |
| 30 | # define HAVE_GNUC_3 |
| 31 | # endif |
| 32 | #endif |
| 33 | |
| 34 | #ifdef __GNUC__ |
| 35 | # define _unused __attribute__((unused)) |
| 36 | #else |
| 37 | # define _unused |
| 38 | #endif |
| 39 | |
H. Peter Anvin | b8af9aa | 2007-09-17 13:53:14 -0700 | [diff] [blame] | 40 | /* Some versions of MSVC have these only with underscores in front */ |
H. Peter Anvin | 304b605 | 2007-09-28 10:50:20 -0700 | [diff] [blame] | 41 | #include <stdio.h> |
| 42 | #include <stddef.h> |
| 43 | #include <stdarg.h> |
H. Peter Anvin | b8af9aa | 2007-09-17 13:53:14 -0700 | [diff] [blame] | 44 | |
H. Peter Anvin | 304b605 | 2007-09-28 10:50:20 -0700 | [diff] [blame] | 45 | #ifndef HAVE_SNPRINTF |
| 46 | # ifdef HAVE__SNPRINTF |
| 47 | # define snprintf _snprintf |
| 48 | # else |
| 49 | int snprintf(char *, size_t, const char *, ...); |
| 50 | # endif |
H. Peter Anvin | b8af9aa | 2007-09-17 13:53:14 -0700 | [diff] [blame] | 51 | #endif |
| 52 | |
H. Peter Anvin | 304b605 | 2007-09-28 10:50:20 -0700 | [diff] [blame] | 53 | #ifndef HAVE_VSNPRINTF |
| 54 | # ifdef HAVE__VSNPRINT |
| 55 | # define vsnprintf _vsnprintf |
| 56 | # else |
| 57 | int vsnprintf(char *, size_t, const char *, va_list); |
| 58 | # endif |
H. Peter Anvin | b8af9aa | 2007-09-17 13:53:14 -0700 | [diff] [blame] | 59 | #endif |
| 60 | |
H. Peter Anvin | c40f89e | 2007-04-13 20:06:41 +0000 | [diff] [blame] | 61 | #endif /* COMPILER_H */ |