Removes invalid enum values from enum declarations.