diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c index ac54955857..439663f0fd 100644 --- a/ext/ripper/eventids2.c +++ b/ext/ripper/eventids2.c @@ -65,6 +65,8 @@ static ripper_scanner_ids_t ripper_scanner_ids; #include "eventids2table.c" +STATIC_ASSERT(eventids2_table_size, RIPPER_EVENTIDS2_TABLE_SIZE == sizeof(ripper_scanner_ids)/sizeof(ID)); + void ripper_init_eventids2(void) { diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb index bb64d2fe8b..c44b4ba325 100644 --- a/ext/ripper/tools/generate.rb +++ b/ext/ripper/tools/generate.rb @@ -136,6 +136,8 @@ def generate_eventids2_table(ids) buf << %Q[ rb_hash_aset(h, intern_sym("#{id}"), INT2FIX(1));\n] end buf << %Q[}\n] + buf << %Q[\n] + buf << %Q[#define RIPPER_EVENTIDS2_TABLE_SIZE #{ids.size}\n] buf end