diff options
| author | Warner Losh <imp@FreeBSD.org> | 2026-04-17 04:42:01 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2026-04-17 04:44:19 +0000 |
| commit | 2a1745da389bd3bb9fd32c25cf221fa32866debd (patch) | |
| tree | 7697cad9b3788b3fd1c98137cc614a7832e75bec | |
| parent | 62a19cd59b54a030c21a5529ed491ba2060140ca (diff) | |
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
| -rw-r--r-- | sys/tools/syscalls/core/scarg.lua | 19 |
1 files changed, 19 insertions, 0 deletions
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 |
