[前][次][番号順一覧][スレッド一覧]

ruby-changes:65858

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 13 Apr 2021 14:30:41 +0900 (JST)
Subject: [ruby-changes:65858] f411fcd145 (master): get rid of #pragma GCC diagnostic ignored "-Wundef"

https://git.ruby-lang.org/ruby.git/commit/?id=f411fcd145

From f411fcd14587cfbf1efb86944134b993c04b050e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Fri, 9 Apr 2021 17:56:43 +0900
Subject: get rid of #pragma GCC diagnostic ignored "-Wundef"

Use of TOKEN_PASTE was a bad idea at the first place.  Just use ##
everywhere.  Nobody practically lacks token pasting.
---
 include/ruby/internal/attr/constexpr.h         |  2 +-
 include/ruby/internal/attr/restrict.h          |  2 +-
 include/ruby/internal/core/rdata.h             |  6 ++-
 include/ruby/internal/has/attribute.h          |  6 +--
 include/ruby/internal/has/builtin.h            |  4 +-
 include/ruby/internal/has/cpp_attribute.h      |  6 +--
 include/ruby/internal/has/declspec_attribute.h |  2 +-
 include/ruby/internal/token_paste.h            | 75 --------------------------
 8 files changed, 16 insertions(+), 87 deletions(-)
 delete mode 100644 include/ruby/internal/token_paste.h

diff --git a/include/ruby/internal/attr/constexpr.h b/include/ruby/internal/attr/constexpr.h
index dabb724..3e5feaf 100644
--- a/include/ruby/internal/attr/constexpr.h
+++ b/include/ruby/internal/attr/constexpr.h
@@ -67,7 +67,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/attr/constexpr.h#L67
 # 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(_) RBIMPL_ATTR_CONSTEXPR_ ## _
 # define RBIMPL_ATTR_CONSTEXPR_CXX11 constexpr
 # define RBIMPL_ATTR_CONSTEXPR_CXX14 /* void */
 
diff --git a/include/ruby/internal/attr/restrict.h b/include/ruby/internal/attr/restrict.h
index 3f4b7db..3c69312 100644
--- a/include/ruby/internal/attr/restrict.h
+++ b/include/ruby/internal/attr/restrict.h
@@ -30,7 +30,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/attr/restrict.h#L30
 
 /** Wraps (or simulates) `__declspec(restrict)` */
 #if RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0)
-# define RBIMPL_ATTR_RESTRICT() __declspec(RBIMPL_TOKEN_PASTE(re, strict))
+# define RBIMPL_ATTR_RESTRICT() __declspec(re ## strict)
 
 #elif RBIMPL_HAS_ATTRIBUTE(malloc)
 # define RBIMPL_ATTR_RESTRICT() __attribute__((__malloc__))
diff --git a/include/ruby/internal/core/rdata.h b/include/ruby/internal/core/rdata.h
index ca44a93..146c5f3 100644
--- a/include/ruby/internal/core/rdata.h
+++ b/include/ruby/internal/core/rdata.h
@@ -54,7 +54,8 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/core/rdata.h#L54
 
 #define RDATA(obj)                RBIMPL_CAST((struct RData *)(obj))
 #define DATA_PTR(obj)             RDATA(obj)->data
-#define RUBY_MACRO_SELECT         RBIMPL_TOKEN_PASTE
+#define RBIMPL_MACRO_SELECT(x, y) x ## y
+#define RUBY_MACRO_SELECT(x, y)   RBIMPL_MACRO_SELECT(x, y)
 #define RUBY_DEFAULT_FREE         RBIMPL_DATA_FUNC(-1)
 #define RUBY_NEVER_FREE           RBIMPL_DATA_FUNC(0)
 #define RUBY_UNTYPED_DATA_FUNC(f) f RBIMPL_ATTRSET_UNTYPED_DATA_FUNC()
@@ -174,11 +175,14 @@ rb_cData(void) https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/core/rdata.h#L175
 
 #define rb_data_object_wrap_0 rb_data_object_wrap
 #define rb_data_object_wrap_1 rb_data_object_wrap_warning
+#define rb_data_object_wrap_  rb_data_object_wrap_ /* Used here vvvv */
 #define rb_data_object_wrap   RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)
 #define rb_data_object_get_0  rb_data_object_get
 #define rb_data_object_get_1  rb_data_object_get_warning
+#define rb_data_object_get_   rb_data_object_get_ /* Used here vvvv */
 #define rb_data_object_get    RUBY_MACRO_SELECT(rb_data_object_get_, RUBY_UNTYPED_DATA_WARNING)
 #define rb_data_object_make_0 rb_data_object_make
 #define rb_data_object_make_1 rb_data_object_make_warning
+#define rb_data_object_make_  rb_data_object_make_ /* Used here vvvv */
 #define rb_data_object_make   RUBY_MACRO_SELECT(rb_data_object_make_, RUBY_UNTYPED_DATA_WARNING)
 #endif /* RBIMPL_RDATA_H */
diff --git a/include/ruby/internal/has/attribute.h b/include/ruby/internal/has/attribute.h
index 512f061..f5d9bbd 100644
--- a/include/ruby/internal/has/attribute.h
+++ b/include/ruby/internal/has/attribute.h
@@ -40,7 +40,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/attribute.h#L40
 #elif RBIMPL_COMPILER_IS(GCC)
 # /* GCC  <= 4  lack __has_attribute  predefined macro,  while have  attributes
 #  * themselves.  We can simulate the macro like the following: */
-# define RBIMPL_HAS_ATTRIBUTE(_) RBIMPL_TOKEN_PASTE(RBIMPL_HAS_ATTRIBUTE_, _)
+# define RBIMPL_HAS_ATTRIBUTE(_) (RBIMPL_HAS_ATTRIBUTE_ ## _)
 # define RBIMPL_HAS_ATTRIBUTE_aligned                    RBIMPL_COMPILER_SINCE(GCC, 0, 0, 0)
 # define RBIMPL_HAS_ATTRIBUTE_alloc_size                 RBIMPL_COMPILER_SINCE(GCC, 4, 3, 0)
 # define RBIMPL_HAS_ATTRIBUTE_artificial                 RBIMPL_COMPILER_SINCE(GCC, 4, 3, 0)
@@ -78,7 +78,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/attribute.h#L78
 # /* Oracle Solaris Studio 12.4 (cc version 5.11) introduced __has_attribute.
 #  * Before that, following attributes were available. */
 # /* See https://docs.oracle.com/cd/F24633_01/index.html */
-# define RBIMPL_HAS_ATTRIBUTE(_) RBIMPL_TOKEN_PASTE(RBIMPL_HAS_ATTRIBUTE_, _)
+# define RBIMPL_HAS_ATTRIBUTE(_) (RBIMPL_HAS_ATTRIBUTE_ ## _)
 # define RBIMPL_HAS_ATTRIBUTE_alias                      RBIMPL_COMPILER_SINCE(SunPro, 5,  9, 0)
 # define RBIMPL_HAS_ATTRIBUTE_aligned                    RBIMPL_COMPILER_SINCE(SunPro, 5,  9, 0)
 # define RBIMPL_HAS_ATTRIBUTE_always_inline              RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0)
@@ -101,7 +101,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/attribute.h#L101
 
 #else
 # /* Take config.h definition when available. */
-# define RBIMPL_HAS_ATTRIBUTE(_) (RBIMPL_TOKEN_PASTE(RBIMPL_HAS_ATTRIBUTE_, _)+0)
+# define RBIMPL_HAS_ATTRIBUTE(_) ((RBIMPL_HAS_ATTRIBUTE_ ## _)+0)
 # ifdef ALWAYS_INLINE
 #  define RBIMPL_HAS_ATTRIBUTE_always_inline 1
 # endif
diff --git a/include/ruby/internal/has/builtin.h b/include/ruby/internal/has/builtin.h
index 18cfc69..ece354a 100644
--- a/include/ruby/internal/has/builtin.h
+++ b/include/ruby/internal/has/builtin.h
@@ -47,7 +47,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/builtin.h#L47
 #  * __has_builtin  only  since  GCC  10.   This section  can  be  made  more
 #  * granular. */
 # /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970 */
-# define RBIMPL_HAS_BUILTIN(_) RBIMPL_TOKEN_PASTE(RBIMPL_HAS_BUILTIN_, _)
+# define RBIMPL_HAS_BUILTIN(_) (RBIMPL_HAS_BUILTIN_ ## _)
 # define RBIMPL_HAS_BUILTIN___builtin_add_overflow      RBIMPL_COMPILER_SINCE(GCC, 5, 1, 0)
 # define RBIMPL_HAS_BUILTIN___builtin_alloca            RBIMPL_COMPILER_SINCE(GCC, 0, 0, 0)
 # define RBIMPL_HAS_BUILTIN___builtin_alloca_with_align RBIMPL_COMPILER_SINCE(GCC, 6, 1, 0)
@@ -78,7 +78,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/builtin.h#L78
 
 #else
 # /* Take config.h definition when available */
-# define RBIMPL_HAS_BUILTIN(_) (RBIMPL_TOKEN_PASTE(RBIMPL_HAS_BUILTIN_, _)+0)
+# define RBIMPL_HAS_BUILTIN(_) ((RBIMPL_HAS_BUILTIN_ ## _)+0)
 # define RBIMPL_HAS_BUILTIN___builtin_add_overflow      HAVE_BUILTIN___BUILTIN_ADD_OVERFLOW
 # define RBIMPL_HAS_BUILTIN___builtin_alloca_with_align HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
 # define RBIMPL_HAS_BUILTIN___builtin_assume_aligned    HAVE_BUILTIN___BUILTIN_ASSUME_ALIGNED
diff --git a/include/ruby/internal/has/cpp_attribute.h b/include/ruby/internal/has/cpp_attribute.h
index 255f611..a30646c 100644
--- a/include/ruby/internal/has/cpp_attribute.h
+++ b/include/ruby/internal/has/cpp_attribute.h
@@ -42,7 +42,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/cpp_attribute.h#L42
 #  * explicitly by a compiler flag).   They also lack __has_cpp_attribute until
 #  * 2019.  However, they do have attributes since 2015 or so. */
 # /* https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance */
-# define RBIMPL_HAS_CPP_ATTRIBUTE0(_) RBIMPL_TOKEN_PASTE(RBIMPL_HAS_CPP_ATTRIBUTE_, _)
+# define RBIMPL_HAS_CPP_ATTRIBUTE0(_) (RBIMPL_HAS_CPP_ATTRIBUTE_ ## _)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_noreturn           200809 * RBIMPL_COMPILER_SINCE(MSVC, 19, 00, 0)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_carries_dependency 200809 * RBIMPL_COMPILER_SINCE(MSVC, 19, 00, 0)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_deprecated         201309 * RBIMPL_COMPILER_SINCE(MSVC, 19, 10, 0)
@@ -54,14 +54,14 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/has/cpp_attribute.h#L54
 # /* Clang  3.6.0  introduced  __has_cpp_attribute.  Prior  to  that  following
 #  * attributes were already there. */
 # /* https://clang.llvm.org/cxx_status.html */
-# define RBIMPL_HAS_CPP_ATTRIBUTE0(_) RBIMPL_TOKEN_PASTE(RBIMPL_HAS_CPP_ATTRIBUTE_, _)
+# define RBIMPL_HAS_CPP_ATTRIBUTE0(_) (RBIMPL_HAS_CPP_ATTRIBUTE_ ## _)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_noreturn           200809 * RBIMPL_COMPILER_SINCE(Clang, 3, 3, 0)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_deprecated         201309 * RBIMPL_COMPILER_SINCE(Clang, 3, 4, 0)
 
 #elif RBIMPL_COMPILER_BEFORE(GCC, 5, 0, 0)
 # /* GCC 5+ have __has_cpp_attribute, while 4.x had following attributes. */
 # /* https://gcc.gnu.org/projects/cxx-status.html */
-# define RBIMPL_HAS_CPP_ATTRIBUTE0(_) RBIMPL_TOKEN_PASTE(RBIMPL_HAS_CPP_ATTRIBUTE_, _)
+# define RBIMPL_HAS_CPP_ATTRIBUTE0(_) (RBIMPL_HAS_CPP_ATTRIBUTE_ ## _)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_noreturn           200809 * RBIMPL_COMPILER_SINCE(GCC, 4, 8, 0)
 # define RBIMPL_HAS_CPP_ATTRIBUTE_deprecated         201309 * RBIMPL_COMPILER_SINCE(GCC, 4, 9, 0)
 
diff --git a/include/ruby/internal/has/declspec_attribute.h b/include/ruby/internal/has/declspec_attribute.h
index 0261033..9d54a68 100644
--- a/include/ruby/internal/has/declspec_attribute.h
+++ b/include/ruby/internal/has/declspec_attribute.h
@@ -27,7 +27,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]