Permalink
Browse files

Import CRuby change to explicitly ignore GCC extension warning

In my case, I have a C extension where I compile with
the -Werror option. The MacRuby ruby.h header generated
this warning as a result:

/Users/mrada/Library/Frameworks/MacRuby.framework/Versions/0.13/usr/include/ruby-1.9.2/ruby/st.h:69: warning: type of bit-field ‘num_entries’ is a GCC extension
  • Loading branch information...
ferrous26 committed Dec 2, 2012
1 parent d3ed408 commit b158b1b89891ce388d968286f8ffdbe619ed936c
Showing with 12 additions and 0 deletions.
  1. +12 −0 include/ruby/st.h
View
@@ -66,6 +66,18 @@ struct st_table {
const struct st_hash_type *type;
st_index_t num_bins;
unsigned int entries_packed : 1;
+#ifdef __GNUC__
+ /*
+ * C spec says,
+ * A bit-field shall have a type that is a qualified or unqualified
+ * version of _Bool, signed int, unsigned int, or some other
+ * implementation-defined type. It is implementation-defined whether
+ * atomic types are permitted.
+ * In short, long and long long bit-field are implementation-defined
+ * feature. Therefore we want to supress a warning explicitly.
+ */
+ __extension__
+ #endif
st_index_t num_entries : ST_INDEX_BITS - 1;
struct st_table_entry **bins;
struct st_table_entry *head, *tail;

0 comments on commit b158b1b

Please sign in to comment.