aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary Pierson <zacpiersonhehe@gmail.com>2017-02-07 23:21:52 -0600
committerZachary Pierson <zacpiersonhehe@gmail.com>2017-02-07 23:21:52 -0600
commit73c5c5d5d3315ac956b9846adfda9da8d204e4c8 (patch)
treea1ed27ad5360c59ef1fdec1e78af03fe6f0fcf98 /src
parent584869730a4ad5fb4021d46a6e1dab21790c9452 (diff)
Linker on MacOS and GNU/Linux now includes foreign_system_libraries. Fixed foreign_system_library not respecting 'when' condition.
Diffstat (limited to 'src')
-rw-r--r--src/checker.c16
-rw-r--r--src/main.c11
2 files changed, 14 insertions, 13 deletions
diff --git a/src/checker.c b/src/checker.c
index 12915197a..6b2bac628 100644
--- a/src/checker.c
+++ b/src/checker.c
@@ -1488,6 +1488,19 @@ void check_collect_entities(Checker *c, AstNodeArray nodes, bool is_file_scope)
continue;
}
+ if (fl->cond != NULL) {
+ Operand operand = {Addressing_Invalid};
+ check_expr(c, &operand, fl->cond);
+ if (operand.mode != Addressing_Constant || !is_type_boolean(operand.type)) {
+ error_node(fl->cond, "Non-constant boolean `when` condition");
+ continue;
+ }
+ if (operand.value.kind == ExactValue_Bool &&
+ !operand.value.value_bool) {
+ continue;
+ }
+ }
+
DelayedDecl di = {c->context.scope, decl};
array_add(&c->delayed_foreign_libraries, di);
case_end;
@@ -1853,6 +1866,3 @@ void check_parsed_files(Checker *c) {
map_scope_destroy(&file_scopes);
}
-
-
-
diff --git a/src/main.c b/src/main.c
index 679dfaec9..734afa50a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -375,9 +375,8 @@ int main(int argc, char **argv) {
char lib_str_buf[1024] = {0};
for_array(i, ir_gen.module.foreign_library_paths) {
String lib = ir_gen.module.foreign_library_paths.e[i];
- // gb_printf_err("Linking lib: %.*s\n", LIT(lib));
isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf),
- " \"%.*s\"", LIT(lib));
+ " -l%.*s ", LIT(lib));
lib_str = gb_string_appendc(lib_str, lib_str_buf);
}
@@ -410,14 +409,6 @@ int main(int argc, char **argv) {
linker = "clang";
#endif
- printf("Libs: %s\n", lib_str);
-
- // TODO(zangent): I'm not sure what to do with lib_str.
- // I'll have to look at the format that the libraries are listed to determine what to do.
- lib_str = "";
-
-
-
exit_code = system_exec_command_line_app("ld-link", true,
"%s \"%.*s\".o -o \"%.*s%s\" %s "
"-lc "