This commit is contained in:
David Gonzalez Martin 2025-04-17 14:07:55 -06:00
parent d2e488edb1
commit f26e4c01e8
3 changed files with 770 additions and 684 deletions

File diff suppressed because it is too large Load Diff

View File

@ -231,6 +231,18 @@ CompilerCommand = enum
test, test,
} }
BuildMode = enum
{
debug_none,
debug_fast,
debug_size,
soft_optimize,
optimize_for_speed,
optimize_for_size,
aggressively_optimize_for_speed,
aggressively_optimize_for_size,
}
[export] main = fn [cc(c)] (argument_count: u32, argv: &&u8) s32 [export] main = fn [cc(c)] (argument_count: u32, argv: &&u8) s32
{ {
global_state_initialize(); global_state_initialize();
@ -242,7 +254,7 @@ CompilerCommand = enum
>command_string = c_string_to_slice(argv[1]); >command_string = c_string_to_slice(argv[1]);
> command_string_to_enum = #string_to_enum(CompilerCommand, command_string); >command_string_to_enum = #string_to_enum(CompilerCommand, command_string);
if (!command_string_to_enum.is_valid) if (!command_string_to_enum.is_valid)
{ {
return 1; return 1;
@ -253,6 +265,41 @@ CompilerCommand = enum
{ {
.compile => .compile =>
{ {
if (argument_count < 3)
{
return 1;
}
>build_mode: BuildMode = .debug_none;
>has_debug_info: u1 = 1;
if (argument_count >= 4)
{
>build_mode_string_to_enum = #string_to_enum(BuildMode, c_string_to_slice(argv[3]));
if (!build_mode_string_to_enum.is_valid)
{
return 1;
}
build_mode = build_mode_string_to_enum.enum_value;
}
if (argument_count >= 5)
{
>has_debug_info_string = c_string_to_slice(argv[4]);
if (string_equal(has_debug_info_string, "true"))
{
has_debug_info = 1;
}
else if (string_equal(has_debug_info_string, "false"))
{
has_debug_info = 0;
}
else
{
return 1;
}
}
>relative_file_path_pointer = argv[2]; >relative_file_path_pointer = argv[2];
if (!relative_file_path_pointer) if (!relative_file_path_pointer)
{ {

16
tests/else_if.bbb Normal file
View File

@ -0,0 +1,16 @@
[export] main = fn [cc(c)] () s32
{
>result: s32 = 0;
if (result == 1)
{
return 1;
}
else if (result == 0)
{
return 0;
}
else
{
return 5;
}
}