TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
Loading...
Searching...
No Matches
tec_def.hpp
Go to the documentation of this file.
1// Time-stamp: <Last changed 2026-02-20 15:55:21 by magnolia>
2/*----------------------------------------------------------------------
3------------------------------------------------------------------------
4Copyright (c) 2020-2026 The Emacs Cat (https://github.com/olddeuteronomy/tec).
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17------------------------------------------------------------------------
18----------------------------------------------------------------------*/
26#pragma once
27
28#define __TEC__ 1
29
30// To resolve C-macros conflicts
31#ifndef NOMINMAX
32 #define NOMINMAX 1
33#endif
34
36
37// Check for Linux
38#if defined(linux) || defined(__linux) || defined(__linux__)
39 #define __TEC__LINUX__ 1
40#endif
41
42// Check for Unix
43#if defined(unix) || defined(__unix) || defined(__unix__)
44 #define __TEC_UNIX__ 1
45#endif
46
47// Check for Apple
48#if defined(__APPLE__)
49 #define __TEC_APPLE__ __APPLE__
50#endif
51
52// Check for MS Windows
53#if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))
54 #define __TEC_WINDOWS__ _MSC_VER
55#endif
56
57// Check for MINGW
58#if defined(__MSVCRT__) && (defined(__MINGW32__) || defined(__MINGW64__))
59 #define __TEC_MINGW__ 1
60#endif
61
62#if defined(__clang__)
63// Check clang
64 // This pragma has been removed to make the code cleaner:
65 // #pragma clang diagnostic ignored "-Wmicrosoft-template-shadow"
66 #define __TEC_CLANG__ 1
67 #define __TEC_COMPILER_NAME__ __VERSION__
68
69 #define __TEC_COMPILER_VER_MAJOR__ __clang_major__
70 #define __TEC_COMPILER_VER_MINOR__ __clang_minor__
71 #define __TEC_COMPILER_VER_PATCHLEVEL__ __clang_patchlevel__
72 #define __TEC_INT__ __INT_WIDTH__
73 #define __TEC_LONG__ __LONG_WIDTH__
74 #define __TEC_PTR__ __INTPTR_WIDTH__
75
76#elif defined(__TEC_MINGW__)
77// Check MINGW
78 #define __TEC_COMPILER_NAME__ __VERSION__
79
80 #define __TEC_COMPILER_VER_MAJOR__ __GNUC__
81 #define __TEC_COMPILER_VER_MINOR__ __GNUC_MINOR__
82 #define __TEC_COMPILER_VER_PATCHLEVEL__ __GNUC_PATCHLEVEL__
83 #define __TEC_INT__ __SIZEOF_INT__<<3
84 #define __TEC_LONG__ __SIZEOF_LONG__<<3
85 #define __TEC_PTR__ __SIZEOF_POINTER__<<3
86
87#elif defined(__GNUC__)
88// Check gcc
89 #define __TEC_GNUC__ __GNUC__
90 #define __TEC_COMPILER_NAME__ "g++" " " __VERSION__
91
92 #define __TEC_COMPILER_VER_MAJOR__ __GNUC__
93 #define __TEC_COMPILER_VER_MINOR__ __GNUC_MINOR__
94 #define __TEC_COMPILER_VER_PATCHLEVEL__ __GNUC_PATCHLEVEL__
95 #define __TEC_INT__ __SIZEOF_INT__<<3
96 #define __TEC_LONG__ __SIZEOF_LONG__<<3
97 #define __TEC_PTR__ __SIZEOF_POINTER__<<3
98
99#elif defined(__TEC_WINDOWS__)
100// Windows specific
101 #define __TEC_MSC__ _MSC_VER
102 #define __TEC_COMPILER_NAME__ "cl"
103
104 #define __TEC_COMPILER_VER_MAJOR__ _MSC_VER
105 // TODO
106 #define __TEC_COMPILER_VER_MINOR__ 0
107 #define __TEC_COMPILER_VER_PATCHLEVEL__ _MSC_BUILD
108
109 #if defined(_WIN64)
110 #define __TEC_INT__ 32
111 #define __TEC_LONG__ 32
112 #define __TEC_PTR__ 64
113 #else
114 #define __TEC_INT__ 32
115 #define __TEC_LONG__ 32
116 #define __TEC_PTR__ 32
117 #endif
118
119#endif // OS specific defines end here
120
121#if !defined(__TEC_INT__) || !defined(__TEC_PTR__) || !defined(__TEC_LONG__)
122 #error Missing feature-test macro for 32/64-bit on this compiler.
123#endif