Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:28:09

0001 //
0002 // MIT License
0003 // Copyright (c) 2020 Jonathan R. Madsen
0004 // Permission is hereby granted, free of charge, to any person obtaining a copy
0005 // of this software and associated documentation files (the "Software"), to deal
0006 // in the Software without restriction, including without limitation the rights
0007 // to use, copy, modify, merge, publish, distribute, sublicense, and
0008 // copies of the Software, and to permit persons to whom the Software is
0009 // furnished to do so, subject to the following conditions:
0010 // The above copyright notice and this permission notice shall be included in
0011 // all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED
0012 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
0013 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
0014 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
0015 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0016 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0017 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0018 //
0019 
0020 #pragma once
0021 
0022 #if defined(__APPLE__) || defined(__MACH__)
0023 #    if !defined(PTL_MACOS)
0024 #        define PTL_MACOS 1
0025 #    endif
0026 #    if !defined(PTL_UNIX)
0027 #        define PTL_UNIX 1
0028 #    endif
0029 #endif
0030 
0031 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
0032 #    if !defined(PTL_WINDOWS)
0033 #        define PTL_WINDOWS 1
0034 #    endif
0035 #endif
0036 
0037 #if defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
0038 #    if !defined(PTL_LINUX)
0039 #        define PTL_LINUX 1
0040 #    endif
0041 #    if !defined(PTL_UNIX)
0042 #        define PTL_UNIX 1
0043 #    endif
0044 #endif
0045 
0046 #if defined(__unix__) || defined(__unix) || defined(unix)
0047 #    if !defined(PTL_UNIX)
0048 #        define PTL_UNIX 1
0049 #    endif
0050 #endif
0051 
0052 #if defined(PTL_WINDOWS)
0053 // Disable warning C4786 on WIN32 architectures:
0054 // identifier was truncated to '255' characters
0055 // in the debug information
0056 //
0057 #    pragma warning(disable : 4786)
0058 //
0059 // Define DLL export macro for WIN32 systems for
0060 // importing/exporting external symbols to DLLs
0061 //
0062 #    if defined PTL_BUILD_DLL
0063 #        define DLLEXPORT __declspec(dllexport)
0064 #        define DLLIMPORT __declspec(dllimport)
0065 #    else
0066 #        define DLLEXPORT
0067 #        define DLLIMPORT
0068 #    endif
0069 //
0070 // Unique identifier for global module
0071 //
0072 #    if defined PTL_ALLOC_EXPORT
0073 #        define PTL_DLL DLLEXPORT
0074 #    else
0075 #        define PTL_DLL DLLIMPORT
0076 #    endif
0077 #else
0078 #    define DLLEXPORT
0079 #    define DLLIMPORT
0080 #    define PTL_DLL
0081 #endif
0082 
0083 #if !defined(PTL_DEFAULT_OBJECT)
0084 #    define PTL_DEFAULT_OBJECT(NAME)                                                     \
0085         NAME()            = default;                                                     \
0086         ~NAME()           = default;                                                     \
0087         NAME(const NAME&) = default;                                                     \
0088         NAME(NAME&&)      = default;                                                     \
0089         NAME& operator=(const NAME&) = default;                                          \
0090         NAME& operator=(NAME&&) = default;
0091 #endif
0092 
0093 #if !defined(PTL_NO_SANITIZE_THREAD)
0094 // expect that sanitizer is from compiler which supports __has_attribute
0095 #    if defined(__has_attribute)
0096 #        if __has_attribute(no_sanitize)
0097 #            define PTL_NO_SANITIZE_THREAD __attribute__((no_sanitize("thread")))
0098 #        else
0099 #            define PTL_NO_SANITIZE_THREAD
0100 #        endif
0101 #    elif defined(__clang__) || defined(__GNUC__)
0102 #        define PTL_NO_SANITIZE_THREAD __attribute__((no_sanitize("thread")))
0103 #    else
0104 // otherwise, make blank
0105 #        define PTL_NO_SANITIZE_THREAD
0106 #    endif
0107 #endif