mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/ruby.h (CONST_ID_CACHE): fixed statement expression.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7799fe9e9f
commit
a31f177eaa
2 changed files with 8 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Jun 10 12:43:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* include/ruby/ruby.h (CONST_ID_CACHE): fixed statement expression.
|
||||||
|
|
||||||
Tue Jun 10 11:25:15 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Jun 10 11:25:15 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ruby.c (rb_argv0): revised for ext/tk.
|
* ruby.c (rb_argv0): revised for ext/tk.
|
||||||
|
|
|
@ -765,20 +765,20 @@ ID rb_to_id(VALUE);
|
||||||
VALUE rb_id2str(ID);
|
VALUE rb_id2str(ID);
|
||||||
|
|
||||||
#define CONST_ID_CACHE(result, str) \
|
#define CONST_ID_CACHE(result, str) \
|
||||||
({ \
|
{ \
|
||||||
static ID rb_intern_id_cache; \
|
static ID rb_intern_id_cache; \
|
||||||
if (!rb_intern_id_cache) \
|
if (!rb_intern_id_cache) \
|
||||||
rb_intern_id_cache = (rb_intern)(str); \
|
rb_intern_id_cache = (rb_intern)(str); \
|
||||||
result rb_intern_id_cache; \
|
result rb_intern_id_cache; \
|
||||||
})
|
}
|
||||||
#define CONST_ID(var, str) \
|
#define CONST_ID(var, str) \
|
||||||
do {CONST_ID_CACHE(var =, str);} while (0)
|
do CONST_ID_CACHE(var =, str) while (0)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* __builtin_constant_p and statement expression is available
|
/* __builtin_constant_p and statement expression is available
|
||||||
* since gcc-2.7.2.3 at least. */
|
* since gcc-2.7.2.3 at least. */
|
||||||
#define rb_intern(str) \
|
#define rb_intern(str) \
|
||||||
(__builtin_constant_p(str) ? \
|
(__builtin_constant_p(str) ? \
|
||||||
CONST_ID_CACHE(/**/, str) : \
|
(CONST_ID_CACHE(/**/, str)) : \
|
||||||
rb_intern(str))
|
rb_intern(str))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue