source: trunk/lib/config.hpp @ 1873

Last change on this file since 1873 was 1873, checked in by cameron, 7 years ago

Eliminate min/max macro pollution from WinDefs?.h

File size: 2.1 KB
Line 
1/*
2    config - Compiler dependent configuration.
3
4    Copyright (C) 2011, Robert D. Cameron, Kenneth S. Herdy, Hua Huang and Nigel Medforth.
5    Licensed to the public under the Open Software License 3.0.
6    Licensed to International Characters Inc.
7       under the Academic Free License version 3.0.
8 */
9
10#ifndef CONFIG_HPP_
11#define CONFIG_HPP_
12
13#if !(defined (_MSC_VER) || (defined __GNUC__))
14        #error "Compiler not supported. Aborting compilation."
15#endif
16
17/*
18 * Eliminate definitions of max and min macros from WinDef.h or
19 * any other source.   
20*/
21#undef min
22#undef max
23
24/*
25 * IDISA_INLINE is a macro which expands to tell the compiler that the method
26 * decorated with it should be inlined.  This macro is usable from C and C++
27 * code, even though C89 does not support the |inline| keyword.  The compiler
28 * may ignore this directive if it chooses.
29 */
30#ifndef IDISA_INLINE
31        #if defined __cplusplus
32                #define IDISA_INLINE          inline
33        #elif defined _MSC_VER
34                #define IDISA_INLINE          __inline
35        //      #elif defined __INTEL_COMPILER
36        //              #define IDISA_INLINE              __inline // ICC defaults to GCC. See, Intel® C++ Compiler User and Reference Guides
37        #elif defined __GNUC__
38                #define IDISA_INLINE          __inline__
39        #else
40                #define IDISA_INLINE          inline
41        #endif
42#endif
43
44/*
45 * IDISA_INLINE is a macro which expands to tell the compiler that the
46 * method decorated with it must be inlined, even if the compiler thinks
47 * otherwise.  This is only a (much) stronger version of the IDISA_INLINE hint:
48 * compilers are not guaranteed to respect it (although they're much more likely
49 * to do so).
50 */
51#ifndef IDISA_ALWAYS_INLINE
52        #if defined IDISA_DEBUG
53                #define IDISA_ALWAYS_INLINE   IDISA_INLINE
54        #elif defined _MSC_VER
55                #define IDISA_ALWAYS_INLINE   __forceinline
56        //      #elif defined __INTEL_COMPILER
57        //              #define IDISA_ALWAYS_INLINE     __forceinline // ICC defaults to GCC. See, Intel® C++ Compiler User and Reference Guides
58        #elif defined __GNUC__
59                #define IDISA_ALWAYS_INLINE   __attribute__((always_inline)) IDISA_INLINE
60        #else
61                #define IDISA_ALWAYS_INLINE   IDISA_INLINE
62        #endif
63#endif
64
65#endif /* CONFIG_HPP_ */
Note: See TracBrowser for help on using the repository browser.