mirror of
https://github.com/odin-lang/Odin.git
synced 2026-10-08 22:01:47 -04:00
Merge pull request #7594 from bplu4t2f/fix-7583
Fix 7583: -strict-style requires comma before newline after proc parameters which have a default value.
This commit is contained in:
6 files changed
+34
-24
No files matched your search
@@ -162,7 +162,7 @@ dsa_sign_internal :: proc(
|
||||
ctx: []byte,
|
||||
rnd: []byte,
|
||||
priv_key: ^Private_Key,
|
||||
external_mu: []byte = nil
|
||||
external_mu: []byte = nil,
|
||||
) -> bool {
|
||||
params := priv_key.params
|
||||
switch params {
|
||||
|
||||
+5
-5
@@ -1024,7 +1024,7 @@ make_multi_pointer :: proc(
|
||||
$T: typeid/[^]$E,
|
||||
#any_int len: int,
|
||||
allocator := context.allocator,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (mp: T, err: Allocator_Error) {
|
||||
return runtime.make_multi_pointer(T, len, allocator, loc)
|
||||
}
|
||||
@@ -1040,7 +1040,7 @@ make_soa_slice :: proc(
|
||||
$T: typeid/#soa[]$E,
|
||||
#any_int len: int,
|
||||
allocator := context.allocator,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (array: T, err: Allocator_Error) {
|
||||
return runtime.make_soa_slice(T, len, allocator, loc)
|
||||
}
|
||||
@@ -1055,7 +1055,7 @@ its backing allocator, and initial length and capacity of `0`.
|
||||
make_soa_dynamic_array :: proc(
|
||||
$T: typeid/#soa[dynamic]$E,
|
||||
allocator := context.allocator,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (array: T, err: Allocator_Error) {
|
||||
return runtime.make_soa_dynamic_array(T, allocator, loc)
|
||||
}
|
||||
@@ -1071,7 +1071,7 @@ make_soa_dynamic_array_len :: proc(
|
||||
$T: typeid/#soa[dynamic]$E,
|
||||
#any_int len: int,
|
||||
allocator := context.allocator,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (array: T, err: Allocator_Error) {
|
||||
return runtime.make_soa_dynamic_array_len(T, len, allocator, loc)
|
||||
}
|
||||
@@ -1089,7 +1089,7 @@ make_soa_dynamic_array_len_cap :: proc(
|
||||
#any_int len: int,
|
||||
#any_int cap: int,
|
||||
allocator := context.allocator,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (array: T, err: Allocator_Error) {
|
||||
return runtime.make_soa_dynamic_array_len_cap(T, len, cap, allocator, loc)
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ arena_alloc_bytes_non_zeroed :: proc(
|
||||
a: ^Arena,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> ([]byte, Allocator_Error) {
|
||||
if a.data == nil {
|
||||
panic("Allocation on uninitialized Arena allocator.", loc)
|
||||
@@ -654,7 +654,7 @@ scratch_resize :: proc(
|
||||
old_size: int,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (rawptr, Allocator_Error) {
|
||||
bytes, err := scratch_resize_bytes(s, byte_slice(old_memory, old_size), size, alignment, loc)
|
||||
return raw_data(bytes), err
|
||||
@@ -682,7 +682,7 @@ scratch_resize_bytes :: proc(
|
||||
old_data: []byte,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> ([]byte, Allocator_Error) {
|
||||
bytes, err := scratch_resize_bytes_non_zeroed(s, old_data, size, alignment, loc)
|
||||
if bytes != nil && size > len(old_data) {
|
||||
@@ -714,7 +714,7 @@ scratch_resize_non_zeroed :: proc(
|
||||
old_size: int,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (rawptr, Allocator_Error) {
|
||||
bytes, err := scratch_resize_bytes_non_zeroed(s, byte_slice(old_memory, old_size), size, alignment, loc)
|
||||
return raw_data(bytes), err
|
||||
@@ -742,7 +742,7 @@ scratch_resize_bytes_non_zeroed :: proc(
|
||||
old_data: []byte,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> ([]byte, Allocator_Error) {
|
||||
old_memory := raw_data(old_data)
|
||||
old_size := len(old_data)
|
||||
@@ -883,7 +883,7 @@ stack_alloc :: proc(
|
||||
s: ^Stack,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (rawptr, Allocator_Error) {
|
||||
bytes, err := stack_alloc_bytes(s, size, alignment, loc)
|
||||
return raw_data(bytes), err
|
||||
@@ -901,7 +901,7 @@ stack_alloc_bytes :: proc(
|
||||
s: ^Stack,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> ([]byte, Allocator_Error) {
|
||||
bytes, err := stack_alloc_bytes_non_zeroed(s, size, alignment, loc)
|
||||
if bytes != nil {
|
||||
@@ -922,7 +922,7 @@ stack_alloc_non_zeroed :: proc(
|
||||
s: ^Stack,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (rawptr, Allocator_Error) {
|
||||
bytes, err := stack_alloc_bytes_non_zeroed(s, size, alignment, loc)
|
||||
return raw_data(bytes), err
|
||||
@@ -940,7 +940,7 @@ stack_alloc_bytes_non_zeroed :: proc(
|
||||
s: ^Stack,
|
||||
size: int,
|
||||
alignment := DEFAULT_ALIGNMENT,
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> ([]byte, Allocator_Error) {
|
||||
if s.data == nil {
|
||||
panic("Allocation on an uninitialized Stack allocator.", loc)
|
||||
|
||||
+8
-8
@@ -100,7 +100,7 @@ accept_poly :: #force_inline proc(
|
||||
p: $T,
|
||||
cb: $C/proc(op: ^Operation, p: T),
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_accept(socket, _poly_cb(C, T), timeout, l)
|
||||
@@ -582,7 +582,7 @@ recv :: #force_inline proc(
|
||||
cb: Callback,
|
||||
all := false,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation {
|
||||
op := prep_recv(socket, bufs, cb, all, timeout, l)
|
||||
exec(op)
|
||||
@@ -1053,7 +1053,7 @@ read_poly :: #force_inline proc(
|
||||
cb: $C/proc(op: ^Operation, p: T),
|
||||
all := false,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_read(handle, offset, buf, _poly_cb(C, T), all=all, timeout=timeout, l=l)
|
||||
@@ -1092,7 +1092,7 @@ read_poly2 :: #force_inline proc(
|
||||
cb: $C/proc(op: ^Operation, p: T, p2: T2),
|
||||
all := false,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) + size_of(T2) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_read(handle, offset, buf, _poly_cb2(C, T, T2), all, timeout, l)
|
||||
@@ -1132,7 +1132,7 @@ read_poly3 :: #force_inline proc(
|
||||
cb: $C/proc(op: ^Operation, p: T, p2: T2, p3: T3),
|
||||
all := false,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) + size_of(T2) + size_of(T3) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_read(handle, offset, buf, _poly_cb3(C, T, T2, T3), all, timeout, l)
|
||||
@@ -1270,7 +1270,7 @@ write_poly :: #force_inline proc(
|
||||
cb: $C/proc(op: ^Operation, p: T),
|
||||
all := true,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_write(handle, offset, buf, _poly_cb(C, T), all=all, timeout=timeout, l=l)
|
||||
@@ -1309,7 +1309,7 @@ write_poly2 :: #force_inline proc(
|
||||
cb: $C/proc(op: ^Operation, p: T, p2: T2),
|
||||
all := true,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) + size_of(T2) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_write(handle, offset, buf, _poly_cb2(C, T, T2), all, timeout, l)
|
||||
@@ -1349,7 +1349,7 @@ write_poly3 :: #force_inline proc(
|
||||
cb: $C/proc(op: ^Operation, p: T, p2: T2, p3: T3),
|
||||
all := true,
|
||||
timeout: time.Duration = NO_TIMEOUT,
|
||||
l: ^Event_Loop = nil
|
||||
l: ^Event_Loop = nil,
|
||||
) -> ^Operation where size_of(T) + size_of(T2) + size_of(T3) <= size_of(rawptr) * MAX_USER_ARGUMENTS {
|
||||
|
||||
op := prep_write(handle, offset, buf, _poly_cb3(C, T, T2, T3), all, timeout, l)
|
||||
|
||||
@@ -5188,7 +5188,12 @@ gb_internal Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_fl
|
||||
}
|
||||
|
||||
if (allow_token(f, Token_Eq)) {
|
||||
// NOTE(bplu4t2f): We're usually at expr_level == 1 here, but the default value expr needs to be self-contained to ensure correct newline behavior after it.
|
||||
isize previous_expr_level = f->expr_level;
|
||||
f->expr_level = 0;
|
||||
default_value = parse_expr(f, false);
|
||||
GB_ASSERT(f->expr_level == 0);
|
||||
f->expr_level = previous_expr_level;
|
||||
if (!allow_default_parameters) {
|
||||
syntax_error(f->curr_token, "Default parameters are only allowed for procedures");
|
||||
default_value = nullptr;
|
||||
@@ -5263,7 +5268,12 @@ gb_internal Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_fl
|
||||
}
|
||||
|
||||
if (allow_token(f, Token_Eq)) {
|
||||
// NOTE(bplu4t2f): We're usually at expr_level == 1 here, but the default value expr needs to be self-contained to ensure correct newline behavior after it.
|
||||
isize previous_expr_level = f->expr_level;
|
||||
f->expr_level = 0;
|
||||
default_value = parse_expr(f, false);
|
||||
GB_ASSERT(f->expr_level == 0);
|
||||
f->expr_level = previous_expr_level;
|
||||
if (!allow_default_parameters) {
|
||||
syntax_error(f->curr_token, "Default parameters are only allowed for procedures");
|
||||
default_value = nullptr;
|
||||
|
||||
@@ -19,7 +19,7 @@ _test_stream :: proc(
|
||||
resets_on_empty: bool = false,
|
||||
do_destroy: bool = true,
|
||||
|
||||
loc := #caller_location
|
||||
loc := #caller_location,
|
||||
) -> (passed: Passed_Tests, ok: bool) {
|
||||
// We only test what the stream reports to support.
|
||||
|
||||
|
||||
Reference in new issue
Block a user