PennMUSH Community

root/1.8.3/trunk/hdrs/compile.h

Revision 919, 1.6 kB (checked in by shawnw, 1 year ago)

1.8.3p3

Line 
1 #ifndef __COMPILE_H
2 #define __COMPILE_H
3
4 /* Compiler-specific stuff. */
5
6 #ifndef __GNUC_PREREQ
7 #if defined __GNUC__ && defined __GNUC_MINOR__
8 # define __GNUC_PREREQ(maj, min) \
9         ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
10 #else
11 # define __GNUC_PREREQ(maj, min) 0
12 #endif
13 #endif
14
15 /* For modern gcc , this attribute lets the compiler know that the
16  * function returns a newly allocated value, for pointer aliasing
17  * optimizations.
18  */
19 #if !defined(__attribute_malloc__) && defined(GCC_MALLOC_CALL)
20 #define __attribute_malloc__ GCC_MALLOC_CALL
21 #elif !defined(__attribute_malloc__)
22 #define __attribute_malloc__
23 #endif
24
25 /* If a compiler knows a function will never return, it can generate
26    slightly better code for calls to it. */
27 #if defined(WIN32) && _MSC_VER >= 1200
28 #define NORETURN __declspec(noreturn)
29 #elif defined(HAVE___ATTRIBUTE__)
30 #define NORETURN __attribute__ ((__noreturn__))
31 #else
32 #define NORETURN
33 #endif
34
35 /* Enable Win32 services support */
36 #ifdef WIN32
37 #define WIN32SERVICES
38 #endif
39
40 /* Disable Win32 services support due to it failing to run properly
41    when compiling with MinGW32. Eventually I would like to correct
42    the issue. - EEH */
43 #ifdef __MINGW32__
44 #undef WIN32SERVICES
45 #endif
46
47 /* --------------- Stuff for Win32 services ------------------ */
48 /*
49    When "exit" is called to handle an error condition, we really want to
50    terminate the game thread, not the whole process.
51    MS VS.NET (_MSC_VER >= 1200) requires the weird noreturn stuff.
52  */
53
54 #ifdef WIN32SERVICES
55 #define exit(arg) Win32_Exit (arg)
56 void NORETURN WIN32_CDECL Win32_Exit(int exit_code);
57 #endif
58
59 #endif                          /* __COMPILE_H */
Note: See TracBrowser for help on using the browser.