|
1 | | -#ifndef MLK_CORE_COMPILATION_PROFILE_HPP__ |
2 | | -#define MLK_CORE_COMPILATION_PROFILE_HPP__ |
| 1 | +#ifndef SQUID_CORE_COMPILATION_PROFILE_HPP__ |
| 2 | +#define SQUID_CORE_COMPILATION_PROFILE_HPP__ |
3 | 3 |
|
4 | 4 | #include <climits> |
5 | 5 | #include <cstdint> |
6 | 6 |
|
7 | 7 | // Try to identify the compiler |
8 | 8 | #if defined(__BORLANDC__) |
9 | | - #define MLK_COMPILER_BORDLAND |
| 9 | + #define SQUID_COMPILER_BORDLAND |
10 | 10 | #elif defined(__clang__) |
11 | | - #define MLK_COMPILER_CLANG |
| 11 | + #define SQUID_COMPILER_CLANG |
12 | 12 | #ifdef __MINGW32__ |
13 | | - #define MLK_COMPILER_MINGW |
| 13 | + #define SQUID_COMPILER_MINGW |
14 | 14 | #ifdef __MINGW64_VERSION_MAJOR |
15 | | - #define MLK_COMPILER_MINGW_W64 |
| 15 | + #define SQUID_COMPILER_MINGW_W64 |
16 | 16 | #endif |
17 | 17 | #endif |
18 | 18 | #elif defined(__GNUC__) || defined(__MINGW32__) |
19 | | - #define MLK_COMPILER_GCC |
| 19 | + #define SQUID_COMPILER_GCC |
20 | 20 | #ifdef __MINGW32__ |
21 | | - #define MLK_COMPILER_MINGW |
| 21 | + #define SQUID_COMPILER_MINGW |
22 | 22 | #ifdef __MINGW64_VERSION_MAJOR |
23 | | - #define MLK_COMPILER_MINGW_W64 |
| 23 | + #define SQUID_COMPILER_MINGW_W64 |
24 | 24 | #endif |
25 | 25 | #endif |
26 | 26 | #elif defined(__INTEL_COMPILER) || defined(__ICL) |
27 | | - #define MLK_COMPILER_INTEL |
| 27 | + #define SQUID_COMPILER_INTEL |
28 | 28 | #elif defined(_MSC_VER) |
29 | | - #define MLK_COMPILER_MSVC |
| 29 | + #define SQUID_COMPILER_MSVC |
30 | 30 | #else |
31 | | - #define MLK_COMPILER_UNKNOWN |
| 31 | + #define SQUID_COMPILER_UNKNOWN |
32 | 32 | #warning "This compiler is not fully supported" |
33 | 33 | #endif |
34 | 34 |
|
35 | 35 | #if defined(_WIN32) || defined(__CYGWIN__) |
36 | | - #define MLK_PLAT_WINDOWS |
| 36 | + #define SQUID_PLAT_WINDOWS |
37 | 37 | #elif defined(__linux__) |
38 | | - #define MLK_PLAT_LINUX |
39 | | - #define MLK_PLAT_UNIX |
| 38 | + #define SQUID_PLAT_LINUX |
| 39 | + #define SQUID_PLAT_UNIX |
40 | 40 | #elif defined(__APPLE__) && defined(__MACH__) |
41 | | - #define MLK_PLAT_MACOS |
| 41 | + #define SQUID_PLAT_MACOS |
42 | 42 | #elif defined(unix) || defined(__unix__) || defined(__unix) |
43 | | - #define MLK_PLAT_UNIX |
| 43 | + #define SQUID_PLAT_UNIX |
44 | 44 | #else |
45 | 45 | #error "Unknown environment (not Windows, not Linux, not MacOS, not Unix)" |
46 | 46 | #endif |
47 | 47 |
|
48 | 48 | #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) |
49 | | - #define MLK_FUNC_SIG __PRETTY_FUNCTION__ |
| 49 | + #define SQUID_FUNC_SIG __PRETTY_FUNCTION__ |
50 | 50 | #elif defined(__DMC__) && (__DMC__ >= 0x810) |
51 | | - #define MLK_FUNC_SIG __PRETTY_FUNCTION__ |
| 51 | + #define SQUID_FUNC_SIG __PRETTY_FUNCTION__ |
52 | 52 | #elif (defined(__FUNCSIG__) || (_MSC_VER)) |
53 | | - #define MLK_FUNC_SIG __FUNCSIG__ |
| 53 | + #define SQUID_FUNC_SIG __FUNCSIG__ |
54 | 54 | #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) |
55 | | - #define MLK_FUNC_SIG __FUNCTION__ |
| 55 | + #define SQUID_FUNC_SIG __FUNCTION__ |
56 | 56 | #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) |
57 | | - #define MLK_FUNC_SIG __FUNC__ |
| 57 | + #define SQUID_FUNC_SIG __FUNC__ |
58 | 58 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) |
59 | | - #define MLK_FUNC_SIG __func__ |
| 59 | + #define SQUID_FUNC_SIG __func__ |
60 | 60 | #elif defined(__cplusplus) && (__cplusplus >= 201103) |
61 | | - #define MLK_FUNC_SIG __func__ |
| 61 | + #define SQUID_FUNC_SIG __func__ |
62 | 62 | #else |
63 | | - #define MLK_FUNC_SIG "Unknown function" |
| 63 | + #define SQUID_FUNC_SIG "Unknown function" |
64 | 64 | #endif |
65 | 65 |
|
66 | | -#ifdef MLK_PLAT_WINDOWS |
67 | | - #ifdef MLK_COMPILER_MSVC |
68 | | - #define MLK_EXPORT_API __declspec(dllexport) |
69 | | - #define MLK_IMPORT_API __declspec(dllimport) |
70 | | - #elif defined(MLK_COMPILER_GCC) |
71 | | - #define MLK_EXPORT_API __attribute__((dllexport)) |
72 | | - #define MLK_IMPORT_API __attribute__((dllimport)) |
| 66 | +#ifdef SQUID_PLAT_WINDOWS |
| 67 | + #ifdef SQUID_COMPILER_MSVC |
| 68 | + #define SQUID_EXPORT_API __declspec(dllexport) |
| 69 | + #define SQUID_IMPORT_API __declspec(dllimport) |
| 70 | + #elif defined(SQUID_COMPILER_GCC) |
| 71 | + #define SQUID_EXPORT_API __attribute__((dllexport)) |
| 72 | + #define SQUID_IMPORT_API __attribute__((dllimport)) |
73 | 73 | #else |
74 | | - #define MLK_EXPORT_API |
75 | | - #define MLK_IMPORT_API |
| 74 | + #define SQUID_EXPORT_API |
| 75 | + #define SQUID_IMPORT_API |
76 | 76 | #endif |
77 | | -#elif defined(MLK_COMPILER_GCC) |
78 | | - #define MLK_EXPORT_API __attribute__((visibility("default"))) |
79 | | - #define MLK_IMPORT_API __attribute__((visibility("default"))) |
| 77 | +#elif defined(SQUID_COMPILER_GCC) |
| 78 | + #define SQUID_EXPORT_API __attribute__((visibility("default"))) |
| 79 | + #define SQUID_IMPORT_API __attribute__((visibility("default"))) |
80 | 80 | #else |
81 | | - #define MLK_EXPORT_API |
82 | | - #define MLK_IMPORT_API |
| 81 | + #define SQUID_EXPORT_API |
| 82 | + #define SQUID_IMPORT_API |
83 | 83 | #endif |
84 | 84 |
|
85 | | -#if defined(MLK_PLAT_WINDOWS) |
86 | | - #define MLK_LIB_EXTENSION ".dll" |
87 | | -#elif defined(MLK_PLAT_UNIX) |
88 | | - #define MLK_LIB_EXTENSION ".so" |
89 | | -#elif defined(MLK_PLAT_MACOS) |
90 | | - #define MLK_LIB_EXTENSION ".dylib" |
91 | | -#elif defined(MLK_PLAT_WASM) |
92 | | - #define MLK_LIB_EXTENSION ".wasm" |
| 85 | +#if defined(SQUID_PLAT_WINDOWS) |
| 86 | + #define SQUID_LIB_EXTENSION ".dll" |
| 87 | +#elif defined(SQUID_PLAT_UNIX) |
| 88 | + #define SQUID_LIB_EXTENSION ".so" |
| 89 | +#elif defined(SQUID_PLAT_MACOS) |
| 90 | + #define SQUID_LIB_EXTENSION ".dylib" |
| 91 | +#elif defined(SQUID_PLAT_WASM) |
| 92 | + #define SQUID_LIB_EXTENSION ".wasm" |
93 | 93 | #endif |
94 | 94 |
|
95 | | -#ifdef MLK_COMPILER_MSVC |
96 | | - #define MLK_LIB_PREFIX "" |
| 95 | +#ifdef SQUID_COMPILER_MSVC |
| 96 | + #define SQUID_LIB_PREFIX "" |
97 | 97 | #else |
98 | | - #define MLK_LIB_PREFIX "lib" |
| 98 | + #define SQUID_LIB_PREFIX "lib" |
99 | 99 | #endif |
100 | 100 |
|
101 | | -#if !defined(MLK_NO_FORCEINLINE) && !defined(MLK_FORCEINLINE) |
102 | | - #if defined(MLK_COMPILER_CLANG) || defined(MLK_COMPILER_GCC) |
103 | | - #define MLK_FORCEINLINE __attribute__((always_inline)) inline |
104 | | - #elif defined(MLK_COMPILER_MSVC) |
105 | | - #define MLK_FORCEINLINE __forceinline |
| 101 | +#if !defined(SQUID_NO_FORCEINLINE) && !defined(SQUID_FORCEINLINE) |
| 102 | + #if defined(SQUID_COMPILER_CLANG) || defined(SQUID_COMPILER_GCC) |
| 103 | + #define SQUID_FORCEINLINE __attribute__((always_inline)) inline |
| 104 | + #elif defined(SQUID_COMPILER_MSVC) |
| 105 | + #define SQUID_FORCEINLINE __forceinline |
106 | 106 | #else |
107 | | - #define MLK_FORCEINLINE inline |
| 107 | + #define SQUID_FORCEINLINE inline |
108 | 108 | #endif |
109 | 109 | #endif |
110 | 110 |
|
111 | | -#if !defined(MLK_NO_WEAK) && !defined(MLK_WEAK) |
112 | | - #if defined(MLK_COMPILER_CLANG) || defined(MLK_COMPILER_GCC) |
113 | | - #define MLK_WEAK __attribute__((weak)) |
| 111 | +#if !defined(SQUID_NO_WEAK) && !defined(SQUID_WEAK) |
| 112 | + #if defined(SQUID_COMPILER_CLANG) || defined(SQUID_COMPILER_GCC) |
| 113 | + #define SQUID_WEAK __attribute__((weak)) |
114 | 114 | #else |
115 | | - #define MLK_WEAK |
| 115 | + #define SQUID_WEAK |
116 | 116 | #endif |
117 | 117 | #endif |
118 | 118 |
|
119 | 119 | #if defined(__x86_64__) || defined(_M_X64) || defined(__ppc64__) |
120 | | - #define MLK_64BITS |
| 120 | + #define SQUID_64BITS |
121 | 121 | #elif defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) |
122 | | - #define MLK_32BITS |
| 122 | + #define SQUID_32BITS |
123 | 123 | #elif UINTPTR_MAX == UINT32_MAX |
124 | | - #define MLK_32BITS |
| 124 | + #define SQUID_32BITS |
125 | 125 | #elif UINTPTR_MAX == UINT64_MAX |
126 | | - #define MLK_64BITS |
| 126 | + #define SQUID_64BITS |
127 | 127 | #endif |
128 | 128 |
|
129 | | -#define MLK_UNUSED_PARAM(x) |
130 | | -#define MLK_UNUSED(x) (void)(x) |
| 129 | +#define SQUID_UNUSED_PARAM(x) |
| 130 | +#define SQUID_UNUSED(x) (void)(x) |
131 | 131 |
|
132 | 132 | // Checking common assumptions |
133 | 133 |
|
134 | | -#if !defined(MLK_32BITS) && !defined(MLK_64BITS) |
135 | | - #error "Mlk can only run on 32bit or 64bit architectures" |
| 134 | +#if !defined(SQUID_32BITS) && !defined(SQUID_64BITS) |
| 135 | + #error "Squid can only run on 32bit or 64bit architectures" |
136 | 136 | #endif |
137 | 137 |
|
138 | 138 | static_assert(CHAR_BIT == 8, "CHAR_BIT is expected to be 8"); |
|
0 commit comments