@@ -2049,6 +2049,12 @@ VALUE rb_check_symbol(volatile VALUE *namep);
2049
2049
rb_intern_id_cache = rb_intern2 ((str), (long )strlen (str)); \
2050
2050
result rb_intern_id_cache; \
2051
2051
}
2052
+ // Workaround compound-token-split-by-macro warning
2053
+ #define RUBY_CONST_ID_CACHE_TOKEN_SPLIT (result, str ) \
2054
+ static ID rb_intern_id_cache; \
2055
+ if (!polyglot_is_value((void *)rb_intern_id_cache)) \
2056
+ rb_intern_id_cache = rb_intern2((str), (long )strlen(str)); \
2057
+ result rb_intern_id_cache;
2052
2058
#else
2053
2059
#define RUBY_CONST_ID_CACHE (result, str ) \
2054
2060
{ \
@@ -2065,10 +2071,17 @@ VALUE rb_check_symbol(volatile VALUE *namep);
2065
2071
#if defined(HAVE_BUILTIN___BUILTIN_CONSTANT_P) && defined(HAVE_STMT_AND_DECL_IN_EXPR)
2066
2072
/* __builtin_constant_p and statement expression is available
2067
2073
* since gcc-2.7.2.3 at least. */
2074
+ #ifdef TRUFFLERUBY
2075
+ #define rb_intern (str ) \
2076
+ (__builtin_constant_p(str) ? \
2077
+ __extension__ ({RUBY_CONST_ID_CACHE_TOKEN_SPLIT ((ID), (str))}) : \
2078
+ rb_intern(str))
2079
+ #else
2068
2080
#define rb_intern (str ) \
2069
2081
(__builtin_constant_p(str) ? \
2070
2082
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
2071
2083
rb_intern(str))
2084
+ #endif
2072
2085
#define rb_intern_const (str ) \
2073
2086
(__builtin_constant_p(str) ? \
2074
2087
__extension__ (rb_intern2((str), (long )strlen(str))) : \
0 commit comments