mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
Add more uses of #no_capture
This commit is contained in:
@@ -484,7 +484,7 @@ non_zero_append_elem :: proc(array: ^$T/[dynamic]$E, #no_broadcast arg: E, loc :
|
||||
return _append_elem(array, arg, false, loc=loc)
|
||||
}
|
||||
|
||||
_append_elems :: #force_inline proc(array: ^$T/[dynamic]$E, should_zero: bool, loc := #caller_location, args: ..E) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
_append_elems :: #force_inline proc(array: ^$T/[dynamic]$E, should_zero: bool, loc := #caller_location, args: []E) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
if array == nil {
|
||||
return 0, nil
|
||||
}
|
||||
@@ -524,13 +524,13 @@ _append_elems :: #force_inline proc(array: ^$T/[dynamic]$E, should_zero: bool, l
|
||||
}
|
||||
|
||||
@builtin
|
||||
append_elems :: proc(array: ^$T/[dynamic]$E, #no_broadcast args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
return _append_elems(array, true, loc, ..args)
|
||||
append_elems :: proc(array: ^$T/[dynamic]$E, #no_broadcast #no_capture args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
return _append_elems(array, true, loc, args)
|
||||
}
|
||||
|
||||
@builtin
|
||||
non_zero_append_elems :: proc(array: ^$T/[dynamic]$E, #no_broadcast args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
return _append_elems(array, false, loc, ..args)
|
||||
non_zero_append_elems :: proc(array: ^$T/[dynamic]$E, #no_broadcast #no_capture args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
return _append_elems(array, false, loc, args)
|
||||
}
|
||||
|
||||
// The append_string built-in procedure appends a string to the end of a [dynamic]u8 like type
|
||||
@@ -617,7 +617,7 @@ inject_at_elem :: proc(array: ^$T/[dynamic]$E, index: int, #no_broadcast arg: E,
|
||||
}
|
||||
|
||||
@builtin
|
||||
inject_at_elems :: proc(array: ^$T/[dynamic]$E, index: int, #no_broadcast args: ..E, loc := #caller_location) -> (ok: bool, err: Allocator_Error) #no_bounds_check #optional_allocator_error {
|
||||
inject_at_elems :: proc(array: ^$T/[dynamic]$E, index: int, #no_broadcast #no_capture args: ..E, loc := #caller_location) -> (ok: bool, err: Allocator_Error) #no_bounds_check #optional_allocator_error {
|
||||
if array == nil {
|
||||
return
|
||||
}
|
||||
@@ -679,7 +679,7 @@ assign_at_elem :: proc(array: ^$T/[dynamic]$E, index: int, arg: E, loc := #calle
|
||||
|
||||
|
||||
@builtin
|
||||
assign_at_elems :: proc(array: ^$T/[dynamic]$E, index: int, args: ..E, loc := #caller_location) -> (ok: bool, err: Allocator_Error) #no_bounds_check #optional_allocator_error {
|
||||
assign_at_elems :: proc(array: ^$T/[dynamic]$E, index: int, #no_broadcast #no_capture args: ..E, loc := #caller_location) -> (ok: bool, err: Allocator_Error) #no_bounds_check #optional_allocator_error {
|
||||
new_size := index + len(args)
|
||||
if len(args) == 0 {
|
||||
ok = true
|
||||
|
||||
@@ -342,17 +342,17 @@ _append_soa_elem :: proc(array: ^$T/#soa[dynamic]$E, zero_memory: bool, #no_broa
|
||||
}
|
||||
|
||||
@builtin
|
||||
append_soa_elems :: proc(array: ^$T/#soa[dynamic]$E, #no_broadcast args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
append_soa_elems :: proc(array: ^$T/#soa[dynamic]$E, #no_broadcast #no_capture args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
return _append_soa_elems(array, true, args=args, loc=loc)
|
||||
}
|
||||
|
||||
@builtin
|
||||
non_zero_append_soa_elems :: proc(array: ^$T/#soa[dynamic]$E, #no_broadcast args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
non_zero_append_soa_elems :: proc(array: ^$T/#soa[dynamic]$E, #no_broadcast #no_capture args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
return _append_soa_elems(array, false, args=args, loc=loc)
|
||||
}
|
||||
|
||||
|
||||
_append_soa_elems :: proc(array: ^$T/#soa[dynamic]$E, zero_memory: bool, #no_broadcast args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
_append_soa_elems :: proc(array: ^$T/#soa[dynamic]$E, zero_memory: bool, #no_broadcast args: []E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
|
||||
if array == nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ when !ODIN_NO_RTTI {
|
||||
print_string("<invalid-value>")
|
||||
}
|
||||
}
|
||||
println_any :: #force_no_inline proc "contextless" (args: ..any) {
|
||||
println_any :: #force_no_inline proc "contextless" (#no_capture args: ..any) {
|
||||
context = default_context()
|
||||
loop: for arg, i in args {
|
||||
assert(arg.id != nil)
|
||||
@@ -127,7 +127,7 @@ print_string :: #force_no_inline proc "contextless" (str: string) -> (n: int) {
|
||||
return
|
||||
}
|
||||
|
||||
print_strings :: #force_no_inline proc "contextless" (args: ..string) -> (n: int) {
|
||||
print_strings :: #force_no_inline proc "contextless" (#no_capture args: ..string) -> (n: int) {
|
||||
for str in args {
|
||||
m, err := stderr_write(transmute([]byte)str)
|
||||
n += m
|
||||
|
||||
@@ -139,7 +139,7 @@ clear :: proc "contextless" (a: ^$A/Small_Array($N, $T)) {
|
||||
resize(a, 0)
|
||||
}
|
||||
|
||||
push_back_elems :: proc "contextless" (a: ^$A/Small_Array($N, $T), items: ..T) {
|
||||
push_back_elems :: proc "contextless" (a: ^$A/Small_Array($N, $T), #no_capture items: ..T) {
|
||||
n := copy(a.data[a.len:], items[:])
|
||||
a.len += n
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import "core:fmt"
|
||||
import "core:unicode"
|
||||
import "core:unicode/utf8"
|
||||
|
||||
Error_Handler :: #type proc(pos: Pos, fmt: string, args: ..any)
|
||||
Error_Handler :: #type proc(pos: Pos, fmt: string, #no_capture args: ..any)
|
||||
|
||||
Token :: struct {
|
||||
kind: Token_Kind,
|
||||
@@ -112,13 +112,13 @@ offset_to_pos :: proc(t: ^Tokenizer, offset: int) -> Pos {
|
||||
}
|
||||
}
|
||||
|
||||
default_error_handler :: proc(pos: Pos, msg: string, args: ..any) {
|
||||
default_error_handler :: proc(pos: Pos, msg: string, #no_capture args: ..any) {
|
||||
fmt.eprintf("%s(%d:%d) ", pos.file, pos.line, pos.column)
|
||||
fmt.eprintf(msg, ..args)
|
||||
fmt.eprintf("\n")
|
||||
}
|
||||
|
||||
error :: proc(t: ^Tokenizer, offset: int, msg: string, args: ..any) {
|
||||
error :: proc(t: ^Tokenizer, offset: int, msg: string, #no_capture args: ..any) {
|
||||
pos := offset_to_pos(t, offset)
|
||||
if t.err != nil {
|
||||
t.err(pos, msg, ..args)
|
||||
|
||||
@@ -75,43 +75,43 @@ nil_logger :: proc() -> Logger {
|
||||
return Logger{nil_logger_proc, nil, Level.Debug, nil}
|
||||
}
|
||||
|
||||
debugf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
|
||||
debugf :: proc(fmt_str: string, #no_capture args: ..any, location := #caller_location) {
|
||||
logf(.Debug, fmt_str, ..args, location=location)
|
||||
}
|
||||
infof :: proc(fmt_str: string, args: ..any, location := #caller_location) {
|
||||
infof :: proc(fmt_str: string, #no_capture args: ..any, location := #caller_location) {
|
||||
logf(.Info, fmt_str, ..args, location=location)
|
||||
}
|
||||
warnf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
|
||||
warnf :: proc(fmt_str: string, #no_capture args: ..any, location := #caller_location) {
|
||||
logf(.Warning, fmt_str, ..args, location=location)
|
||||
}
|
||||
errorf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
|
||||
errorf :: proc(fmt_str: string, #no_capture args: ..any, location := #caller_location) {
|
||||
logf(.Error, fmt_str, ..args, location=location)
|
||||
}
|
||||
fatalf :: proc(fmt_str: string, args: ..any, location := #caller_location) {
|
||||
fatalf :: proc(fmt_str: string, #no_capture args: ..any, location := #caller_location) {
|
||||
logf(.Fatal, fmt_str, ..args, location=location)
|
||||
}
|
||||
|
||||
debug :: proc(args: ..any, sep := " ", location := #caller_location) {
|
||||
debug :: proc(#no_capture args: ..any, sep := " ", location := #caller_location) {
|
||||
log(.Debug, ..args, sep=sep, location=location)
|
||||
}
|
||||
info :: proc(args: ..any, sep := " ", location := #caller_location) {
|
||||
info :: proc(#no_capture args: ..any, sep := " ", location := #caller_location) {
|
||||
log(.Info, ..args, sep=sep, location=location)
|
||||
}
|
||||
warn :: proc(args: ..any, sep := " ", location := #caller_location) {
|
||||
warn :: proc(#no_capture args: ..any, sep := " ", location := #caller_location) {
|
||||
log(.Warning, ..args, sep=sep, location=location)
|
||||
}
|
||||
error :: proc(args: ..any, sep := " ", location := #caller_location) {
|
||||
error :: proc(#no_capture args: ..any, sep := " ", location := #caller_location) {
|
||||
log(.Error, ..args, sep=sep, location=location)
|
||||
}
|
||||
fatal :: proc(args: ..any, sep := " ", location := #caller_location) {
|
||||
fatal :: proc(#no_capture args: ..any, sep := " ", location := #caller_location) {
|
||||
log(.Fatal, ..args, sep=sep, location=location)
|
||||
}
|
||||
|
||||
panic :: proc(args: ..any, location := #caller_location) -> ! {
|
||||
panic :: proc(#no_capture args: ..any, location := #caller_location) -> ! {
|
||||
log(.Fatal, ..args, location=location)
|
||||
runtime.panic("log.panic", location)
|
||||
}
|
||||
panicf :: proc(fmt_str: string, args: ..any, location := #caller_location) -> ! {
|
||||
panicf :: proc(fmt_str: string, #no_capture args: ..any, location := #caller_location) -> ! {
|
||||
logf(.Fatal, fmt_str, ..args, location=location)
|
||||
runtime.panic("log.panicf", location)
|
||||
}
|
||||
@@ -133,14 +133,14 @@ assert :: proc(condition: bool, message := "", loc := #caller_location) {
|
||||
}
|
||||
|
||||
@(disabled=ODIN_DISABLE_ASSERT)
|
||||
assertf :: proc(condition: bool, fmt_str: string, args: ..any, loc := #caller_location) {
|
||||
assertf :: proc(condition: bool, fmt_str: string, #no_capture args: ..any, loc := #caller_location) {
|
||||
if !condition {
|
||||
// NOTE(dragos): We are using the same trick as in builtin.assert
|
||||
// to improve performance to make the CPU not
|
||||
// execute speculatively, making it about an order of
|
||||
// magnitude faster
|
||||
@(cold)
|
||||
internal :: proc(loc: runtime.Source_Code_Location, fmt_str: string, args: ..any) {
|
||||
internal :: proc(loc: runtime.Source_Code_Location, fmt_str: string, #no_capture args: ..any) {
|
||||
p := context.assertion_failure_proc
|
||||
if p == nil {
|
||||
p = runtime.default_assertion_failure_proc
|
||||
@@ -155,7 +155,7 @@ assertf :: proc(condition: bool, fmt_str: string, args: ..any, loc := #caller_lo
|
||||
|
||||
|
||||
|
||||
log :: proc(level: Level, args: ..any, sep := " ", location := #caller_location) {
|
||||
log :: proc(level: Level, #no_capture args: ..any, sep := " ", location := #caller_location) {
|
||||
logger := context.logger
|
||||
if logger.procedure == nil {
|
||||
return
|
||||
@@ -167,7 +167,7 @@ log :: proc(level: Level, args: ..any, sep := " ", location := #caller_location)
|
||||
logger.procedure(logger.data, level, str, logger.options, location)
|
||||
}
|
||||
|
||||
logf :: proc(level: Level, fmt_str: string, args: ..any, location := #caller_location) {
|
||||
logf :: proc(level: Level, fmt_str: string, #no_capture args: ..any, location := #caller_location) {
|
||||
logger := context.logger
|
||||
if logger.procedure == nil {
|
||||
return
|
||||
|
||||
@@ -404,7 +404,7 @@ clear_if_uninitialized_single :: proc(arg: ^Int, allocator := context.allocator)
|
||||
return #force_inline internal_clear_if_uninitialized_single(arg, allocator)
|
||||
}
|
||||
|
||||
clear_if_uninitialized_multi :: proc(args: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
clear_if_uninitialized_multi :: proc(#no_capture args: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
args := args
|
||||
assert_if_nil(..args)
|
||||
|
||||
@@ -420,7 +420,7 @@ error_if_immutable_single :: proc(arg: ^Int) -> (err: Error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
error_if_immutable_multi :: proc(args: ..^Int) -> (err: Error) {
|
||||
error_if_immutable_multi :: proc(#no_capture args: ..^Int) -> (err: Error) {
|
||||
for i in args {
|
||||
if i != nil && .Immutable in i.flags { return .Assignment_To_Immutable }
|
||||
}
|
||||
@@ -431,7 +431,7 @@ error_if_immutable :: proc {error_if_immutable_single, error_if_immutable_multi,
|
||||
/*
|
||||
Allocates several `Int`s at once.
|
||||
*/
|
||||
int_init_multi :: proc(integers: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
int_init_multi :: proc(#no_capture integers: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
assert_if_nil(..integers)
|
||||
|
||||
integers := integers
|
||||
@@ -812,13 +812,13 @@ assert_if_nil :: proc{
|
||||
assert_if_nil_rat,
|
||||
}
|
||||
|
||||
assert_if_nil_int :: #force_inline proc(integers: ..^Int, loc := #caller_location) {
|
||||
assert_if_nil_int :: #force_inline proc(#no_capture integers: ..^Int, loc := #caller_location) {
|
||||
for i in integers {
|
||||
assert(i != nil, "(nil)", loc)
|
||||
}
|
||||
}
|
||||
|
||||
assert_if_nil_rat :: #force_inline proc(rationals: ..^Rat, loc := #caller_location) {
|
||||
assert_if_nil_rat :: #force_inline proc(#no_capture rationals: ..^Rat, loc := #caller_location) {
|
||||
for r in rationals {
|
||||
assert(r != nil, "(nil)", loc)
|
||||
}
|
||||
|
||||
@@ -1844,7 +1844,7 @@ internal_root_n :: proc { internal_int_root_n, }
|
||||
Deallocates the backing memory of one or more `Int`s.
|
||||
Asssumes none of the `integers` to be a `nil`.
|
||||
*/
|
||||
internal_int_destroy :: proc(integers: ..^Int) {
|
||||
internal_int_destroy :: proc(#no_capture integers: ..^Int) {
|
||||
integers := integers
|
||||
|
||||
for &a in integers {
|
||||
@@ -2872,7 +2872,7 @@ internal_clear_if_uninitialized_single :: proc(arg: ^Int, allocator := context.a
|
||||
return err
|
||||
}
|
||||
|
||||
internal_clear_if_uninitialized_multi :: proc(args: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
internal_clear_if_uninitialized_multi :: proc(#no_capture args: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
context.allocator = allocator
|
||||
|
||||
for i in args {
|
||||
@@ -2890,7 +2890,7 @@ internal_error_if_immutable_single :: proc(arg: ^Int) -> (err: Error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
internal_error_if_immutable_multi :: proc(args: ..^Int) -> (err: Error) {
|
||||
internal_error_if_immutable_multi :: proc(#no_capture args: ..^Int) -> (err: Error) {
|
||||
for i in args {
|
||||
if i != nil && .Immutable in i.flags { return .Assignment_To_Immutable }
|
||||
}
|
||||
@@ -2901,7 +2901,7 @@ internal_error_if_immutable :: proc {internal_error_if_immutable_single, interna
|
||||
/*
|
||||
Allocates several `Int`s at once.
|
||||
*/
|
||||
internal_int_init_multi :: proc(integers: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
internal_int_init_multi :: proc(#no_capture integers: ..^Int, allocator := context.allocator) -> (err: Error) {
|
||||
context.allocator = allocator
|
||||
|
||||
integers := integers
|
||||
|
||||
@@ -5,8 +5,8 @@ import "core:odin/tokenizer"
|
||||
|
||||
import "core:fmt"
|
||||
|
||||
Warning_Handler :: #type proc(pos: tokenizer.Pos, fmt: string, args: ..any)
|
||||
Error_Handler :: #type proc(pos: tokenizer.Pos, fmt: string, args: ..any)
|
||||
Warning_Handler :: #type proc(pos: tokenizer.Pos, fmt: string, #no_capture args: ..any)
|
||||
Error_Handler :: #type proc(pos: tokenizer.Pos, fmt: string, #no_capture args: ..any)
|
||||
|
||||
Flag :: enum u32 {
|
||||
Optional_Semicolons,
|
||||
@@ -67,25 +67,25 @@ Import_Decl_Kind :: enum {
|
||||
|
||||
|
||||
|
||||
default_warning_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
|
||||
default_warning_handler :: proc(pos: tokenizer.Pos, msg: string, #no_capture args: ..any) {
|
||||
fmt.eprintf("%s(%d:%d): Warning: ", pos.file, pos.line, pos.column)
|
||||
fmt.eprintf(msg, ..args)
|
||||
fmt.eprintf("\n")
|
||||
}
|
||||
default_error_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
|
||||
default_error_handler :: proc(pos: tokenizer.Pos, msg: string, #no_capture args: ..any) {
|
||||
fmt.eprintf("%s(%d:%d): ", pos.file, pos.line, pos.column)
|
||||
fmt.eprintf(msg, ..args)
|
||||
fmt.eprintf("\n")
|
||||
}
|
||||
|
||||
warn :: proc(p: ^Parser, pos: tokenizer.Pos, msg: string, args: ..any) {
|
||||
warn :: proc(p: ^Parser, pos: tokenizer.Pos, msg: string, #no_capture args: ..any) {
|
||||
if p.warn != nil {
|
||||
p.warn(pos, msg, ..args)
|
||||
}
|
||||
p.file.syntax_warning_count += 1
|
||||
}
|
||||
|
||||
error :: proc(p: ^Parser, pos: tokenizer.Pos, msg: string, args: ..any) {
|
||||
error :: proc(p: ^Parser, pos: tokenizer.Pos, msg: string, #no_capture args: ..any) {
|
||||
if p.err != nil {
|
||||
p.err(pos, msg, ..args)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import "core:fmt"
|
||||
import "core:unicode"
|
||||
import "core:unicode/utf8"
|
||||
|
||||
Error_Handler :: #type proc(pos: Pos, fmt: string, args: ..any)
|
||||
Error_Handler :: #type proc(pos: Pos, fmt: string, #no_capture args: ..any)
|
||||
|
||||
Flag :: enum {
|
||||
Insert_Semicolon,
|
||||
@@ -62,13 +62,13 @@ offset_to_pos :: proc(t: ^Tokenizer, offset: int) -> Pos {
|
||||
}
|
||||
}
|
||||
|
||||
default_error_handler :: proc(pos: Pos, msg: string, args: ..any) {
|
||||
default_error_handler :: proc(pos: Pos, msg: string, #no_capture args: ..any) {
|
||||
fmt.eprintf("%s(%d:%d) ", pos.file, pos.line, pos.column)
|
||||
fmt.eprintf(msg, ..args)
|
||||
fmt.eprintf("\n")
|
||||
}
|
||||
|
||||
error :: proc(t: ^Tokenizer, offset: int, msg: string, args: ..any) {
|
||||
error :: proc(t: ^Tokenizer, offset: int, msg: string, #no_capture args: ..any) {
|
||||
pos := offset_to_pos(t, offset)
|
||||
if t.err != nil {
|
||||
t.err(pos, msg, ..args)
|
||||
|
||||
@@ -53,12 +53,12 @@ T :: struct {
|
||||
|
||||
|
||||
@(deprecated="prefer `log.error`")
|
||||
error :: proc(t: ^T, args: ..any, loc := #caller_location) {
|
||||
error :: proc(t: ^T, #no_capture args: ..any, loc := #caller_location) {
|
||||
pkg_log.error(..args, location = loc)
|
||||
}
|
||||
|
||||
@(deprecated="prefer `log.errorf`")
|
||||
errorf :: proc(t: ^T, format: string, args: ..any, loc := #caller_location) {
|
||||
errorf :: proc(t: ^T, format: string, #no_capture args: ..any, loc := #caller_location) {
|
||||
pkg_log.errorf(format, ..args, location = loc)
|
||||
}
|
||||
|
||||
@@ -87,12 +87,12 @@ failed :: proc(t: ^T) -> bool {
|
||||
}
|
||||
|
||||
@(deprecated="prefer `log.info`")
|
||||
log :: proc(t: ^T, args: ..any, loc := #caller_location) {
|
||||
log :: proc(t: ^T, #no_capture args: ..any, loc := #caller_location) {
|
||||
pkg_log.info(..args, location = loc)
|
||||
}
|
||||
|
||||
@(deprecated="prefer `log.infof`")
|
||||
logf :: proc(t: ^T, format: string, args: ..any, loc := #caller_location) {
|
||||
logf :: proc(t: ^T, format: string, #no_capture args: ..any, loc := #caller_location) {
|
||||
pkg_log.infof(format, ..args, location = loc)
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ expect :: proc(t: ^T, ok: bool, msg: string = "", loc := #caller_location) -> bo
|
||||
return ok
|
||||
}
|
||||
|
||||
expectf :: proc(t: ^T, ok: bool, format: string, args: ..any, loc := #caller_location) -> bool {
|
||||
expectf :: proc(t: ^T, ok: bool, format: string, #no_capture args: ..any, loc := #caller_location) -> bool {
|
||||
if !ok {
|
||||
pkg_log.errorf(format, ..args, location=loc)
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ error :: proc(s: ^Scanner, msg: string) {
|
||||
}
|
||||
}
|
||||
|
||||
errorf :: proc(s: ^Scanner, format: string, args: ..any) {
|
||||
errorf :: proc(s: ^Scanner, format: string, #no_capture args: ..any) {
|
||||
error(s, fmt.tprintf(format, ..args))
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ set_cell_value_and_alignment :: proc(tbl: ^Table, row, col: int, value: any, ali
|
||||
cell.alignment = alignment
|
||||
}
|
||||
|
||||
format :: proc(tbl: ^Table, _fmt: string, args: ..any) -> string {
|
||||
format :: proc(tbl: ^Table, _fmt: string, #no_capture args: ..any) -> string {
|
||||
context.allocator = tbl.format_allocator
|
||||
return fmt.aprintf(_fmt, ..args)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import "core:fmt"
|
||||
/*
|
||||
Silent error handler for the parser.
|
||||
*/
|
||||
Error_Handler :: proc(pos: xml.Pos, fmt: string, args: ..any) {}
|
||||
Error_Handler :: proc(pos: xml.Pos, fmt: string, #no_capture args: ..any) {}
|
||||
|
||||
OPTIONS :: xml.Options{ flags = { .Ignore_Unsupported, }, expected_doctype = "unicode", }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import "core:fmt"
|
||||
import "core:log"
|
||||
import "core:hash"
|
||||
|
||||
Silent :: proc(pos: xml.Pos, format: string, args: ..any) {}
|
||||
Silent :: proc(pos: xml.Pos, format: string, #no_capture args: ..any) {}
|
||||
|
||||
OPTIONS :: xml.Options{ flags = { .Ignore_Unsupported, .Intern_Comments, },
|
||||
expected_doctype = "",
|
||||
|
||||
@@ -373,7 +373,7 @@ test_odin_value_export :: proc(t: ^testing.T) {
|
||||
}
|
||||
|
||||
@(private)
|
||||
check :: proc(t: ^testing.T, exp: string, format: string, args: ..any, loc := #caller_location) {
|
||||
check :: proc(t: ^testing.T, exp: string, format: string, #no_capture args: ..any, loc := #caller_location) {
|
||||
got := fmt.tprintf(format, ..args)
|
||||
testing.expectf(t, got == exp, "(%q, %v): %q != %q", format, args, got, exp, loc = loc)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ common_prefix :: proc(strs: []string) -> string {
|
||||
return prefix
|
||||
}
|
||||
|
||||
errorf :: proc(format: string, args: ..any) -> ! {
|
||||
errorf :: proc(format: string, #no_capture args: ..any) -> ! {
|
||||
fmt.eprintf("%s ", os.args[0])
|
||||
fmt.eprintf(format, ..args)
|
||||
fmt.eprintln()
|
||||
|
||||
2
vendor/OpenGL/wrappers.odin
vendored
2
vendor/OpenGL/wrappers.odin
vendored
@@ -754,7 +754,7 @@ when !GL_DEBUG {
|
||||
MultiDrawElementsIndirectCount :: proc "c" (mode: i32, type: i32, indirect: [^]DrawElementsIndirectCommand, drawcount: i32, maxdrawcount, stride: i32) { impl_MultiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount, stride) }
|
||||
PolygonOffsetClamp :: proc "c" (factor, units, clamp: f32) { impl_PolygonOffsetClamp(factor, units, clamp) }
|
||||
} else {
|
||||
debug_helper :: proc"c"(from_loc: runtime.Source_Code_Location, num_ret: int, args: ..any, loc := #caller_location) {
|
||||
debug_helper :: proc"c"(from_loc: runtime.Source_Code_Location, num_ret: int, #no_capture args: ..any, loc := #caller_location) {
|
||||
context = runtime.default_context()
|
||||
|
||||
Error_Enum :: enum {
|
||||
|
||||
4
vendor/raylib/raylib.odin
vendored
4
vendor/raylib/raylib.odin
vendored
@@ -1667,7 +1667,7 @@ IsGestureDetected :: proc "c" (gesture: Gesture) -> bool {
|
||||
|
||||
|
||||
// Text formatting with variables (sprintf style)
|
||||
TextFormat :: proc(text: cstring, args: ..any) -> cstring {
|
||||
TextFormat :: proc(text: cstring, #no_capture args: ..any) -> cstring {
|
||||
@static buffers: [MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH]byte
|
||||
@static index: u32
|
||||
|
||||
@@ -1683,7 +1683,7 @@ TextFormat :: proc(text: cstring, args: ..any) -> cstring {
|
||||
}
|
||||
|
||||
// Text formatting with variables (sprintf style) and allocates (must be freed with 'MemFree')
|
||||
TextFormatAlloc :: proc(text: cstring, args: ..any) -> cstring {
|
||||
TextFormatAlloc :: proc(text: cstring, #no_capture args: ..any) -> cstring {
|
||||
str := fmt.tprintf(string(text), ..args)
|
||||
return strings.clone_to_cstring(str, MemAllocator())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user