diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-05-04 15:26:12 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-05-11 09:24:08 +0900 |
commit | dca234a5dc9d5bb39c906d833c43305ce95508fb (patch) | |
tree | aeecc73da2a3f9e6d2417fc9fd57e80ff0d2540a /include/ruby/3/attr | |
parent | c89c3801b985916b6fb6726aab966d28371dfaaa (diff) |
mv include/ruby/{3,impl}
Devs do not love "3".
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3079
Diffstat (limited to 'include/ruby/3/attr')
24 files changed, 0 insertions, 1062 deletions
diff --git a/include/ruby/3/attr/alloc_size.h b/include/ruby/3/attr/alloc_size.h deleted file mode 100644 index 5d4ece08a1..0000000000 --- a/include/ruby/3/attr/alloc_size.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RUBY3_ATTR_ALLOC_SIZE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_ALLOC_SIZE_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_ALLOC_SIZE. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((alloc_size))` */ -#if RUBY3_HAS_ATTRIBUTE(alloc_size) -# define RUBY3_ATTR_ALLOC_SIZE(tuple) __attribute__((__alloc_size__ tuple)) -#else -# define RUBY3_ATTR_ALLOC_SIZE(tuple) /* void */ -#endif - -#endif /* RUBY3_ATTR_ALLOC_SIZE_H */ diff --git a/include/ruby/3/attr/artificial.h b/include/ruby/3/attr/artificial.h deleted file mode 100644 index f5450e3467..0000000000 --- a/include/ruby/3/attr/artificial.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef RUBY3_ATTR_ARTIFICIAL_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_ARTIFICIAL_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_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/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((artificial))` */ -#if RUBY3_HAS_ATTRIBUTE(artificial) -# define RUBY3_ATTR_ARTIFICIAL() __attribute__((__artificial__)) -#else -# define RUBY3_ATTR_ARTIFICIAL() /* void */ -#endif - -#endif /* RUBY3_ATTR_ARTIFICIAL_H */ diff --git a/include/ruby/3/attr/cold.h b/include/ruby/3/attr/cold.h deleted file mode 100644 index 3822f0a975..0000000000 --- a/include/ruby/3/attr/cold.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RUBY3_ATTR_COLD_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_COLD_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_COLD. - */ -#include "ruby/3/compiler_is.h" -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((cold))` */ -#if RUBY3_COMPILER_IS(SunPro) -# /* Recent SunPro has __has_attribute, and is borken. */ -# /* It reports it has attribute cold, reality isn't (warnings issued). */ -# define RUBY3_ATTR_COLD() /* void */ -#elif RUBY3_HAS_ATTRIBUTE(cold) -# define RUBY3_ATTR_COLD() __attribute__((__cold__)) -#else -# define RUBY3_ATTR_COLD() /* void */ -#endif - -#endif /* RUBY3_ATTR_COLD_H */ diff --git a/include/ruby/3/attr/const.h b/include/ruby/3/attr/const.h deleted file mode 100644 index 6c36e9aab2..0000000000 --- a/include/ruby/3/attr/const.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef RUBY3_ATTR_CONST_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_CONST_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_CONST. - */ -#include "ruby/3/compiler_since.h" -#include "ruby/3/has/attribute.h" -#include "ruby/3/has/declspec_attribute.h" - -/** Wraps (or simulates) `__attribute__((const))` */ -#if RUBY3_HAS_ATTRIBUTE(const) -# define RUBY3_ATTR_CONST() __attribute__((__const__)) -#elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(noalias) -# /* If a function can be a const, that is also a noalias. */ -# define RUBY3_ATTR_CONST() __declspec(noalias) -#elif RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RUBY3_ATTR_CONST() _Pragma("no_side_effect") -#else -# define RUBY3_ATTR_CONST() /* void */ -#endif - -/** Enables #RUBY3_ATTR_CONST iff. #RUBY_NDEBUG. */ -#if RUBY_NDEBUG -# define RUBY3_ATTR_CONST_ON_NDEBUG() RUBY3_ATTR_CONST() -#else -# define RUBY3_ATTR_CONST_ON_NDEBUG() /* void */ -#endif - -#endif /* RUBY3_ATTR_CONST_H */ diff --git a/include/ruby/3/attr/constexpr.h b/include/ruby/3/attr/constexpr.h deleted file mode 100644 index 576ec7fb8f..0000000000 --- a/include/ruby/3/attr/constexpr.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef RUBY3_ATTR_CONSTEXPR_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_CONSTEXPR_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_CONSTEXPR. - */ -#include "ruby/3/has/feature.h" -#include "ruby/3/compiler_is.h" -#include "ruby/3/token_paste.h" - -/** @cond INTERNAL_MACRO */ -#if ! defined(__cplusplus) -# /* Makes no sense. */ -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 0 -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 0 - -#elif defined(__cpp_constexpr) -# /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */ -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 (__cpp_constexpr >= 200704L) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 (__cpp_constexpr >= 201304L) - -#elif RUBY3_COMPILER_SINCE(MSVC, 19, 0, 0) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 RUBY3_COMPILER_SINCE(MSVC, 19, 00, 00) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 RUBY3_COMPILER_SINCE(MSVC, 19, 11, 00) - -#elif RUBY3_COMPILER_SINCE(SunPro, 5, 13, 0) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 (__cplusplus >= 201103L) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 (__cplusplus >= 201402L) - -#elif RUBY3_COMPILER_SINCE(GCC, 4, 9, 0) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 (__cplusplus >= 201103L) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 (__cplusplus >= 201402L) - -#elif RUBY3_HAS_FEATURE(cxx_relaxed_constexpr) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 1 -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 1 - -#elif RUBY3_HAS_FEATURE(cxx_constexpr) -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 1 -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 0 - -#else -# /* :FIXME: icpc must have constexpr but don't know how to detect. */ -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX11 0 -# define RUBY3_HAS_ATTR_CONSTEXPR_CXX14 0 -#endif -/** @endcond */ - -/** Wraps (or simulates) C++11 `constexpr`. */ -#if RUBY3_HAS_ATTR_CONSTEXPR_CXX14 -# define RUBY3_ATTR_CONSTEXPR(_) constexpr - -#elif RUBY3_HAS_ATTR_CONSTEXPR_CXX11 -# define RUBY3_ATTR_CONSTEXPR(_) RUBY3_TOKEN_PASTE(RUBY3_ATTR_CONSTEXPR_, _) -# define RUBY3_ATTR_CONSTEXPR_CXX11 constexpr -# define RUBY3_ATTR_CONSTEXPR_CXX14 /* void */ - -#else -# define RUBY3_ATTR_CONSTEXPR(_) /* void */ -#endif - -/** Enables #RUBY3_ATTR_CONSTEXPR iff. #RUBY_NDEBUG. */ -#if RUBY_NDEBUG -# define RUBY3_ATTR_CONSTEXPR_ON_NDEBUG(_) RUBY3_ATTR_CONSTEXPR(_) -#else -# define RUBY3_ATTR_CONSTEXPR_ON_NDEBUG(_) /* void */ -#endif - -#endif /* RUBY3_ATTR_CONSTEXPR_H */ diff --git a/include/ruby/3/attr/deprecated.h b/include/ruby/3/attr/deprecated.h deleted file mode 100644 index 5c3f508ffc..0000000000 --- a/include/ruby/3/attr/deprecated.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef RUBY3_ATTR_DEPRECATED_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_DEPRECATED_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_DEPRECATED. - */ -#include "ruby/3/compiler_since.h" -#include "ruby/3/has/attribute.h" -#include "ruby/3/has/c_attribute.h" -#include "ruby/3/has/cpp_attribute.h" -#include "ruby/3/has/declspec_attribute.h" -#include "ruby/3/has/extension.h" - -/** Wraps (or simulates) `[[deprecated]]` */ -#if RUBY3_HAS_EXTENSION(attribute_deprecated_with_message) -# define RUBY3_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) - -#elif RUBY3_COMPILER_SINCE(GCC, 4, 5, 0) -# define RUBY3_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) - -#elif RUBY3_COMPILER_SINCE(Intel, 13, 0, 0) -# define RUBY3_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg)) - -#elif RUBY3_HAS_ATTRIBUTE(deprecated) /* but not with message. */ -# define RUBY3_ATTR_DEPRECATED(msg) __attribute__((__deprecated__)) - -#elif RUBY3_COMPILER_SINCE(MSVC, 14, 0, 0) -# define RUBY3_ATTR_DEPRECATED(msg) __declspec(deprecated msg) - -#elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(deprecated) -# define RUBY3_ATTR_DEPRECATED(msg) __declspec(deprecated) - -#elif RUBY3_HAS_CPP_ATTRIBUTE(deprecated) -# define RUBY3_ATTR_DEPRECATED(msg) [[deprecated msg]] - -#elif RUBY3_HAS_C_ATTRIBUTE(deprecated) -# define RUBY3_ATTR_DEPRECATED(msg) [[deprecated msg]] - -#else -# define RUBY3_ATTR_DEPRECATED(msg) /* void */ -#endif - -#endif /* RUBY3_ATTR_DEPRECATED_H */ diff --git a/include/ruby/3/attr/diagnose_if.h b/include/ruby/3/attr/diagnose_if.h deleted file mode 100644 index 2f09abc94d..0000000000 --- a/include/ruby/3/attr/diagnose_if.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef RUBY3_ATTR_DIAGNOSE_IF_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_DIAGNOSE_IF_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_DIAGNOSE_IF. - */ -#include "ruby/3/has/attribute.h" -#include "ruby/3/warning_push.h" - -/** Wraps (or simulates) `__attribute__((diagnose_if))` */ -#if RUBY3_COMPILER_BEFORE(Clang, 5, 0, 0) -# /* https://bugs.llvm.org/show_bug.cgi?id=34319 */ -# define RUBY3_ATTR_DIAGNOSE_IF(_, __, ___) /* void */ - -#elif RUBY3_HAS_ATTRIBUTE(diagnose_if) -# define RUBY3_ATTR_DIAGNOSE_IF(_, __, ___) \ - RUBY3_WARNING_PUSH() \ - RUBY3_WARNING_IGNORED(-Wgcc-compat) \ - __attribute__((__diagnose_if__(_, __, ___))) \ - RUBY3_WARNING_POP() - -#else -# define RUBY3_ATTR_DIAGNOSE_IF(_, __, ___) /* void */ -#endif - -#endif /* RUBY3_ATTR_DIAGNOSE_IF_H */ diff --git a/include/ruby/3/attr/enum_extensibility.h b/include/ruby/3/attr/enum_extensibility.h deleted file mode 100644 index 15a5b063f2..0000000000 --- a/include/ruby/3/attr/enum_extensibility.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RUBY3_ATTR_ENUM_EXTENSIBILITY_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_ENUM_EXTENSIBILITY_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_ENUM_EXTENSIBILITY. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((enum_extensibility))` */ -#if RUBY3_HAS_ATTRIBUTE(enum_extensibility) -# define RUBY3_ATTR_ENUM_EXTENSIBILITY(_) __attribute__((__enum_extensibility__(_))) -#else -# define RUBY3_ATTR_ENUM_EXTENSIBILITY(_) /* void */ -#endif - -#endif /* RUBY3_ATTR_ENUM_EXTENSIBILITY_H */ diff --git a/include/ruby/3/attr/error.h b/include/ruby/3/attr/error.h deleted file mode 100644 index 53628259a0..0000000000 --- a/include/ruby/3/attr/error.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RUBY3_ATTR_ERROR_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_ERROR_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_ERROR. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((error))` */ -#if RUBY3_HAS_ATTRIBUTE(error) -# define RUBY3_ATTR_ERROR(msg) __attribute__((__error__ msg)) -#else -# define RUBY3_ATTR_ERROR(msg) /* void */ -#endif - -#endif /* RUBY3_ATTR_ERROR_H */ diff --git a/include/ruby/3/attr/flag_enum.h b/include/ruby/3/attr/flag_enum.h deleted file mode 100644 index 2081c9c3ed..0000000000 --- a/include/ruby/3/attr/flag_enum.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RUBY3_ATTR_FLAG_ENUM_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_FLAG_ENUM_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_FLAG_ENUM. - * @see https://clang.llvm.org/docs/AttributeReference.html#flag_enum - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((flag_enum)` */ -#if RUBY3_HAS_ATTRIBUTE(flag_enum) -# define RUBY3_ATTR_FLAG_ENUM() __attribute__((__flag_enum__)) -#else -# define RUBY3_ATTR_FLAG_ENUM() /* void */ -#endif - -#endif /* RUBY3ATTR_FLAG_ENUM_H */ diff --git a/include/ruby/3/attr/forceinline.h b/include/ruby/3/attr/forceinline.h deleted file mode 100644 index bd622eddce..0000000000 --- a/include/ruby/3/attr/forceinline.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef RUBY3_ATTR_FORCEINLINE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_FORCEINLINE_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_FORCEINLINE. - */ -#include "ruby/3/compiler_since.h" -#include "ruby/3/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 RUBY3_COMPILER_SINCE(MSVC, 12, 0, 0) -# define RUBY3_ATTR_FORCEINLINE() __forceinline -#elif RUBY3_HAS_ATTRIBUTE(always_inline) -# define RUBY3_ATTR_FORCEINLINE() __attribute__((__always_inline__)) inline -#else -# define RUBY3_ATTR_FORCEINLINE() inline -#endif - -#endif /* RUBY3_ATTR_FORCEINLINE_H */ diff --git a/include/ruby/3/attr/format.h b/include/ruby/3/attr/format.h deleted file mode 100644 index 2624179bda..0000000000 --- a/include/ruby/3/attr/format.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef RUBY3_ATTR_FORMAT_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_FORMAT_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_FORMAT. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((format))` */ -#if RUBY3_HAS_ATTRIBUTE(format) -# define RUBY3_ATTR_FORMAT(x, y, z) __attribute__((__format__(x, y, z))) -#else -# define RUBY3_ATTR_FORMAT(x, y, z) /* void */ -#endif - -#if defined(__MINGW_PRINTF_FORMAT) -# define RUBY3_PRINTF_FORMAT __MINGW_PRINTF_FORMAT -#else -# define RUBY3_PRINTF_FORMAT __printf__ -#endif - -#endif /* RUBY3_ATTR_FORMAT_H */ diff --git a/include/ruby/3/attr/maybe_unused.h b/include/ruby/3/attr/maybe_unused.h deleted file mode 100644 index 71904dffa4..0000000000 --- a/include/ruby/3/attr/maybe_unused.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef RUBY3_ATTR_MAYBE_UNUSED_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_MAYBE_UNUSED_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_MAYBE_UNUSED. - */ -#include "ruby/3/has/attribute.h" -#include "ruby/3/has/c_attribute.h" -#include "ruby/3/has/cpp_attribute.h" - -/** Wraps (or simulates) `[[maybe_unused]]` */ -#if RUBY3_HAS_CPP_ATTRIBUTE(maybe_unused) -# define RUBY3_ATTR_MAYBE_UNUSED() [[maybe_unused]] -#elif RUBY3_HAS_C_ATTRIBUTE(maybe_unused) -# define RUBY3_ATTR_MAYBE_UNUSED() [[maybe_unused]] -#elif RUBY3_HAS_ATTRIBUTE(unused) -# define RUBY3_ATTR_MAYBE_UNUSED() __attribute__((__unused__)) -#else -# define RUBY3_ATTR_MAYBE_UNUSED() /* void */ -#endif - -#endif /* RUBY3_ATTR_MAYBE_UNUSED */ diff --git a/include/ruby/3/attr/noalias.h b/include/ruby/3/attr/noalias.h deleted file mode 100644 index 49ad11999d..0000000000 --- a/include/ruby/3/attr/noalias.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef RUBY3_ATTR_NOALIAS_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_NOALIAS_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_NOALIAS. - * - * ### Q&A ### - * - * - Q: There are seemingly similar attributes named #RUBY3_ATTR_CONST, - * #RUBY3_ATTR_PURE, and #RUBY3_ATTR_NOALIAS. What are the difference? - * - * - A: Allowed operations are different. - * - * - #RUBY3_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. - * - * - #RUBY3_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. - * - * - #RUBY3_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/3/has/declspec_attribute.h" - -/** Wraps (or simulates) `__declspec((noalias))` */ -#if RUBY3_HAS_DECLSPEC_ATTRIBUTE(noalias) -# define RUBY3_ATTR_NOALIAS() __declspec(noalias) -#else -# define RUBY3_ATTR_NOALIAS() /* void */ -#endif - -#endif /* RUBY3_ATTR_NOALIAS_H */ diff --git a/include/ruby/3/attr/nodiscard.h b/include/ruby/3/attr/nodiscard.h deleted file mode 100644 index 6168bb9002..0000000000 --- a/include/ruby/3/attr/nodiscard.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef RUBY3_ATTR_NODISCARD_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_NODISCARD_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_NODISCARD. - */ -#include "ruby/3/has/attribute.h" -#include "ruby/3/has/c_attribute.h" -#include "ruby/3/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 RUBY3_HAS_CPP_ATTRIBUTE(nodiscard) -# define RUBY3_ATTR_NODISCARD() [[nodiscard]] -#elif RUBY3_HAS_C_ATTRIBUTE(nodiscard) -# define RUBY3_ATTR_NODISCARD() [[nodiscard]] -#elif RUBY3_HAS_ATTRIBUTE(warn_unused_result) -# define RUBY3_ATTR_NODISCARD() __attribute__((__warn_unused_result__)) -#elif defined(_Check_return_) -# /* Take SAL definition. */ -# define RUBY3_ATTR_NODISCARD() _Check_return_ -#else -# define RUBY3_ATTR_NODISCARD() /* void */ -#endif - -#endif /* RUBY3_ATTR_NODISCARD_H */ diff --git a/include/ruby/3/attr/noexcept.h b/include/ruby/3/attr/noexcept.h deleted file mode 100644 index aff3b2cb1b..0000000000 --- a/include/ruby/3/attr/noexcept.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef RUBY3_ATTR_NOEXCEPT_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_NOEXCEPT_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_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/3/compiler_since.h" -#include "ruby/3/has/feature.h" - -/** Wraps (or simulates) C++11 `noexcept` */ -#if ! defined(__cplusplus) -# /* Doesn't make sense. */ -# define RUBY3_ATTR_NOEXCEPT(_) /* void */ - -#elif RUBY3_HAS_FEATURE(cxx_noexcept) -# define RUBY3_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__ -# define RUBY3_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif defined(__INTEL_CXX11_MODE__) -# define RUBY3_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif RUBY3_COMPILER_SINCE(MSVC, 19, 0, 0) -# define RUBY3_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#elif __cplusplus >= 201103L -# define RUBY3_ATTR_NOEXCEPT(_) noexcept(noexcept(_)) - -#else -# define RUBY3_ATTR_NOEXCEPT(_) /* void */ -#endif - -#endif /* RUBY3_ATTR_NOEXCEPT_H */ diff --git a/include/ruby/3/attr/noinline.h b/include/ruby/3/attr/noinline.h deleted file mode 100644 index 4437f8a32f..0000000000 --- a/include/ruby/3/attr/noinline.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef RUBY3_ATTR_NOINLINE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_NOINLINE_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_NOINLINE. - */ -#include "ruby/3/has/attribute.h" -#include "ruby/3/has/declspec_attribute.h" - -/** Wraps (or simulates) `__declspec(noinline)` */ -#if RUBY3_HAS_DECLSPEC_ATTRIBUTE(noinline) -# define RUBY3_ATTR_NOINLINE() __declspec(noinline) -#elif RUBY3_HAS_ATTRIBUTE(noinline) -# define RUBY3_ATTR_NOINLINE() __attribute__((__noinline__)) -#else -# define RUBY3_ATTR_NOINLINE() /* void */ -#endif - -#endif /* RUBY3_ATTR_NOINLINE_H */ diff --git a/include/ruby/3/attr/nonnull.h b/include/ruby/3/attr/nonnull.h deleted file mode 100644 index 01b5820c1b..0000000000 --- a/include/ruby/3/attr/nonnull.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RUBY3_ATTR_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_NONNULL_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_NONNULL. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((nonnull))` */ -#if RUBY3_HAS_ATTRIBUTE(nonnull) -# define RUBY3_ATTR_NONNULL(list) __attribute__((__nonnull__ list)) -#else -# define RUBY3_ATTR_NONNULL(list) /* void */ -#endif - -#endif /* RUBY3_ATTR_NONNULL_H */ diff --git a/include/ruby/3/attr/noreturn.h b/include/ruby/3/attr/noreturn.h deleted file mode 100644 index 999a76b8e5..0000000000 --- a/include/ruby/3/attr/noreturn.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef RUBY3_ATTR_NORETURN_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_NORETURN_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_NORETURN. - */ -#include "ruby/3/compiler_since.h" -#include "ruby/3/has/attribute.h" -#include "ruby/3/has/cpp_attribute.h" -#include "ruby/3/has/declspec_attribute.h" - -/** Wraps (or simulates) `[[noreturn]]` */ -#if RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RUBY3_ATTR_NORETURN() _Pragma("does_not_return") - -#elif RUBY3_HAS_DECLSPEC_ATTRIBUTE(noreturn) -# define RUBY3_ATTR_NORETURN() __declspec(noreturn) - -#elif RUBY3_HAS_ATTRIBUTE(noreturn) -# define RUBY3_ATTR_NORETURN() __attribute__((__noreturn__)) - -#elif RUBY3_HAS_CPP_ATTRIBUTE(noreturn) -# define RUBY3_ATTR_NORETURN() [[noreturn]] - -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112) -# define RUBY3_ATTR_NORETURN() _Noreturn - -#elif defined(_Noreturn) -# /* glibc <sys/cdefs.h> has this macro. */ -# define RUBY3_ATTR_NORETURN() _Noreturn - -#else -# define RUBY3_ATTR_NORETURN() /* void */ -#endif - -#endif /* RUBY3_ATTR_NORETURN_H */ diff --git a/include/ruby/3/attr/pure.h b/include/ruby/3/attr/pure.h deleted file mode 100644 index b9ab3622ca..0000000000 --- a/include/ruby/3/attr/pure.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef RUBY3_ATTR_PURE_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_PURE_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_PURE. - */ -#include "ruby/3/compiler_since.h" -#include "ruby/3/has/attribute.h" -#include "ruby/assert.h" - -/** Wraps (or simulates) `__attribute__((pure))` */ -#if RUBY3_HAS_ATTRIBUTE(pure) -# define RUBY3_ATTR_PURE() __attribute__((__pure__)) -#elif RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RUBY3_ATTR_PURE() _Pragma("does_not_write_global_data") -#else -# define RUBY3_ATTR_PURE() /* void */ -#endif - -/** Enables #RUBY3_ATTR_PURE iff. #RUBY_NDEBUG. */ -#if RUBY_NDEBUG -# define RUBY3_ATTR_PURE_ON_NDEBUG() RUBY3_ATTR_PURE() -#else -# define RUBY3_ATTR_PURE_ON_NDEBUG() /* void */ -#endif - -#endif /* RUBY3_ATTR_PURE_H */ diff --git a/include/ruby/3/attr/restrict.h b/include/ruby/3/attr/restrict.h deleted file mode 100644 index 95c85f45ce..0000000000 --- a/include/ruby/3/attr/restrict.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef RUBY3_ATTR_RESTRICT_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_RESTRICT_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_RESTRICT. - */ -#include "ruby/3/compiler_since.h" -#include "ruby/3/has/attribute.h" -#include "ruby/3/token_paste.h" - -/* :FIXME: config.h includes conflicting `#define restrict`. MSVC can be - * detected using `RUBY3_COMPILER_SINCE()`, but Clang & family cannot use - * `__has_declspec_attribute()` which involves macro substitution. */ - -/** Wraps (or simulates) `__declspec(restrict)` */ -#if RUBY3_COMPILER_SINCE(MSVC, 14, 0, 0) -# define RUBY3_ATTR_RESTRICT() __declspec(RUBY3_TOKEN_PASTE(re, strict)) - -#elif RUBY3_HAS_ATTRIBUTE(malloc) -# define RUBY3_ATTR_RESTRICT() __attribute__((__malloc__)) - -#elif RUBY3_COMPILER_SINCE(SunPro, 5, 10, 0) -# define RUBY3_ATTR_RESTRICT() _Pragma("returns_new_memory") - -#else -# define RUBY3_ATTR_RESTRICT() /* void */ -#endif - -#endif /* RUBY3_ATTR_RESTRICT_H */ diff --git a/include/ruby/3/attr/returns_nonnull.h b/include/ruby/3/attr/returns_nonnull.h deleted file mode 100644 index 786e7e72ee..0000000000 --- a/include/ruby/3/attr/returns_nonnull.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef RUBY3_ATTR_RETURNS_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_RETURNS_NONNULL_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_RETURNS_NONNULL. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((returns_nonnull))` */ -#if defined(_Ret_nonnull_) -# /* Take SAL definition. */ -# define RUBY3_ATTR_RETURNS_NONNULL() _Ret_nonnull_ - -#elif RUBY3_HAS_ATTRIBUTE(returns_nonnull) -# define RUBY3_ATTR_RETURNS_NONNULL() __attribute__((__returns_nonnull__)) - -#else -# define RUBY3_ATTR_RETURNS_NONNULL() /* void */ -#endif - -#endif /* RUBY3_ATTR_RETURNS_NONNULL_H */ diff --git a/include/ruby/3/attr/warning.h b/include/ruby/3/attr/warning.h deleted file mode 100644 index a83537e209..0000000000 --- a/include/ruby/3/attr/warning.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RUBY3_ATTR_WARNING_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_WARNING_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_WARNING. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((warning))` */ -#if RUBY3_HAS_ATTRIBUTE(warning) -# define RUBY3_ATTR_WARNING(msg) __attribute__((__warning__ msg)) -#else -# define RUBY3_ATTR_WARNING(msg) /* void */ -#endif - -#endif /* RUBY3_ATTR_WARNING_H */ diff --git a/include/ruby/3/attr/weakref.h b/include/ruby/3/attr/weakref.h deleted file mode 100644 index e9c38f92e7..0000000000 --- a/include/ruby/3/attr/weakref.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RUBY3_ATTR_WEAKREF_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ATTR_WEAKREF_H -/** - * @file - * @author Ruby developers <ruby-core@ruby-lang.org> - * @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 `RUBY3` or `ruby3` 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 #RUBY3_ATTR_WEAKREF. - */ -#include "ruby/3/has/attribute.h" - -/** Wraps (or simulates) `__attribute__((weakref))` */ -#if RUBY3_HAS_ATTRIBUTE(weakref) -# define RUBY3_ATTR_WEAKREF(sym) __attribute__((__weakref__(# sym))) -#else -# define RUBY3_ATTR_WEAKREF(sym) /* void */ -#endif - -#endif /* RUBY3_ATTR_WEAKREF_H */ |