Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
cb3a6dd1
Unverified
Commit
cb3a6dd1
authored
4 years ago
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ISO C99 doesn't support unnamed unions; fix #5354
parent
833f556c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
include/mruby/boxing_word.h
include/mruby/boxing_word.h
+6
-6
include/mruby/hash.h
include/mruby/hash.h
+1
-1
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
+1
-1
mrbgems/mruby-time/src/time.c
mrbgems/mruby-time/src/time.c
+2
-2
src/hash.c
src/hash.c
+10
-10
No files found.
include/mruby/boxing_word.h
View file @
cb3a6dd1
...
...
@@ -84,9 +84,9 @@ union mrb_value_ {
struct
{
MRB_ENDIAN_LOHI
(
mrb_sym
sym
;
,
uint32_t
sym_
flag
;
,
uint32_t
flag
;
)
};
}
sym
;
#endif
struct
RBasic
*
bp
;
#ifndef MRB_NO_FLOAT
...
...
@@ -129,7 +129,7 @@ mrb_integer_func(mrb_value o) {
}
#define mrb_integer(o) mrb_integer_func(o)
#ifdef MRB_64BIT
#define mrb_symbol(o) mrb_val_union(o).sym
#define mrb_symbol(o) mrb_val_union(o).sym
.sym
#else
#define mrb_symbol(o) (mrb_sym)(((o).w) >> BOXWORD_SYMBOL_SHIFT)
#endif
...
...
@@ -138,7 +138,7 @@ mrb_integer_func(mrb_value o) {
#define mrb_fixnum_p(o) BOXWORD_SHIFT_VALUE_P(o, FIXNUM)
#define mrb_integer_p(o) (BOXWORD_SHIFT_VALUE_P(o, FIXNUM)||BOXWORD_OBJ_TYPE_P(o, INTEGER))
#ifdef MRB_64BIT
#define mrb_symbol_p(o) (mrb_val_union(o).sym
_
flag == BOXWORD_SYMBOL_FLAG)
#define mrb_symbol_p(o) (mrb_val_union(o).sym
.
flag == BOXWORD_SYMBOL_FLAG)
#else
#define mrb_symbol_p(o) BOXWORD_SHIFT_VALUE_P(o, SYMBOL)
#endif
...
...
@@ -182,8 +182,8 @@ mrb_integer_func(mrb_value o) {
#ifdef MRB_64BIT
#define SET_SYM_VALUE(r,v) do {\
union mrb_value_ mrb_value_union_variable;\
mrb_value_union_variable.sym = v;\
mrb_value_union_variable.sym
_
flag = BOXWORD_SYMBOL_FLAG;\
mrb_value_union_variable.sym
.sym
= v;\
mrb_value_union_variable.sym
.
flag = BOXWORD_SYMBOL_FLAG;\
(r) = mrb_value_union_variable.value;\
} while (0)
#else
...
...
This diff is collapsed.
Click to expand it.
include/mruby/hash.h
View file @
cb3a6dd1
...
...
@@ -29,7 +29,7 @@ struct RHash {
union
{
struct
hash_entry
*
ea
;
struct
hash_table
*
ht
;
};
}
hsh
;
};
#define mrb_hash_ptr(v) ((struct RHash*)(mrb_ptr(v)))
...
...
This diff is collapsed.
Click to expand it.
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
View file @
cb3a6dd1
...
...
@@ -63,7 +63,7 @@
#define MIRB_USING_HISTORY()
#endif
#if
ndef _WIN32
#if
!defined(_WIN32) && defined(_POSIX_C_SOURCE)
#define MIRB_SIGSETJMP(env) sigsetjmp(env, 1)
#define MIRB_SIGLONGJMP(env, val) siglongjmp(env, val)
#define SIGJMP_BUF sigjmp_buf
...
...
This diff is collapsed.
Click to expand it.
mrbgems/mruby-time/src/time.c
View file @
cb3a6dd1
...
...
@@ -125,7 +125,7 @@ gettimeofday(struct timeval *tv, void *tz)
# include <sys/time.h>
# endif
#endif
#if
def NO_GMTIME_R
#if
!(defined(_POSIX_C_SOURCE) || defined(_BSD_SOURCE) || defined(_SVID_SOURCE))
#define gmtime_r(t,r) gmtime(t)
#define localtime_r(t,r) localtime(t)
#endif
...
...
@@ -383,7 +383,7 @@ current_mrb_time(mrb_state *mrb)
sec
=
ts
.
tv_sec
;
usec
=
ts
.
tv_nsec
/
1000
;
}
#elif (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) && defined(
_POSIX_MONOTONIC_CLOCK
)
#elif (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) && defined(
CLOCK_MONOTONIC
)
{
struct
timespec
ts
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
...
...
This diff is collapsed.
Click to expand it.
src/hash.c
View file @
cb3a6dd1
...
...
@@ -151,20 +151,20 @@ DEFINE_ACCESSOR(ht, ea_n_used, uint32_t, ea_n_used)
#else
DEFINE_FLAG_ACCESSOR
(
ar
,
ea_capa
,
uint32_t
,
AR_EA_CAPA
)
DEFINE_FLAG_ACCESSOR
(
ar
,
ea_n_used
,
uint32_t
,
AR_EA_N_USED
)
DEFINE_ACCESSOR
(
ht
,
ea_capa
,
uint32_t
,
ht
->
ea_capa
)
DEFINE_ACCESSOR
(
ht
,
ea_n_used
,
uint32_t
,
ht
->
ea_n_used
)
DEFINE_ACCESSOR
(
ht
,
ea_capa
,
uint32_t
,
h
sh
.
h
t
->
ea_capa
)
DEFINE_ACCESSOR
(
ht
,
ea_n_used
,
uint32_t
,
h
sh
.
h
t
->
ea_n_used
)
#endif
DEFINE_FLAG_ACCESSOR
(
ib
,
bit
,
uint32_t
,
IB_BIT
)
DEFINE_ACCESSOR
(
ar
,
size
,
uint32_t
,
size
)
DEFINE_ACCESSOR
(
ar
,
ea
,
hash_entry
*
,
ea
)
DEFINE_ACCESSOR
(
ar
,
ea
,
hash_entry
*
,
hsh
.
ea
)
DEFINE_DECREMENTER
(
ar
,
size
)
DEFINE_ACCESSOR
(
ht
,
size
,
uint32_t
,
size
)
DEFINE_ACCESSOR
(
ht
,
ea
,
hash_entry
*
,
ht
->
ea
)
DEFINE_GETTER
(
ht
,
ib
,
uint32_t
*
,
ht
->
ib
)
DEFINE_ACCESSOR
(
ht
,
ea
,
hash_entry
*
,
h
sh
.
h
t
->
ea
)
DEFINE_GETTER
(
ht
,
ib
,
uint32_t
*
,
h
sh
.
h
t
->
ib
)
DEFINE_INCREMENTER
(
ht
,
size
)
DEFINE_DECREMENTER
(
ht
,
size
)
DEFINE_GETTER
(
h
,
size
,
uint32_t
,
size
)
DEFINE_ACCESSOR
(
h
,
ht
,
hash_table
*
,
ht
)
DEFINE_ACCESSOR
(
h
,
ht
,
hash_table
*
,
h
sh
.
h
t
)
DEFINE_SWITCHER
(
ht
,
HT
)
#define ea_each_used(ea, n_used, entry_var, code) do { \
...
...
@@ -234,9 +234,9 @@ DEFINE_SWITCHER(ht, HT)
* `h_check_modified` raises an exception when a dangerous modification is
* made to `h` by executing `code`.
*
* `h_check_modified` macro is not called if `h->h
t` (`h->
ea`) is `NULL`
* `h_check_modified` macro is not called if `h->h
sh.ht` (`h->hsh.
ea`) is `NULL`
* (`Hash` size is zero). And because the `hash_entry` is rather large,
* `h->h
t->ea` and `h->
ht->ea_capa` are able to be safely accessed even for
* `h->h
sh.ht->ea` and `h->hsh.
ht->ea_capa` are able to be safely accessed even for
* AR. This nature is used to eliminate branch of AR or HT.
*
* `HT_ASSERT_SAFE_READ` checks if members can be accessed according to its
...
...
@@ -261,7 +261,7 @@ HT_ASSERT_SAFE_READ(ea_capa);
struct RHash *h__ = h; \
uint32_t mask__ = MRB_HASH_HT|MRB_HASH_IB_BIT_MASK|MRB_HASH_AR_EA_CAPA_MASK; \
uint32_t flags__ = h__->flags & mask__; \
void* tbl__ = (mrb_assert(h__->h
t), h__->ht);
\
void* tbl__ = (mrb_assert(h__->h
sh.ht), h__->hsh.ht);
\
uint32_t ht_ea_capa__ = 0; \
hash_entry *ht_ea__ = NULL; \
if (H_CHECK_MODIFIED_USE_HT_EA_CAPA_FOR_AR || h_ht_p(h__)) { \
...
...
@@ -272,7 +272,7 @@ HT_ASSERT_SAFE_READ(ea_capa);
} \
code; \
if (flags__ != (h__->flags & mask__) || \
tbl__ != h__->ht || \
tbl__ != h__->h
sh.h
t || \
((H_CHECK_MODIFIED_USE_HT_EA_CAPA_FOR_AR || h_ht_p(h__)) && \
ht_ea_capa__ != ht_ea_capa(h__)) || \
((H_CHECK_MODIFIED_USE_HT_EA_FOR_AR || h_ht_p(h__)) && \
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment