Make the compat_widget_set_flag macro more robust