makesyscalls: handle arrays of pointers
When the config variable abi_intptr_t is not "", transform arrays of pointers to arrays of abi_intptr_t. Reviewed by: kevans
This commit is contained in:
parent
0a4e16446b
commit
79634eb90b
@ -66,6 +66,7 @@ local config = {
|
|||||||
abi_u_long = "u_long",
|
abi_u_long = "u_long",
|
||||||
abi_long = "long",
|
abi_long = "long",
|
||||||
abi_semid_t = "semid_t",
|
abi_semid_t = "semid_t",
|
||||||
|
abi_ptr_array_t = "",
|
||||||
ptr_intptr_t_cast = "intptr_t",
|
ptr_intptr_t_cast = "intptr_t",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +164,7 @@ local known_abi_flags = {
|
|||||||
value = 0x00000008,
|
value = 0x00000008,
|
||||||
exprs = {
|
exprs = {
|
||||||
"_Contains[a-z_]*_ptr_",
|
"_Contains[a-z_]*_ptr_",
|
||||||
|
"[*][*]",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -420,6 +422,10 @@ local function isptrtype(type)
|
|||||||
type:find("intptr_t") or type:find(config['abi_intptr_t'])
|
type:find("intptr_t") or type:find(config['abi_intptr_t'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function isptrarraytype(type)
|
||||||
|
return type:find("[*][*]") or type:find("[*][ ]*const[ ]*[*]")
|
||||||
|
end
|
||||||
|
|
||||||
local process_syscall_def
|
local process_syscall_def
|
||||||
|
|
||||||
-- These patterns are processed in order on any line that isn't empty.
|
-- These patterns are processed in order on any line that isn't empty.
|
||||||
@ -626,6 +632,12 @@ local function process_args(args)
|
|||||||
elseif argtype:find("^long$") then
|
elseif argtype:find("^long$") then
|
||||||
argtype = config["abi_long"]
|
argtype = config["abi_long"]
|
||||||
end
|
end
|
||||||
|
if isptrarraytype(argtype) and config["abi_ptr_array_t"] ~= "" then
|
||||||
|
-- `* const *` -> `**`
|
||||||
|
argtype = argtype:gsub("[*][ ]*const[ ]*[*]", "**")
|
||||||
|
-- e.g., `struct aiocb **` -> `uint32_t *`
|
||||||
|
argtype = argtype:gsub("[^*]*[*]", config["abi_ptr_array_t"] .. " ", 1)
|
||||||
|
end
|
||||||
|
|
||||||
-- XX TODO: Forward declarations? See: sysstubfwd in CheriBSD
|
-- XX TODO: Forward declarations? See: sysstubfwd in CheriBSD
|
||||||
if abi_change then
|
if abi_change then
|
||||||
|
Loading…
Reference in New Issue
Block a user