Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2026 04:45:37 +0000
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2a1745da389b - main - syscalls: Preserve the attributes of the args
Message-ID:  <69e1baf1.329fc.6fa77803@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2a1745da389bd3bb9fd32c25cf221fa32866debd

commit 2a1745da389bd3bb9fd32c25cf221fa32866debd
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-04-17 04:42:01 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-04-17 04:44:19 +0000

    syscalls: Preserve the attributes of the args
    
    Lightly parse and preserve the attributes of the args as attributes.
    
    Sponsored by:           Netflix
    Reviewed by:            brooks
    Differential Revision:  https://reviews.freebsd.org/D56407
---
 sys/tools/syscalls/core/scarg.lua | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sys/tools/syscalls/core/scarg.lua b/sys/tools/syscalls/core/scarg.lua
index 7ffbf15b3a80..ac0332ce3a78 100644
--- a/sys/tools/syscalls/core/scarg.lua
+++ b/sys/tools/syscalls/core/scarg.lua
@@ -29,6 +29,21 @@ local function checkAbiChanges(arg)
 	return false
 end
 
+-- Extracts the Microsoft(R) SAL annotations from this argument.
+local function extractArgAnnotations(arg)
+	local annotations = {}
+	for ann in arg:gmatch("_Contains_[^ ]*[_)]") do
+		table.insert(annotations, ann)
+	end
+	for ann in arg:gmatch("_In[^ ]*[_)]") do
+		table.insert(annotations, ann)
+	end
+	for ann in arg:gmatch("_Out[^ ]*[_)]") do
+		table.insert(annotations, ann)
+	end
+	return table.concat(annotations, " ")
+end
+
 -- Strips the Microsoft(R) SAL annotations from this argument.
 local function stripArgAnnotations(arg)
 	arg = arg:gsub("_Contains_[^ ]*[_)] ?", "")
@@ -46,6 +61,7 @@ function scarg:init(line)
 
 	self.arg_abi_change = checkAbiChanges(self.scarg)
 	self.changes_abi = self.arg_abi_change
+	self.annotation = extractArgAnnotations(self.scarg)
 	self.scarg = stripArgAnnotations(self.scarg)
 
 	self.name = self.scarg:match("([^* ]+)$")
@@ -126,15 +142,18 @@ function scarg:append(tbl)
 		table.insert(tbl, {
 			type = "uint32_t",
 			name = self.name .. "1",
+			annotation = self.annotation or "",
 		})
 		table.insert(tbl, {
 			type = "uint32_t",
 			name = self.name .. "2",
+			annotation = "",
 		})
 	else
 		table.insert(tbl, {
 			type = self.type,
 			name = self.name,
+			annotation = self.annotation or "",
 		})
 	end
 end


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e1baf1.329fc.6fa77803>