diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-07-08 21:07:53 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-07-08 21:07:53 +0200 |
| commit | 2d8d0dd8515a4598d6e027f28818614c117ae0c4 (patch) | |
| tree | cf038003add5ddda2ef71395fe78a801c8a2abb0 /core/flags | |
| parent | 1a20b78633038614635da99b5e634015d4ce7d6e (diff) | |
fix `@(optimization_mode)` usage in builtin collections
Diffstat (limited to 'core/flags')
| -rw-r--r-- | core/flags/internal_assignment.odin | 10 | ||||
| -rw-r--r-- | core/flags/internal_rtti.odin | 8 | ||||
| -rw-r--r-- | core/flags/internal_validation.odin | 4 | ||||
| -rw-r--r-- | core/flags/parsing.odin | 2 | ||||
| -rw-r--r-- | core/flags/usage.odin | 2 | ||||
| -rw-r--r-- | core/flags/util.odin | 4 |
6 files changed, 15 insertions, 15 deletions
diff --git a/core/flags/internal_assignment.odin b/core/flags/internal_assignment.odin index 4c4ee58fe..bb49977eb 100644 --- a/core/flags/internal_assignment.odin +++ b/core/flags/internal_assignment.odin @@ -12,7 +12,7 @@ import "core:reflect" // Push a positional argument onto a data struct, checking for specified // positionals first before adding it to a fallback field. -@(optimization_mode="size") +@(optimization_mode="favor_size") push_positional :: #force_no_inline proc (model: ^$T, parser: ^Parser, arg: string) -> (error: Error) { if bit_array.get(&parser.filled_pos, parser.filled_pos.max_index) { // The max index is set, which means we're out of space. @@ -74,7 +74,7 @@ register_field :: proc(parser: ^Parser, field: reflect.Struct_Field, index: int) } // Set a `-flag` argument, Odin-style. -@(optimization_mode="size") +@(optimization_mode="favor_size") set_odin_flag :: proc(model: ^$T, parser: ^Parser, name: string) -> (error: Error) { // We make a special case for help requests. switch name { @@ -100,7 +100,7 @@ set_odin_flag :: proc(model: ^$T, parser: ^Parser, name: string) -> (error: Erro } // Set a `-flag` argument, UNIX-style. -@(optimization_mode="size") +@(optimization_mode="favor_size") set_unix_flag :: proc(model: ^$T, parser: ^Parser, name: string) -> (future_args: int, error: Error) { // We make a special case for help requests. switch name { @@ -137,7 +137,7 @@ set_unix_flag :: proc(model: ^$T, parser: ^Parser, name: string) -> (future_args } // Set a `-flag:option` argument. -@(optimization_mode="size") +@(optimization_mode="favor_size") set_option :: proc(model: ^$T, parser: ^Parser, name, option: string) -> (error: Error) { field, index := get_field_by_name(model, name) or_return @@ -176,7 +176,7 @@ set_option :: proc(model: ^$T, parser: ^Parser, name, option: string) -> (error: } // Set a `-map:key=value` argument. -@(optimization_mode="size") +@(optimization_mode="favor_size") set_key_value :: proc(model: ^$T, parser: ^Parser, name, key, value: string) -> (error: Error) { field, index := get_field_by_name(model, name) or_return diff --git a/core/flags/internal_rtti.odin b/core/flags/internal_rtti.odin index b7aecdef3..ac39eaa8b 100644 --- a/core/flags/internal_rtti.odin +++ b/core/flags/internal_rtti.odin @@ -13,7 +13,7 @@ import "core:strings" @require import "core:time/datetime" import "core:unicode/utf8" -@(optimization_mode="size") +@(optimization_mode="favor_size") parse_and_set_pointer_by_base_type :: proc(ptr: rawptr, str: string, type_info: ^runtime.Type_Info) -> bool { bounded_int :: proc(value, min, max: i128) -> (result: i128, ok: bool) { return value, min <= value && value <= max @@ -202,7 +202,7 @@ parse_and_set_pointer_by_base_type :: proc(ptr: rawptr, str: string, type_info: // especially with files. // // We want to provide as informative as an error as we can. -@(optimization_mode="size", disabled=NO_CORE_NAMED_TYPES) +@(optimization_mode="favor_size", disabled=NO_CORE_NAMED_TYPES) parse_and_set_pointer_by_named_type :: proc(ptr: rawptr, str: string, data_type: typeid, arg_tag: string, out_error: ^Error) { // Core types currently supported: // @@ -320,7 +320,7 @@ parse_and_set_pointer_by_named_type :: proc(ptr: rawptr, str: string, data_type: } } -@(optimization_mode="size") +@(optimization_mode="favor_size") set_unbounded_integer_by_type :: proc(ptr: rawptr, value: $T, data_type: typeid) where intrinsics.type_is_integer(T) { switch data_type { case i8: (^i8) (ptr)^ = cast(i8) value @@ -367,7 +367,7 @@ set_unbounded_integer_by_type :: proc(ptr: rawptr, value: $T, data_type: typeid) } } -@(optimization_mode="size") +@(optimization_mode="favor_size") parse_and_set_pointer_by_type :: proc(ptr: rawptr, str: string, type_info: ^runtime.Type_Info, arg_tag: string) -> (error: Error) { #partial switch specific_type_info in type_info.variant { case runtime.Type_Info_Named: diff --git a/core/flags/internal_validation.odin b/core/flags/internal_validation.odin index fd4bafeef..b71cf9fe7 100644 --- a/core/flags/internal_validation.odin +++ b/core/flags/internal_validation.odin @@ -11,7 +11,7 @@ package flags @require import "core:strings" // This proc is used to assert that `T` meets the expectations of the library. -@(optimization_mode="size", disabled=ODIN_DISABLE_ASSERT) +@(optimization_mode="favor_size", disabled=ODIN_DISABLE_ASSERT) validate_structure :: proc(model_type: $T, style: Parsing_Style, loc := #caller_location) { positionals_assigned_so_far: bit_array.Bit_Array defer bit_array.destroy(&positionals_assigned_so_far) @@ -162,7 +162,7 @@ validate_structure :: proc(model_type: $T, style: Parsing_Style, loc := #caller_ // Validate that all the required arguments are set and that the set arguments // are up to the program's expectations. -@(optimization_mode="size") +@(optimization_mode="favor_size") validate_arguments :: proc(model: ^$T, parser: ^Parser) -> Error { check_fields: for field, index in reflect.struct_fields_zipped(T) { was_set := bit_array.get(&parser.fields_set, index) diff --git a/core/flags/parsing.odin b/core/flags/parsing.odin index b6b63fdb6..2d8ce34eb 100644 --- a/core/flags/parsing.odin +++ b/core/flags/parsing.odin @@ -32,7 +32,7 @@ Inputs: Returns: - error: A union of errors; parsing, file open, a help request, or validation. */ -@(optimization_mode="size") +@(optimization_mode="favor_size") parse :: proc( model: ^$T, args: []string, diff --git a/core/flags/usage.odin b/core/flags/usage.odin index 48137b6cd..c42df7576 100644 --- a/core/flags/usage.odin +++ b/core/flags/usage.odin @@ -17,7 +17,7 @@ Inputs: - program: The name of the program, usually the first argument to `os.args`. - style: The argument parsing style, required to show flags in the proper style. */ -@(optimization_mode="size") +@(optimization_mode="favor_size") write_usage :: proc(out: io.Writer, data_type: typeid, program: string = "", style: Parsing_Style = .Odin) { // All flags get their tags parsed so they can be reasoned about later. Flag :: struct { diff --git a/core/flags/util.odin b/core/flags/util.odin index e4f32eea1..f1bd60e75 100644 --- a/core/flags/util.odin +++ b/core/flags/util.odin @@ -19,7 +19,7 @@ Inputs: - allocator: (default: context.allocator) - loc: The caller location for debugging purposes (default: #caller_location) */ -@(optimization_mode="size") +@(optimization_mode="favor_size") parse_or_exit :: proc( model: ^$T, program_args: []string, @@ -63,7 +63,7 @@ Inputs: - error: The error returned from `parse`. - style: The argument parsing style, required to show flags in the proper style, when usage is shown. */ -@(optimization_mode="size") +@(optimization_mode="favor_size") print_errors :: proc(data_type: typeid, error: Error, program: string, style: Parsing_Style = .Odin) { stderr := os.stream_from_handle(os.stderr) stdout := os.stream_from_handle(os.stdout) |