Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
greenlet_compiler_compat.hpp
1/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */
2#ifndef GREENLET_COMPILER_COMPAT_HPP
3#define GREENLET_COMPILER_COMPAT_HPP
4
39#include <cstdint>
40
41# define G_NO_COPIES_OF_CLS(Cls) private: \
42 Cls(const Cls& other) = delete; \
43 Cls& operator=(const Cls& other) = delete
44
45# define G_NO_ASSIGNMENT_OF_CLS(Cls) private: \
46 Cls& operator=(const Cls& other) = delete
47
48# define G_NO_COPY_CONSTRUCTOR_OF_CLS(Cls) private: \
49 Cls(const Cls& other) = delete;
50
51
52// CAUTION: MSVC is stupidly picky:
53//
54// "The compiler ignores, without warning, any __declspec keywords
55// placed after * or & and in front of the variable identifier in a
56// declaration."
57// (https://docs.microsoft.com/en-us/cpp/cpp/declspec?view=msvc-160)
58//
59// So pointer return types must be handled differently (because of the
60// trailing *), or you get inscrutable compiler warnings like "error
61// C2059: syntax error: ''"
62//
63// In C++ 11, there is a standard syntax for attributes, and
64// GCC defines an attribute to use with this: [[gnu:noinline]].
65// In the future, this is expected to become standard.
66
67#if defined(__GNUC__) || defined(__clang__)
68/* We used to check for GCC 4+ or 3.4+, but those compilers are
69 laughably out of date. Just assume they support it. */
70# define GREENLET_NOINLINE(name) __attribute__((noinline)) name
71# define GREENLET_NOINLINE_P(rtype, name) rtype __attribute__((noinline)) name
72# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
73#elif defined(_MSC_VER)
74/* We used to check for && (_MSC_VER >= 1300) but that's also out of date. */
75# define GREENLET_NOINLINE(name) __declspec(noinline) name
76# define GREENLET_NOINLINE_P(rtype, name) __declspec(noinline) rtype name
77# define UNUSED(x) UNUSED_ ## x
78#endif
79
80#if defined(_MSC_VER)
81# define G_NOEXCEPT_WIN32 noexcept
82#else
83# define G_NOEXCEPT_WIN32
84#endif
85
86#if defined(__GNUC__) && defined(__POWERPC__) && defined(__APPLE__)
87// 32-bit PPC/MacOSX. Only known to be tested on unreleased versions
88// of macOS 10.6 using a macports build gcc 14. It appears that
89// running C++ destructors of thread-local variables is broken.
90
91// See https://github.com/python-greenlet/greenlet/pull/419
92# define GREENLET_BROKEN_THREAD_LOCAL_CLEANUP_JUST_LEAK 1
93#else
94# define GREENLET_BROKEN_THREAD_LOCAL_CLEANUP_JUST_LEAK 0
95#endif
96
97
98#endif