Add a compile-time check that the number of events doesn't exceed the capacity of control_event_t.event_mask.
Part of ticket 15431, checks for bugs similar to 13085.