Skip to content

Commit

Permalink
fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaquraish committed Mar 25, 2024
1 parent 5d9b7e6 commit 385af14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bootstrap/stage0.c
Original file line number Diff line number Diff line change
Expand Up @@ -8966,7 +8966,7 @@ void compiler_parser_Parser_create_namespaces_for_initial_file(compiler_parser_P
std_map_Map__4_insert(cur_ns->namespaces, base, new_ns);
cur_ns=new_ns;
}
char *file_base = basename(filename);
char *file_base = strdup(basename(filename));
if (str_ends_with(file_base, ".oc")) {
file_base[(strlen(file_base) - 3)]='\0';
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/parser.oc
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ def Parser::create_namespaces_for_initial_file(&this, filename: str, single_file
}

// Remove file extension
let file_base = basename(filename)
let file_base = basename(filename).copy()
if file_base.ends_with(".oc") {
file_base[file_base.len() - 3] = '\0'
}
Expand Down
7 changes: 4 additions & 3 deletions tests/custom_varargs_functions.oc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// out: "a b!\na, b\n3 = 28\n"
import std::variadic::{ VarArgs, vprintf }

[variadic_format]
Expand All @@ -8,7 +10,6 @@ def my_print(fmt: str, ...) {
args.end()
}

[formatting "%s %s" "$.str, $.len"]
[variadic_format]
def my_println(fmt: str, ...) {
let args: VarArgs
Expand All @@ -19,7 +20,7 @@ def my_println(fmt: str, ...) {
}

def main() {
my_print("Hello, %s!\n", "world")
my_println("Hello, %s!", "world")
my_print("a %s!\n", "b")
my_println("a, %s", "b")
my_println(`{1+2} = {7*4}`)
}

0 comments on commit 385af14

Please sign in to comment.