mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-25 21:28:13 +00:00
stronger +/- checks in check_target_feature_is_enabled
This commit is contained in:
@@ -2215,18 +2215,25 @@ gb_internal bool check_target_feature_is_enabled(String const &feature, String *
|
||||
}
|
||||
if (feature_str == "") break;
|
||||
|
||||
if (!string_set_exists(&build_context.target_features_set, str)) {
|
||||
String plus_str = concatenate_strings(temporary_allocator(), make_string_c("+"), feature_str);
|
||||
|
||||
if (want_enabled && !string_set_exists(&build_context.target_features_set, plus_str)) {
|
||||
if (not_enabled) *not_enabled = str;
|
||||
return false;
|
||||
String plus_str = concatenate_strings(temporary_allocator(), make_string_c("+"), feature_str);
|
||||
String minus_str = concatenate_strings(temporary_allocator(), make_string_c("-"), feature_str);
|
||||
|
||||
bool has_raw = string_set_exists(&build_context.target_features_set, str);
|
||||
bool has_plus = string_set_exists(&build_context.target_features_set, plus_str);
|
||||
bool has_minus = string_set_exists(&build_context.target_features_set, minus_str);
|
||||
|
||||
bool is_enabled = (has_plus || has_raw) && !has_minus;
|
||||
|
||||
if ((has_plus || has_raw) && has_minus) {
|
||||
printf("ENTRIES for '%.*s' / '%.*s':\n", LIT(plus_str), LIT(minus_str));
|
||||
for (StringSetEntry& str : build_context.target_features_set) {
|
||||
printf("\thash: %i, next: %i, val: %.*s\n", str.hash, str.next, LIT(str.value));
|
||||
}
|
||||
}
|
||||
|
||||
GB_ASSERT(!((has_plus || has_raw) && has_minus));
|
||||
|
||||
String minus_str = concatenate_strings(temporary_allocator(), make_string_c("-"), feature_str);
|
||||
|
||||
if (!want_enabled && !string_set_exists(&build_context.target_features_set, minus_str)) {
|
||||
if (want_enabled != is_enabled) {
|
||||
if (not_enabled) *not_enabled = str;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user