mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 23:33:15 +00:00
Merge pull request #5794 from alsakandari/improve-target-features
Improve target features flag by allowing the user to disable a target feature
This commit is contained in:
@@ -2093,7 +2093,19 @@ gb_internal bool check_target_feature_is_enabled(String const &feature, String *
|
||||
for (;;) {
|
||||
String str = string_split_iterator(&it, ',');
|
||||
if (str == "") break;
|
||||
|
||||
if (!string_set_exists(&build_context.target_features_set, str)) {
|
||||
String plus_str = concatenate_strings(temporary_allocator(), make_string_c("+"), str);
|
||||
|
||||
if (!string_set_exists(&build_context.target_features_set, plus_str)) {
|
||||
if (not_enabled) *not_enabled = str;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String minus_str = concatenate_strings(temporary_allocator(), make_string_c("-"), str);
|
||||
|
||||
if (string_set_exists(&build_context.target_features_set, minus_str)) {
|
||||
if (not_enabled) *not_enabled = str;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3055,7 +3055,10 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
||||
}
|
||||
first = false;
|
||||
|
||||
llvm_features = gb_string_appendc(llvm_features, "+");
|
||||
if (*str.text != '+' && *str.text != '-') {
|
||||
llvm_features = gb_string_appendc(llvm_features, "+");
|
||||
}
|
||||
|
||||
llvm_features = gb_string_append_length(llvm_features, str.text, str.len);
|
||||
}
|
||||
|
||||
|
||||
@@ -3719,6 +3719,11 @@ int main(int arg_count, char const **arg_ptr) {
|
||||
String item = string_split_iterator(&target_it, ',');
|
||||
if (item == "") break;
|
||||
|
||||
if (*item.text == '+' || *item.text == '-') {
|
||||
item.text++;
|
||||
item.len--;
|
||||
}
|
||||
|
||||
String invalid;
|
||||
if (!check_target_feature_is_valid_for_target_arch(item, &invalid) && item != str_lit("help")) {
|
||||
if (item != str_lit("?")) {
|
||||
|
||||
Reference in New Issue
Block a user