ruby-changes:39867
From: nobu <ko1@a...>
Date: Sun, 27 Sep 2015 09:10:51 +0900 (JST)
Subject: [ruby-changes:39867] nobu:r51948 (trunk): id_table.c: suppress warnings
nobu 2015-09-27 09:10:47 +0900 (Sun, 27 Sep 2015) New Revision: 51948 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51948 Log: id_table.c: suppress warnings * id_table.c (UNUSED): mark implementation functions maybe-unused to suppress warnings by old gcc. Modified files: trunk/id_table.c Index: id_table.c =================================================================== --- id_table.c (revision 51947) +++ id_table.c (revision 51948) @@ -187,6 +187,27 @@ https://github.com/ruby/ruby/blob/trunk/id_table.c#L187 #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 { https://github.com/ruby/ruby/blob/trunk/id_table.c#L243 }; 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 { https://github.com/ruby/ruby/blob/trunk/id_table.c#L272 }; 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, https://github.com/ruby/ruby/blob/trunk/id_table.c#L1180 #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_i https://github.com/ruby/ruby/blob/trunk/id_table.c#L1530 #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) \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/