git: 804a84fbf26b - main - makesyscalls.lua: Add the ABI function prefix reliably.

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 22 Nov 2021 22:37:59 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=804a84fbf26b7caf17713f811c7d2d06b43f29ff

commit 804a84fbf26b7caf17713f811c7d2d06b43f29ff
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-22 22:36:58 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-22 22:36:58 +0000

    makesyscalls.lua: Add the ABI function prefix reliably.
    
    The previous code mostly worked, but ended up adding bogus sys_<foo>()
    declerations.
    
    Reviewed by:    kevans
---
 sys/tools/makesyscalls.lua | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua
index 78f0e2e906e9..e723346f1679 100644
--- a/sys/tools/makesyscalls.lua
+++ b/sys/tools/makesyscalls.lua
@@ -1192,25 +1192,29 @@ process_syscall_def = function(line)
 	end
 
 	local argprefix = ''
+	local funcprefix = ''
 	if abi_changes("pointer_args") then
 		for _, v in ipairs(funcargs) do
 			if isptrtype(v["type"]) then
 				-- argalias should be:
 				--   COMPAT_PREFIX + ABI Prefix + funcname
 				argprefix = config['abi_func_prefix']
-				funcalias = config['abi_func_prefix'] ..
-				    funcname
+				funcprefix = config['abi_func_prefix']
+				funcalias = funcprefix .. funcname
 				goto ptrfound
 			end
 		end
 		::ptrfound::
 	end
+	if funcname ~= nil then
+		funcname = funcprefix .. funcname
+	end
 	if funcalias == nil or funcalias == "" then
 		funcalias = funcname
 	end
 
 	if argalias == nil and funcname ~= nil then
-		argalias = argprefix .. funcname .. "_args"
+		argalias = funcname .. "_args"
 		for _, v in pairs(compat_options) do
 			local mask = v["mask"]
 			if (flags & mask) ~= 0 then