aboutsummaryrefslogtreecommitdiff
path: root/src/build_settings.cpp
diff options
context:
space:
mode:
authorftphikari <ftphikari@gmail.com>2022-09-27 11:06:05 +0300
committerGitHub <noreply@github.com>2022-09-27 11:06:05 +0300
commiteb6c388f139607716acf02b0f6e1cd25a5128aad (patch)
tree6b19bfb6aeceabb1d0b6adb81be84b658a8505ba /src/build_settings.cpp
parent42144d957b45e29be1da74a98cfaaf465bfc9861 (diff)
parent0fe006157e6e6f07722bcf4eb7c51a8db07d008c (diff)
Merge branch 'odin-lang:master' into master
Diffstat (limited to 'src/build_settings.cpp')
-rw-r--r--src/build_settings.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp
index fc5a9d19f..02de22ec4 100644
--- a/src/build_settings.cpp
+++ b/src/build_settings.cpp
@@ -986,6 +986,15 @@ String get_fullpath_relative(gbAllocator a, String base_dir, String path) {
gb_memmove(str+i, path.text, path.len); i += path.len;
str[i] = 0;
+ // IMPORTANT NOTE(bill): Remove trailing path separators
+ // this is required to make sure there is a conventional
+ // notation for the path
+ for (/**/; i > 0; i--) {
+ u8 c = str[i-1];
+ if (c != '/' && c != '\\') {
+ break;
+ }
+ }
String res = make_string(str, i);
res = string_trim_whitespace(res);
@@ -1302,13 +1311,16 @@ void enable_target_feature(TokenPos pos, String const &target_feature_list) {
defer (mutex_unlock(&bc->target_features_mutex));
auto items = split_by_comma(target_feature_list);
- array_free(&items);
for_array(i, items) {
String const &item = items.data[i];
if (!check_target_feature_is_valid(pos, item)) {
error(pos, "Target feature '%.*s' is not valid", LIT(item));
+ continue;
}
+
+ string_set_add(&bc->target_features_set, item);
}
+ array_free(&items);
}
@@ -1331,7 +1343,7 @@ char const *target_features_set_to_cstring(gbAllocator allocator, bool with_quot
if (with_quotes) features[len++] = '"';
String feature = build_context.target_features_set.entries[i].value;
- gb_memmove(features, feature.text, feature.len);
+ gb_memmove(features + len, feature.text, feature.len);
len += feature.len;
if (with_quotes) features[len++] = '"';
}