rtl: check all decls in interfaces

This commit is contained in:
Loïc Grégoire
2026-06-27 09:17:25 -04:00
parent 827f8b90d1
commit 5353ab2e0b
2 changed files with 13 additions and 0 deletions
+4
View File
@@ -13,6 +13,10 @@ pub const impl = switch (config.arch) {
const ImplSchema = struct { const ImplSchema = struct {
pub const ThreadContext = struct {}; pub const ThreadContext = struct {};
/// Maximum number of pages that can be flushed by individual TLB flushes
/// before it is more efficient to flush the entire TLB.
pub const tlb_max_pages = 0;
/// Set the hardware interrupt priority level. /// Set the hardware interrupt priority level.
pub fn set_hardware_ipl(level: ipl.Ipl) void { pub fn set_hardware_ipl(level: ipl.Ipl) void {
_ = level; _ = level;
+9
View File
@@ -67,6 +67,15 @@ pub fn assert_interface(T: type, I: type) void {
if (@TypeOf(impl_member) != type) { if (@TypeOf(impl_member) != type) {
@compileError(std.fmt.comptimePrint("Declaration '{s}' in type '{s}' is required to be a type by '{s}', but got '{s}'", .{ decl.name, @typeName(T), @typeName(I), @typeName(@TypeOf(impl_member)) })); @compileError(std.fmt.comptimePrint("Declaration '{s}' in type '{s}' is required to be a type by '{s}', but got '{s}'", .{ decl.name, @typeName(T), @typeName(I), @typeName(@TypeOf(impl_member)) }));
} }
} else {
if (!@hasDecl(T, decl.name)) {
@compileError(std.fmt.comptimePrint("Expected variable declaration '{s}' in type '{s}' required by '{s}'", .{ decl.name, @typeName(T), @typeName(I) }));
}
const impl_member = @field(T, decl.name);
if (@TypeOf(impl_member) != @TypeOf(member)) {
@compileError(std.fmt.comptimePrint("Declaration '{s}' in type '{s}' is required to be a variable of type '{s}' by '{s}', but got '{s}'", .{ decl.name, @typeName(T), @typeName(@TypeOf(member)), @typeName(I), @typeName(@TypeOf(impl_member)) }));
}
} }
} }
} }