git: f29905cab576 - main - makesyscalls: deprecate cpp other than includes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Feb 2025 22:04:58 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=f29905cab576a0ccf454ee2e215f590e0e656d70
commit f29905cab576a0ccf454ee2e215f590e0e656d70
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-02-18 22:02:19 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-02-18 22:03:26 +0000
makesyscalls: deprecate cpp other than includes
Warn that C preprocessor directives in the config file are deprecated.
They are unsound and support has a number of potential pitfalls. They
should be replaced by compile-time generation of files plus an overlay
framework to allow things like per-arch variation.
Reviewed by: kevans
Sponsored by: DARPA, AFRL
Pull Request: https://github.com/freebsd/freebsd-src/pull/1575
---
sys/kern/syscalls.master | 1 +
sys/tools/syscalls/core/freebsd-syscall.lua | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index fbd2ffb60cae..67396a4cabc5 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -111,6 +111,7 @@
; limited set of output files. Before the first syscalls, #include lines will
; be copied and %%ABI_HEADERS%% expanded. Between system call entries,
; all lines beginning with # will be copied. Caveat Emptor.
+; WARNING: this functionality is deprecated.
#include <sys/param.h>
#include <sys/sysent.h>
diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua
index fdd3a9011b7a..2ef0fdea6401 100644
--- a/sys/tools/syscalls/core/freebsd-syscall.lua
+++ b/sys/tools/syscalls/core/freebsd-syscall.lua
@@ -50,6 +50,7 @@ function FreeBSDSyscall:parseSysfile()
local incs = ""
local prolog = ""
local first = true
+ local cpp_warned = false
local s
for line in fh:lines() do
line = line:gsub(commentExpr, "") -- Strip any comments.
@@ -82,6 +83,11 @@ function FreeBSDSyscall:parseSysfile()
incs = incs .. h .. "\n"
end
elseif line:match("^#") then
+ if not cpp_warned then
+ util.warn("use of non-include cpp " ..
+ "directives is deprecated")
+ cpp_warned = true
+ end
prolog = prolog .. line .. "\n"
else
s = syscall:new()