Skip to content

Commit

Permalink
makesyscalls: deprecate cpp other than includes
Browse files Browse the repository at this point in the history
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.

Sponsored by:	DARPA, AFRL
  • Loading branch information
brooksdavis committed Jan 17, 2025
1 parent d12b2e6 commit db67977
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys/kern/syscalls.master
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions sys/tools/syscalls/core/freebsd-syscall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit db67977

Please sign in to comment.