mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-13 22:03:42 +00:00
Begin work on -bedrock mode
Currently disables 128-bit integers, `map` type, and RTTI
This commit is contained in:
39
src/main.cpp
39
src/main.cpp
@@ -394,6 +394,8 @@ enum BuildFlagKind {
|
||||
|
||||
BuildFlag_BuildDiagnostics,
|
||||
|
||||
BuildFlag_Bedrock,
|
||||
|
||||
// internal use only
|
||||
BuildFlag_InternalFastISel,
|
||||
BuildFlag_InternalIgnoreLazy,
|
||||
@@ -627,6 +629,8 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
||||
|
||||
add_flag(&build_flags, BuildFlag_BuildDiagnostics, str_lit("build-diagnostics"), BuildFlagParam_None, Command__does_build);
|
||||
|
||||
add_flag(&build_flags, BuildFlag_Bedrock, str_lit("bedrock"), BuildFlagParam_None, Command__does_check);
|
||||
|
||||
add_flag(&build_flags, BuildFlag_InternalFastISel, str_lit("internal-fast-isel"), BuildFlagParam_None, Command_all);
|
||||
add_flag(&build_flags, BuildFlag_InternalIgnoreLazy, str_lit("internal-ignore-lazy"), BuildFlagParam_None, Command_all);
|
||||
add_flag(&build_flags, BuildFlag_InternalIgnoreLLVMBuild, str_lit("internal-ignore-llvm-build"),BuildFlagParam_None, Command_all);
|
||||
@@ -1599,6 +1603,11 @@ gb_internal bool parse_build_flags(Array<String> args) {
|
||||
build_context.build_diagnostics = true;
|
||||
break;
|
||||
|
||||
case BuildFlag_Bedrock:
|
||||
build_context.bedrock = true;
|
||||
build_context.no_rtti = true;
|
||||
break;
|
||||
|
||||
case BuildFlag_InternalFastISel:
|
||||
build_context.fast_isel = true;
|
||||
break;
|
||||
@@ -3520,6 +3529,32 @@ gb_internal int strip_semicolons(Parser *parser) {
|
||||
return cast(int)failed;
|
||||
}
|
||||
|
||||
gb_internal void setup_bedrock_mode(void) {
|
||||
if (!build_context.bedrock) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool seen_core = false;
|
||||
bool seen_vendor = false;
|
||||
for (isize i = 0; i < library_collections.count; /**/) {
|
||||
if (!seen_core && library_collections[i].name == "core") {
|
||||
array_ordered_remove(&library_collections, i);
|
||||
seen_core = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!seen_vendor && library_collections[i].name == "vendor") {
|
||||
array_ordered_remove(&library_collections, i);
|
||||
seen_vendor = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
}
|
||||
|
||||
build_context.ODIN_DEFAULT_TO_NIL_ALLOCATOR = true;
|
||||
}
|
||||
|
||||
gb_internal void init_terminal(void) {
|
||||
TIME_SECTION("init terminal");
|
||||
build_context.has_ansi_terminal_colours = false;
|
||||
@@ -3796,6 +3831,10 @@ int main(int arg_count, char const **arg_ptr) {
|
||||
return print_show_help(args[0], command);
|
||||
}
|
||||
|
||||
if (build_context.bedrock) {
|
||||
setup_bedrock_mode();
|
||||
}
|
||||
|
||||
if (init_filename.len > 0 && !build_context.show_help) {
|
||||
// The command must be build, run, test, check, or another that takes a directory or filename.
|
||||
if (!path_is_directory(init_filename)) {
|
||||
|
||||
Reference in New Issue
Block a user