diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-27 00:10:47 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-27 00:10:47 +0000 |
commit | c224ad0c2bd9595501e62cf3ce12fbfe646dd3c0 (patch) | |
tree | a2ba8683d5045f526a223f773792716f1f33f62a | |
parent | f64f684b654b8c67534311336a4bcb9767c5ed47 (diff) | |
download | ruby-c224ad0c2bd9595501e62cf3ce12fbfe646dd3c0.tar.gz |
id_table.c: suppress warnings
* id_table.c (UNUSED): mark implementation functions maybe-unused
to suppress warnings by old gcc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | id_table.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/id_table.c b/id_table.c index 6676127d28..747199f9f9 100644 --- a/id_table.c +++ b/id_table.c @@ -187,6 +187,27 @@ #error #endif +/* IMPL(create) will be "hash_id_table_create" and so on */ +#define IMPL1(name, op) TOKEN_PASTE(name, _id##op) /* expand `name' */ +#define IMPL(op) IMPL1(ID_TABLE_NAME, _table##op) /* but prevent `op' */ + +#ifdef __GNUC__ +# define UNUSED(func) static func __attribute__((unused)) +#else +# define UNUSED(func) static func +#endif + +UNUSED(ID_TABLE_IMPL_TYPE *IMPL(create)(size_t)); +UNUSED(void IMPL(free)(ID_TABLE_IMPL_TYPE *)); +UNUSED(void IMPL(clear)(ID_TABLE_IMPL_TYPE *)); +UNUSED(size_t IMPL(size)(ID_TABLE_IMPL_TYPE *)); +UNUSED(size_t IMPL(memsize)(ID_TABLE_IMPL_TYPE *)); +UNUSED(int IMPL(insert)(ID_TABLE_IMPL_TYPE *, ID, VALUE)); +UNUSED(int IMPL(lookup)(ID_TABLE_IMPL_TYPE *, ID, VALUE *)); +UNUSED(int IMPL(delete)(ID_TABLE_IMPL_TYPE *, ID)); +UNUSED(void IMPL(foreach)(ID_TABLE_IMPL_TYPE *, rb_id_table_foreach_func_t *, void *)); +UNUSED(void IMPL(foreach_values)(ID_TABLE_IMPL_TYPE *, rb_id_table_foreach_values_func_t *, void *)); + #if ID_TABLE_USE_ID_SERIAL typedef rb_id_serial_t id_key_t; static inline ID @@ -222,7 +243,8 @@ struct st_id_table { }; static struct st_table * -tbl2st(struct st_id_table *tbl) { +tbl2st(struct st_id_table *tbl) +{ if (tbl->check != ID_TABLE_MARK) rb_bug("tbl2st: check error %x", tbl->check); return tbl->st; } @@ -250,7 +272,8 @@ struct st_id_table { }; static struct st_table * -tbl2st(struct st_id_table *tbl) { +tbl2st(struct st_id_table *tbl) +{ return (struct st_table *)tbl; } @@ -1157,7 +1180,8 @@ ITEM_SET_KEY(struct hash_id_table *tbl, int i, id_key_t key) #endif static inline int -round_capa(int capa) { +round_capa(int capa) +{ /* minsize is 4 */ capa >>= 2; capa |= capa >> 1; @@ -1506,10 +1530,6 @@ mix_id_table_foreach_values(struct mix_id_table *tbl, rb_id_table_foreach_values #endif /* ID_TABLE_USE_MIX */ -/* IMPL(create) will be "hash_id_table_create" and so on */ -#define IMPL1(name, op) TOKEN_PASTE(name, _id##op) /* expand `name' */ -#define IMPL(op) IMPL1(ID_TABLE_NAME, _table##op) /* but prevent `op' */ - #define IMPL_TYPE1(type, prot, name, args) \ RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) #define IMPL_TYPE(type, name, prot, args) \ |