summaryrefslogtreecommitdiff
path: root/src/compiler.h
blob: a155d4cec03630bd1b5568b1af838b074276029e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**

Copyright (c) Scott Gasch

Module Name:

    system.h

Abstract:

Author:

    Scott Gasch ([email protected]) 8 Apr 2004

Revision History:

    $Id: compiler.h 349 2008-06-28 02:48:59Z scott $

**/

#ifndef COMPILER_H_
#define COMPILER_H_

#if defined _MSC_VER

#include <io.h>

#pragma warning(disable:4201) // nonstandard extension: nameless struct/union
#pragma warning(disable:4214) // nonstandard extension: bitfields struct

#define PROFILE                    ""
#define ALIGN64                    __declspec(align(64))
#define TB_FASTCALL                __fastcall
#define COMPILER_STRING            "Microsoft(R) Visual C/C++ %u\n", _MSC_VER
#define open                       _open
#define write                      _write
#define COMPILER_LONGLONG          __int64
#define COMPILER_VSNPRINTF         _vsnprintf
#define CDECL                      __cdecl
#define FASTCALL                   __fastcall
#define INLINE                     __inline
#define FORCEINLINE                __forceinline
#define NORETURN
#define CONSTFUNCT
#define COMPILER_LONGLONG_HEX_FORMAT "I64x"
#define COMPILER_LONGLONG_UNSIGNED_FORMAT "I64u"
#define STRNCMPI                   _strnicmp
#define STRCMPI                    strcmpi
#define STRDUP                     SystemStrDup

#elif defined __GNUC__

#include <unistd.h>

extern int errno;

#define COMPILER_STRING            "GCC "__VERSION__"\n"
#define BUILD_STRING               __OPTIMIZE__

#define O_BINARY                   (0)
#define O_RANDOM                   (0)
#define _S_IREAD                   (0)
#define _S_IWRITE                  (0)

#define ALIGN64 // __attribute__ (aligned(64)) does not work
#define COMPILER_LONGLONG          long long
#define COMPILER_VSNPRINTF         vsnprintf
#ifndef SIXTYFOUR
#define CDECL                      __attribute__((cdecl))
#endif
#define FASTCALL                   __attribute__((__regparm__(3)))
#define INLINE                     __inline__
#define FORCEINLINE                __attribute__((always_inline))
#define NORETURN                   __attribute__((noreturn))
#define CONSTFUNCT                 __attribute__((const))
#define COMPILER_LONGLONG_HEX_FORMAT "llx"
#define COMPILER_LONGLONG_UNSIGNED_FORMAT "llu"
#define STRNCMPI                   strncasecmp
#define STRCMPI                    strcasecmp
#define STRDUP                     SystemStrDup
#define TB_FASTCALL // __attribute__((__regparm__(3)))

#else

#error "Unknown compiler, please edit compiler.h"

#endif /* What compiler?! */

#endif /* COMPILER_H_ */