Skip to content

Commit

Permalink
Avoid inline indirect calls to fix compile errors on GCC 13
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Jan 14, 2024
1 parent 4d4b2b1 commit 621cdbc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/hashmap.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ local INVALID_INDEX: usize <comptime> = (@usize)(-1)
*Remarks*: The input `key` is actually ignored.
]]
function hashmap_iteratorT:next(key: K): (boolean, K, V) <inline>
function hashmap_iteratorT:next(key: K): (boolean, K, V)
local node: *hashnodeT = self:_next_node(key)
if not node then return false, (@K)(), (@V)() end
return true, node.key, node.value
Expand All @@ -451,7 +451,7 @@ local INVALID_INDEX: usize <comptime> = (@usize)(-1)
*Remarks*: The input `key` is actually ignored.
]]
function hashmap_iteratorT:mnext(key: K): (boolean, K, *V) <inline>
function hashmap_iteratorT:mnext(key: K): (boolean, K, *V)
local node: *hashnodeT = self:_next_node(key)
if not node then return false, (@K)(), nilptr end
return true, node.key, &node.value
Expand Down
8 changes: 4 additions & 4 deletions lib/iterators.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The container `a` must be contiguous, such as `array`, `span`, `vector` or `sequ
global function ipairs(a: container_reference_concept): (auto, auto, integer) <inline>
## local atype = a.type:implicit_deref_type()
## if not atype.is_contiguous then static_error("container '%s' is not contiguous", atype) end
local function ipairs_next(a: #[a.type]#, k: integer): (boolean, integer, auto) <inline>
local function ipairs_next(a: #[a.type]#, k: integer): (boolean, integer, auto)
## impl_ipairs_next(atype)
end
return ipairs_next, a, #[atype.is_oneindexing and 0 or -1]#
Expand All @@ -74,7 +74,7 @@ end
global function mipairs(a: container_reference_concept): (auto, auto, integer) <inline>
## local atype = a.type:implicit_deref_type()
## if not atype.is_contiguous then static_error("container '%s' is not contiguous", atype) end
local function mipairs_next(a: #[a.type]#, k: integer): (boolean, integer, auto) <inline>
local function mipairs_next(a: #[a.type]#, k: integer): (boolean, integer, auto)
## impl_mipairs_next(atype)
end
return mipairs_next, a, #[atype.is_oneindexing and 0 or -1]#
Expand All @@ -88,7 +88,7 @@ Otherwise returns `false` plus a zeroed key and value.
The container `a` must either have the metamethod `__next` or be a contiguous.
]]
global function next(a: container_reference_concept, k: auto): (auto, auto, auto) <inline>
global function next(a: container_reference_concept, k: auto): (auto, auto, auto)
## local atype = a.type:implicit_deref_type()
## if atype.is_record and atype.metafields.__next then
## local ktype = atype.metafields.__next.type.argtypes[2]
Expand All @@ -102,7 +102,7 @@ global function next(a: container_reference_concept, k: auto): (auto, auto, auto
end

-- Like `next` but returns reference to the next element value, so that you can modify it in-place.
global function mnext(a: container_reference_concept, k: auto): (auto, auto, auto) <inline>
global function mnext(a: container_reference_concept, k: auto): (auto, auto, auto)
## local atype = a.type:implicit_deref_type()
## if atype.is_record and atype.metafields.__mnext then
## local ktype = atype.metafields.__mnext.type.argtypes[2]
Expand Down
4 changes: 2 additions & 2 deletions lib/list.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ require 'memory'
Returns the next node of the list and its element.
Used with `pairs()` iterator.
]]
function listT:__next(node: *listnodeT): (boolean, *listnodeT, T) <inline>
function listT:__next(node: *listnodeT): (boolean, *listnodeT, T)
local nextnode: *listnodeT
if unlikely(node == nilptr) then
nextnode = self.front
Expand All @@ -278,7 +278,7 @@ require 'memory'
Returns the next node of the list and its element by reference.
Used with `mpairs()` iterator.
]]
function listT:__mnext(node: *listnodeT): (boolean, *listnodeT, *T) <inline>
function listT:__mnext(node: *listnodeT): (boolean, *listnodeT, *T)
local nextnode: *listnodeT
if unlikely(node == nilptr) then
nextnode = self.front
Expand Down

0 comments on commit 621cdbc

Please sign in to comment.