diff options
author | 卜部昌平 <[email protected]> | 2020-05-08 18:10:13 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-05-11 09:24:08 +0900 |
commit | b85fd1d690b65efaa126cf9c24da73f31eee7a4e (patch) | |
tree | e9bb5dbc7cea460fa8f209308c798eb783a33167 /include/ruby/impl/attr | |
parent | 0d88fe3a7278e3dab2675c1fe2c0f184d0624da2 (diff) |
mv include/ruby/{impl,internal}
Devs do not love "impl".
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3079
Diffstat (limited to 'include/ruby/impl/attr')
24 files changed, 0 insertions, 1062 deletions
diff --git a/include/ruby/impl/attr/alloc_size.h b/include/ruby/impl/attr/alloc_size.h deleted file mode 100644 index 9dd79f15fc..0000000000 --- a/include/ruby/impl/attr/alloc_size.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RBIMPL_ATTR_ALLOC_SIZE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_ALLOC_SIZE_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_ALLOC_SIZE. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((alloc_size))` */ -#if RBIMPL_HAS_ATTRIBUTE(alloc_size) -# define RBIMPL_ATTR_ALLOC_SIZE(tuple) __attribute__((__alloc_size__ tuple)) -#else -# define RBIMPL_ATTR_ALLOC_SIZE(tuple) /* void */ -#endif - -#endif /* RBIMPL_ATTR_ALLOC_SIZE_H */ diff --git a/include/ruby/impl/attr/artificial.h b/include/ruby/impl/attr/artificial.h deleted file mode 100644 index 7c9dc3e175..0000000000 --- a/include/ruby/impl/attr/artificial.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef RBIMPL_ATTR_ARTIFICIAL_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_ARTIFICIAL_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_ARTIFICIAL. - * - * ### Q&A ### - * - * - Q: What is this attribute? I don't get what GCC manual is talking about. - * - * - A: In short it is an attribute to manipulate GDB backtraces. The - * attribute makes the best sense when it comes with - * __attribute__((always_inline)). When a function annotated with this - * attribute gets inlined, and when you somehow look at a backtrace which - * includes such inlined call site, then the backtrace shows the caller - * and not the callee. This is handy for instance when an identical - * function is inlined more than once in a single big function. On such - * case it gets vital to know where the inlining happened in the callee. - * See also https://stackoverflow.com/a/21936099 - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((artificial))` */ -#if RBIMPL_HAS_ATTRIBUTE(artificial) -# define RBIMPL_ATTR_ARTIFICIAL() __attribute__((__artificial__)) -#else -# define RBIMPL_ATTR_ARTIFICIAL() /* void */ -#endif - -#endif /* RBIMPL_ATTR_ARTIFICIAL_H */ diff --git a/include/ruby/impl/attr/cold.h b/include/ruby/impl/attr/cold.h deleted file mode 100644 index 85877b6136..0000000000 --- a/include/ruby/impl/attr/cold.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RBIMPL_ATTR_COLD_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_COLD_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_COLD. - */ -#include "ruby/impl/compiler_is.h" -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((cold))` */ -#if RBIMPL_COMPILER_IS(SunPro) -# /* Recent SunPro has __has_attribute, and is borken. */ -# /* It reports it has attribute cold, reality isn't (warnings issued). */ -# define RBIMPL_ATTR_COLD() /* void */ -#elif RBIMPL_HAS_ATTRIBUTE(cold) -# define RBIMPL_ATTR_COLD() __attribute__((__cold__)) -#else -# define RBIMPL_ATTR_COLD() /* void */ -#endif - -#endif /* RBIMPL_ATTR_COLD_H */ diff --git a/include/ruby/impl/attr/const.h b/include/ruby/impl/attr/const.h deleted file mode 100644 index 85892ea464..0000000000 --- a/include/ruby/impl/attr/const.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef RBIMPL_ATTR_CONST_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_CONST_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_CONST. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/has/declspec_attribute.h" - -/** Wraps (or simulates) `__attribute__((const))` */ -#if RBIMPL_HAS_ATTRIBUTE(const) -# define RBIMPL_ATTR_CONST() __attribute__((__const__)) -#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noalias) -# /* If a function can be a const, that is also a noalias. */ -# define RBIMPL_ATTR_CONST() __declspec(noalias) -#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RBIMPL_ATTR_CONST() _Pragma("no_side_effect") -#else -# define RBIMPL_ATTR_CONST() /* void */ -#endif - -/** Enables #RBIMPL_ATTR_CONST iff. #RUBY_NDEBUG. */ -#if RUBY_NDEBUG -# define RBIMPL_ATTR_CONST_ON_NDEBUG() RBIMPL_ATTR_CONST() -#else -# define RBIMPL_ATTR_CONST_ON_NDEBUG() /* void */ -#endif - -#endif /* RBIMPL_ATTR_CONST_H */ diff --git a/include/ruby/impl/attr/constexpr.h b/include/ruby/impl/attr/constexpr.h deleted file mode 100644 index 4b6cc81e3b..0000000000 --- a/include/ruby/impl/attr/constexpr.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef RBIMPL_ATTR_CONSTEXPR_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_CONSTEXPR_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief #RBIMPL_ATTR_CONSTEXPR. - */ -#include "ruby/impl/has/feature.h" -#include "ruby/impl/compiler_is.h" -#include "ruby/impl/token_paste.h" - -/** @cond INTERNAL_MACRO */ -#if ! defined(__cplusplus) -# /* Makes no sense. */ -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 0 -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 0 - -#elif defined(__cpp_constexpr) -# /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */ -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 (__cpp_constexpr >= 200704L) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 (__cpp_constexpr >= 201304L) - -#elif RBIMPL_COMPILER_SINCE(MSVC, 19, 0, 0) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 RBIMPL_COMPILER_SINCE(MSVC, 19, 00, 00) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 RBIMPL_COMPILER_SINCE(MSVC, 19, 11, 00) - -#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 13, 0) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 (__cplusplus >= 201103L) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 (__cplusplus >= 201402L) - -#elif RBIMPL_COMPILER_SINCE(GCC, 4, 9, 0) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 (__cplusplus >= 201103L) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 (__cplusplus >= 201402L) - -#elif RBIMPL_HAS_FEATURE(cxx_relaxed_constexpr) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 1 -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 1 - -#elif RBIMPL_HAS_FEATURE(cxx_constexpr) -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 1 -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 0 - -#else -# /* :FIXME: icpc must have constexpr but don't know how to detect. */ -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 0 -# define RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 0 -#endif -/** @endcond */ - -/** Wraps (or simulates) C++11 `constexpr`. */ -#if RBIMPL_HAS_ATTR_CONSTEXPR_CXX14 -# define RBIMPL_ATTR_CONSTEXPR(_) constexpr - -#elif RBIMPL_HAS_ATTR_CONSTEXPR_CXX11 -# define RBIMPL_ATTR_CONSTEXPR(_) RBIMPL_TOKEN_PASTE(RBIMPL_ATTR_CONSTEXPR_, _) -# define RBIMPL_ATTR_CONSTEXPR_CXX11 constexpr -# define RBIMPL_ATTR_CONSTEXPR_CXX14 /* void */ - -#else -# define RBIMPL_ATTR_CONSTEXPR(_) /* void */ -#endif - -/** Enables #RBIMPL_ATTR_CONSTEXPR iff. #RUBY_NDEBUG. */ -#if RUBY_NDEBUG -# define RBIMPL_ATTR_CONSTEXPR_ON_NDEBUG(_) RBIMPL_ATTR_CONSTEXPR(_) -#else -# define RBIMPL_ATTR_CONSTEXPR_ON_NDEBUG(_) /* void */ -#endif - -#endif /* RBIMPL_ATTR_CONSTEXPR_H */ diff --git a/include/ruby/impl/attr/deprecated.h b/include/ruby/impl/attr/deprecated.h deleted file mode 100644 index c603d58a1f..0000000000 --- a/include/ruby/impl/attr/deprecated.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef RBIMPL_ATTR_DEPRECATED_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_DEPRECATED_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_DEPRECATED. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/has/c_attribute.h" -#include "ruby/impl/has/cpp_attribute.h" -#include "ruby/impl/has/declspec_attribute.h" -#include "ruby/impl/has/extension.h" - -/** Wraps (or simulates) `[[deprecated]]` */ -#if RBIMPL_HAS_EXTENSION(attribute_deprecated_with_message) -# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) - -#elif RBIMPL_COMPILER_SINCE(GCC, 4, 5, 0) -# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) - -#elif RBIMPL_COMPILER_SINCE(Intel, 13, 0, 0) -# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) - -#elif RBIMPL_HAS_ATTRIBUTE(deprecated) /* but not with message. */ -# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__)) - -#elif RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0) -# define RBIMPL_ATTR_DEPRECATED(msg) __declspec(deprecated msg) - -#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(deprecated) -# define RBIMPL_ATTR_DEPRECATED(msg) __declspec(deprecated) - -#elif RBIMPL_HAS_CPP_ATTRIBUTE(deprecated) -# define RBIMPL_ATTR_DEPRECATED(msg) [[deprecated msg]] - -#elif RBIMPL_HAS_C_ATTRIBUTE(deprecated) -# define RBIMPL_ATTR_DEPRECATED(msg) [[deprecated msg]] - -#else -# define RBIMPL_ATTR_DEPRECATED(msg) /* void */ -#endif - -#endif /* RBIMPL_ATTR_DEPRECATED_H */ diff --git a/include/ruby/impl/attr/diagnose_if.h b/include/ruby/impl/attr/diagnose_if.h deleted file mode 100644 index ba6e8626e3..0000000000 --- a/include/ruby/impl/attr/diagnose_if.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef RBIMPL_ATTR_DIAGNOSE_IF_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_DIAGNOSE_IF_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_DIAGNOSE_IF. - */ -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/warning_push.h" - -/** Wraps (or simulates) `__attribute__((diagnose_if))` */ -#if RBIMPL_COMPILER_BEFORE(Clang, 5, 0, 0) -# /* https://bugs.llvm.org/show_bug.cgi?id=34319 */ -# define RBIMPL_ATTR_DIAGNOSE_IF(_, __, ___) /* void */ - -#elif RBIMPL_HAS_ATTRIBUTE(diagnose_if) -# define RBIMPL_ATTR_DIAGNOSE_IF(_, __, ___) \ - RBIMPL_WARNING_PUSH() \ - RBIMPL_WARNING_IGNORED(-Wgcc-compat) \ - __attribute__((__diagnose_if__(_, __, ___))) \ - RBIMPL_WARNING_POP() - -#else -# define RBIMPL_ATTR_DIAGNOSE_IF(_, __, ___) /* void */ -#endif - -#endif /* RBIMPL_ATTR_DIAGNOSE_IF_H */ diff --git a/include/ruby/impl/attr/enum_extensibility.h b/include/ruby/impl/attr/enum_extensibility.h deleted file mode 100644 index d5d25e03d7..0000000000 --- a/include/ruby/impl/attr/enum_extensibility.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RBIMPL_ATTR_ENUM_EXTENSIBILITY_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_ENUM_EXTENSIBILITY_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief #RBIMPL_ATTR_ENUM_EXTENSIBILITY. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((enum_extensibility))` */ -#if RBIMPL_HAS_ATTRIBUTE(enum_extensibility) -# define RBIMPL_ATTR_ENUM_EXTENSIBILITY(_) __attribute__((__enum_extensibility__(_))) -#else -# define RBIMPL_ATTR_ENUM_EXTENSIBILITY(_) /* void */ -#endif - -#endif /* RBIMPL_ATTR_ENUM_EXTENSIBILITY_H */ diff --git a/include/ruby/impl/attr/error.h b/include/ruby/impl/attr/error.h deleted file mode 100644 index b46b306fb9..0000000000 --- a/include/ruby/impl/attr/error.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RBIMPL_ATTR_ERROR_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_ERROR_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_ERROR. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((error))` */ -#if RBIMPL_HAS_ATTRIBUTE(error) -# define RBIMPL_ATTR_ERROR(msg) __attribute__((__error__ msg)) -#else -# define RBIMPL_ATTR_ERROR(msg) /* void */ -#endif - -#endif /* RBIMPL_ATTR_ERROR_H */ diff --git a/include/ruby/impl/attr/flag_enum.h b/include/ruby/impl/attr/flag_enum.h deleted file mode 100644 index e769708d93..0000000000 --- a/include/ruby/impl/attr/flag_enum.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RBIMPL_ATTR_FLAG_ENUM_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_FLAG_ENUM_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_FLAG_ENUM. - * @see https://clang.llvm.org/docs/AttributeReference.html#flag_enum - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((flag_enum)` */ -#if RBIMPL_HAS_ATTRIBUTE(flag_enum) -# define RBIMPL_ATTR_FLAG_ENUM() __attribute__((__flag_enum__)) -#else -# define RBIMPL_ATTR_FLAG_ENUM() /* void */ -#endif - -#endif /* RBIMPLATTR_FLAG_ENUM_H */ diff --git a/include/ruby/impl/attr/forceinline.h b/include/ruby/impl/attr/forceinline.h deleted file mode 100644 index 8d60a63437..0000000000 --- a/include/ruby/impl/attr/forceinline.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef RBIMPL_ATTR_FORCEINLINE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_FORCEINLINE_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_FORCEINLINE. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/attribute.h" - -/** - * Wraps (or simulates) `__forceinline`. MSVC complains on declarations like - * `static inline __forceinline void foo()`. It seems MSVC's `inline` and - * `__forceinline` are mutually exclusive. We have to mimic that behaviour for - * non-MSVC compilers. - */ -#if RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0) -# define RBIMPL_ATTR_FORCEINLINE() __forceinline -#elif RBIMPL_HAS_ATTRIBUTE(always_inline) -# define RBIMPL_ATTR_FORCEINLINE() __attribute__((__always_inline__)) inline -#else -# define RBIMPL_ATTR_FORCEINLINE() inline -#endif - -#endif /* RBIMPL_ATTR_FORCEINLINE_H */ diff --git a/include/ruby/impl/attr/format.h b/include/ruby/impl/attr/format.h deleted file mode 100644 index 368c9f8797..0000000000 --- a/include/ruby/impl/attr/format.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef RBIMPL_ATTR_FORMAT_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_FORMAT_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_FORMAT. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((format))` */ -#if RBIMPL_HAS_ATTRIBUTE(format) -# define RBIMPL_ATTR_FORMAT(x, y, z) __attribute__((__format__(x, y, z))) -#else -# define RBIMPL_ATTR_FORMAT(x, y, z) /* void */ -#endif - -#if defined(__MINGW_PRINTF_FORMAT) -# define RBIMPL_PRINTF_FORMAT __MINGW_PRINTF_FORMAT -#else -# define RBIMPL_PRINTF_FORMAT __printf__ -#endif - -#endif /* RBIMPL_ATTR_FORMAT_H */ diff --git a/include/ruby/impl/attr/maybe_unused.h b/include/ruby/impl/attr/maybe_unused.h deleted file mode 100644 index d554603db5..0000000000 --- a/include/ruby/impl/attr/maybe_unused.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef RBIMPL_ATTR_MAYBE_UNUSED_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_MAYBE_UNUSED_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_MAYBE_UNUSED. - */ -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/has/c_attribute.h" -#include "ruby/impl/has/cpp_attribute.h" - -/** Wraps (or simulates) `[[maybe_unused]]` */ -#if RBIMPL_HAS_CPP_ATTRIBUTE(maybe_unused) -# define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]] -#elif RBIMPL_HAS_C_ATTRIBUTE(maybe_unused) -# define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]] -#elif RBIMPL_HAS_ATTRIBUTE(unused) -# define RBIMPL_ATTR_MAYBE_UNUSED() __attribute__((__unused__)) -#else -# define RBIMPL_ATTR_MAYBE_UNUSED() /* void */ -#endif - -#endif /* RBIMPL_ATTR_MAYBE_UNUSED */ diff --git a/include/ruby/impl/attr/noalias.h b/include/ruby/impl/attr/noalias.h deleted file mode 100644 index 0180d0c4ec..0000000000 --- a/include/ruby/impl/attr/noalias.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef RBIMPL_ATTR_NOALIAS_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_NOALIAS_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_NOALIAS. - * - * ### Q&A ### - * - * - Q: There are seemingly similar attributes named #RBIMPL_ATTR_CONST, - * #RBIMPL_ATTR_PURE, and #RBIMPL_ATTR_NOALIAS. What are the difference? - * - * - A: Allowed operations are different. - * - * - #RBIMPL_ATTR_CONST ... Functions attributed by this are not allowed to - * read/write _any_ pointers at all (there are exceptional situations - * when reading a pointer is possible but forget that; they are too - * exceptional to be useful). Just remember that everything pointer- - * related are NG. - * - * - #RBIMPL_ATTR_PURE ... Functions attributed by this can read any - * nonvolatile pointers, but no writes are allowed at all. The ability - * to read _any_ nonvolatile pointers makes it possible to mark ::VALUE- - * taking functions as being pure, as long as they are read-only. - * - * - #RBIMPL_ATTR_NOALIAS ... Can both read/write, but only through - * pointers passed to the function as parameters. This is a typical - * situation when you create a C++ non-static member function which only - * concerns `this`. No global variables are allowed to read/write. So - * this is not a super-set of being pure. If you want to read something, - * that has to be passed to the function as a pointer. ::VALUE -taking - * functions thus cannot be attributed as such. - */ -#include "ruby/impl/has/declspec_attribute.h" - -/** Wraps (or simulates) `__declspec((noalias))` */ -#if RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noalias) -# define RBIMPL_ATTR_NOALIAS() __declspec(noalias) -#else -# define RBIMPL_ATTR_NOALIAS() /* void */ -#endif - -#endif /* RBIMPL_ATTR_NOALIAS_H */ diff --git a/include/ruby/impl/attr/nodiscard.h b/include/ruby/impl/attr/nodiscard.h deleted file mode 100644 index ee3a1347df..0000000000 --- a/include/ruby/impl/attr/nodiscard.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef RBIMPL_ATTR_NODISCARD_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_NODISCARD_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_NODISCARD. - */ -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/has/c_attribute.h" -#include "ruby/impl/has/cpp_attribute.h" - -/** - * Wraps (or simulates) `[[nodiscard]]`. In C++ (at least since C++20) a - * nodiscard attribute can have a message why the result shall not be ignoed. - * However GCC attribute and SAL annotation cannot take them. - */ -#if RBIMPL_HAS_CPP_ATTRIBUTE(nodiscard) -# define RBIMPL_ATTR_NODISCARD() [[nodiscard]] -#elif RBIMPL_HAS_C_ATTRIBUTE(nodiscard) -# define RBIMPL_ATTR_NODISCARD() [[nodiscard]] -#elif RBIMPL_HAS_ATTRIBUTE(warn_unused_result) -# define RBIMPL_ATTR_NODISCARD() __attribute__((__warn_unused_result__)) -#elif defined(_Check_return_) -# /* Take SAL definition. */ -# define RBIMPL_ATTR_NODISCARD() _Check_return_ -#else -# define RBIMPL_ATTR_NODISCARD() /* void */ -#endif - -#endif /* RBIMPL_ATTR_NODISCARD_H */ diff --git a/include/ruby/impl/attr/noexcept.h b/include/ruby/impl/attr/noexcept.h deleted file mode 100644 index ac0ec4c10d..0000000000 --- a/include/ruby/impl/attr/noexcept.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef RBIMPL_ATTR_NOEXCEPT_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_NOEXCEPT_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_NOEXCEPT. - * - * This isn't actually an attribute in C++ but who cares... - * - * Mainly due to aesthetic reasons, this one is rarely used in the project. - * But can be handy on occasions, especially when a function's noexcept-ness - * depends on its calling functions. - * - * ### Q&A ### - * - * - Q: Can a function that raises Ruby exceptions be attributed `noexcept`? - * - * - A: Yes. `noexcept` is about C++ exceptions, not Ruby's. They don't - * interface each other. You can safely attribute a function that raises - * Ruby exceptions as `noexcept`. - * - * - Q: How, then, can I assert that a function I wrote doesn't raise any Ruby - * exceptions? - * - * - A: `__attribute__((__leaf__))` is for that purpose. A function attributed - * as leaf can still throw C++ exceptions, but not Ruby's. Note however, - * that it's extremely difficult -- if not impossible -- to assert that a - * function doesn't raise any Ruby exceptions at all. Use of that - * attribute is not recommended; mere mortals can't properly use that by - * hand. - * - * - Q: Does it make sense to attribute an inline function `noexcept`? - * - * - A: I thought so before. But no, I don't think they are useful any longer. - * - * - When an inline function attributed `noexcept` actually doesn't throw - * any exceptions at all: these days I don't see any difference in - * generated assembly by adding/removing this attribute. C++ compilers - * get smarter and smarter. Today they can infer if it actually throws - * or not without any annotations by humans (correct me if I'm wrong). - * - * - When an inline function attributed `noexcepr` actually _does_ throw an - * exception: they have to call `std::terminate` then (C++ standard - * mandates so). This means exception handling routines are actually - * enforced, not omitted. This doesn't impact runtime performance (The - * Itanium C++ ABI has zero-cost exception handling), but does impact on - * generated binary size. This is bad. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/feature.h" - -/** Wraps (or simulates) C++11 `noexcept` */ -#if ! defined(__cplusplus) -# /* Doesn't make sense. */ -# define RBIMPL_ATTR_NOEXCEPT(_) /* void */ - -#elif RBIMPL_HAS_FEATURE(cxx_noexcept) -# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__ -# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif defined(__INTEL_CXX11_MODE__) -# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif RBIMPL_COMPILER_SINCE(MSVC, 19, 0, 0) -# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif __cplusplus >= 201103L -# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#else -# define RBIMPL_ATTR_NOEXCEPT(_) /* void */ -#endif - -#endif /* RBIMPL_ATTR_NOEXCEPT_H */ diff --git a/include/ruby/impl/attr/noinline.h b/include/ruby/impl/attr/noinline.h deleted file mode 100644 index c2cc007969..0000000000 --- a/include/ruby/impl/attr/noinline.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef RBIMPL_ATTR_NOINLINE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_NOINLINE_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_NOINLINE. - */ -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/has/declspec_attribute.h" - -/** Wraps (or simulates) `__declspec(noinline)` */ -#if RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noinline) -# define RBIMPL_ATTR_NOINLINE() __declspec(noinline) -#elif RBIMPL_HAS_ATTRIBUTE(noinline) -# define RBIMPL_ATTR_NOINLINE() __attribute__((__noinline__)) -#else -# define RBIMPL_ATTR_NOINLINE() /* void */ -#endif - -#endif /* RBIMPL_ATTR_NOINLINE_H */ diff --git a/include/ruby/impl/attr/nonnull.h b/include/ruby/impl/attr/nonnull.h deleted file mode 100644 index a1d0320e1d..0000000000 --- a/include/ruby/impl/attr/nonnull.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RBIMPL_ATTR_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_NONNULL_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_NONNULL. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((nonnull))` */ -#if RBIMPL_HAS_ATTRIBUTE(nonnull) -# define RBIMPL_ATTR_NONNULL(list) __attribute__((__nonnull__ list)) -#else -# define RBIMPL_ATTR_NONNULL(list) /* void */ -#endif - -#endif /* RBIMPL_ATTR_NONNULL_H */ diff --git a/include/ruby/impl/attr/noreturn.h b/include/ruby/impl/attr/noreturn.h deleted file mode 100644 index 66a9b42947..0000000000 --- a/include/ruby/impl/attr/noreturn.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef RBIMPL_ATTR_NORETURN_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_NORETURN_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_NORETURN. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/has/cpp_attribute.h" -#include "ruby/impl/has/declspec_attribute.h" - -/** Wraps (or simulates) `[[noreturn]]` */ -#if RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RBIMPL_ATTR_NORETURN() _Pragma("does_not_return") - -#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noreturn) -# define RBIMPL_ATTR_NORETURN() __declspec(noreturn) - -#elif RBIMPL_HAS_ATTRIBUTE(noreturn) -# define RBIMPL_ATTR_NORETURN() __attribute__((__noreturn__)) - -#elif RBIMPL_HAS_CPP_ATTRIBUTE(noreturn) -# define RBIMPL_ATTR_NORETURN() [[noreturn]] - -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112) -# define RBIMPL_ATTR_NORETURN() _Noreturn - -#elif defined(_Noreturn) -# /* glibc <sys/cdefs.h> has this macro. */ -# define RBIMPL_ATTR_NORETURN() _Noreturn - -#else -# define RBIMPL_ATTR_NORETURN() /* void */ -#endif - -#endif /* RBIMPL_ATTR_NORETURN_H */ diff --git a/include/ruby/impl/attr/pure.h b/include/ruby/impl/attr/pure.h deleted file mode 100644 index a5bb51b76f..0000000000 --- a/include/ruby/impl/attr/pure.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef RBIMPL_ATTR_PURE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_PURE_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_PURE. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/attribute.h" -#include "ruby/assert.h" - -/** Wraps (or simulates) `__attribute__((pure))` */ -#if RBIMPL_HAS_ATTRIBUTE(pure) -# define RBIMPL_ATTR_PURE() __attribute__((__pure__)) -#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RBIMPL_ATTR_PURE() _Pragma("does_not_write_global_data") -#else -# define RBIMPL_ATTR_PURE() /* void */ -#endif - -/** Enables #RBIMPL_ATTR_PURE iff. #RUBY_NDEBUG. */ -#if RUBY_NDEBUG -# define RBIMPL_ATTR_PURE_ON_NDEBUG() RBIMPL_ATTR_PURE() -#else -# define RBIMPL_ATTR_PURE_ON_NDEBUG() /* void */ -#endif - -#endif /* RBIMPL_ATTR_PURE_H */ diff --git a/include/ruby/impl/attr/restrict.h b/include/ruby/impl/attr/restrict.h deleted file mode 100644 index 518906f6da..0000000000 --- a/include/ruby/impl/attr/restrict.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef RBIMPL_ATTR_RESTRICT_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_RESTRICT_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_RESTRICT. - */ -#include "ruby/impl/compiler_since.h" -#include "ruby/impl/has/attribute.h" -#include "ruby/impl/token_paste.h" - -/* :FIXME: config.h includes conflicting `#define restrict`. MSVC can be - * detected using `RBIMPL_COMPILER_SINCE()`, but Clang & family cannot use - * `__has_declspec_attribute()` which involves macro substitution. */ - -/** Wraps (or simulates) `__declspec(restrict)` */ -#if RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0) -# define RBIMPL_ATTR_RESTRICT() __declspec(RBIMPL_TOKEN_PASTE(re, strict)) - -#elif RBIMPL_HAS_ATTRIBUTE(malloc) -# define RBIMPL_ATTR_RESTRICT() __attribute__((__malloc__)) - -#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RBIMPL_ATTR_RESTRICT() _Pragma("returns_new_memory") - -#else -# define RBIMPL_ATTR_RESTRICT() /* void */ -#endif - -#endif /* RBIMPL_ATTR_RESTRICT_H */ diff --git a/include/ruby/impl/attr/returns_nonnull.h b/include/ruby/impl/attr/returns_nonnull.h deleted file mode 100644 index f656d70c8c..0000000000 --- a/include/ruby/impl/attr/returns_nonnull.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RBIMPL_ATTR_RETURNS_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_RETURNS_NONNULL_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_RETURNS_NONNULL. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((returns_nonnull))` */ -#if defined(_Ret_nonnull_) -# /* Take SAL definition. */ -# define RBIMPL_ATTR_RETURNS_NONNULL() _Ret_nonnull_ - -#elif RBIMPL_HAS_ATTRIBUTE(returns_nonnull) -# define RBIMPL_ATTR_RETURNS_NONNULL() __attribute__((__returns_nonnull__)) - -#else -# define RBIMPL_ATTR_RETURNS_NONNULL() /* void */ -#endif - -#endif /* RBIMPL_ATTR_RETURNS_NONNULL_H */ diff --git a/include/ruby/impl/attr/warning.h b/include/ruby/impl/attr/warning.h deleted file mode 100644 index e7585e0417..0000000000 --- a/include/ruby/impl/attr/warning.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RBIMPL_ATTR_WARNING_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_WARNING_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_WARNING. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((warning))` */ -#if RBIMPL_HAS_ATTRIBUTE(warning) -# define RBIMPL_ATTR_WARNING(msg) __attribute__((__warning__ msg)) -#else -# define RBIMPL_ATTR_WARNING(msg) /* void */ -#endif - -#endif /* RBIMPL_ATTR_WARNING_H */ diff --git a/include/ruby/impl/attr/weakref.h b/include/ruby/impl/attr/weakref.h deleted file mode 100644 index 769ce017e0..0000000000 --- a/include/ruby/impl/attr/weakref.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RBIMPL_ATTR_WEAKREF_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RBIMPL_ATTR_WEAKREF_H -/** - * @file - * @author Ruby developers <[email protected]> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Defines #RBIMPL_ATTR_WEAKREF. - */ -#include "ruby/impl/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((weakref))` */ -#if RBIMPL_HAS_ATTRIBUTE(weakref) -# define RBIMPL_ATTR_WEAKREF(sym) __attribute__((__weakref__(# sym))) -#else -# define RBIMPL_ATTR_WEAKREF(sym) /* void */ -#endif - -#endif /* RBIMPL_ATTR_WEAKREF_H */ |