@OpaqueType -> @Type(.Opaque)
parent
01605a7742
commit
17e41f6cd3
|
@ -277,8 +277,8 @@ pub extern "c" fn pthread_cond_signal(cond: *pthread_cond_t) c_int;
|
|||
pub extern "c" fn pthread_cond_broadcast(cond: *pthread_cond_t) c_int;
|
||||
pub extern "c" fn pthread_cond_destroy(cond: *pthread_cond_t) c_int;
|
||||
|
||||
pub const pthread_t = *@OpaqueType();
|
||||
pub const FILE = @OpaqueType();
|
||||
pub const pthread_t = *@Type(.Opaque);
|
||||
pub const FILE = @Type(.Opaque);
|
||||
|
||||
pub extern "c" fn dlopen(path: [*:0]const u8, mode: c_int) ?*c_void;
|
||||
pub extern "c" fn dlclose(handle: *c_void) c_int;
|
||||
|
|
|
@ -12,7 +12,7 @@ pub var handle: Handle = undefined;
|
|||
pub var system_table: *tables.SystemTable = undefined;
|
||||
|
||||
/// A handle to an event structure.
|
||||
pub const Event = *@OpaqueType();
|
||||
pub const Event = *@Type(.Opaque);
|
||||
|
||||
/// GUIDs must be align(8)
|
||||
pub const Guid = extern struct {
|
||||
|
@ -46,7 +46,7 @@ pub const Guid = extern struct {
|
|||
};
|
||||
|
||||
/// An EFI Handle represents a collection of related interfaces.
|
||||
pub const Handle = *@OpaqueType();
|
||||
pub const Handle = *@Type(.Opaque);
|
||||
|
||||
/// This structure represents time information.
|
||||
pub const Time = extern struct {
|
||||
|
@ -103,4 +103,4 @@ pub const TimeCapabilities = extern struct {
|
|||
};
|
||||
|
||||
/// File Handle as specified in the EFI Shell Spec
|
||||
pub const FileHandle = *@OpaqueType();
|
||||
pub const FileHandle = *@Type(.Opaque);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
|
||||
pub const HIIHandle = *@OpaqueType();
|
||||
pub const HIIHandle = *@Type(.Opaque);
|
||||
|
||||
/// The header found at the start of each package.
|
||||
pub const HIIPackageHeader = packed struct {
|
||||
|
|
|
@ -27,16 +27,16 @@ pub const UCHAR = u8;
|
|||
pub const FLOAT = f32;
|
||||
pub const HANDLE = *c_void;
|
||||
pub const HCRYPTPROV = ULONG_PTR;
|
||||
pub const HBRUSH = *@OpaqueType();
|
||||
pub const HCURSOR = *@OpaqueType();
|
||||
pub const HICON = *@OpaqueType();
|
||||
pub const HINSTANCE = *@OpaqueType();
|
||||
pub const HMENU = *@OpaqueType();
|
||||
pub const HMODULE = *@OpaqueType();
|
||||
pub const HWND = *@OpaqueType();
|
||||
pub const HDC = *@OpaqueType();
|
||||
pub const HGLRC = *@OpaqueType();
|
||||
pub const FARPROC = *@OpaqueType();
|
||||
pub const HBRUSH = *@Type(.Opaque);
|
||||
pub const HCURSOR = *@Type(.Opaque);
|
||||
pub const HICON = *@Type(.Opaque);
|
||||
pub const HINSTANCE = *@Type(.Opaque);
|
||||
pub const HMENU = *@Type(.Opaque);
|
||||
pub const HMODULE = *@Type(.Opaque);
|
||||
pub const HWND = *@Type(.Opaque);
|
||||
pub const HDC = *@Type(.Opaque);
|
||||
pub const HGLRC = *@Type(.Opaque);
|
||||
pub const FARPROC = *@Type(.Opaque);
|
||||
pub const INT = c_int;
|
||||
pub const LPBYTE = *BYTE;
|
||||
pub const LPCH = *CHAR;
|
||||
|
@ -76,7 +76,7 @@ pub const WPARAM = usize;
|
|||
pub const LPARAM = ?*c_void;
|
||||
pub const LRESULT = ?*c_void;
|
||||
|
||||
pub const va_list = *@OpaqueType();
|
||||
pub const va_list = *@Type(.Opaque);
|
||||
|
||||
pub const TRUE = 1;
|
||||
pub const FALSE = 0;
|
||||
|
@ -1169,10 +1169,10 @@ pub const UNICODE_STRING = extern struct {
|
|||
Buffer: [*]WCHAR,
|
||||
};
|
||||
|
||||
const ACTIVATION_CONTEXT_DATA = @OpaqueType();
|
||||
const ASSEMBLY_STORAGE_MAP = @OpaqueType();
|
||||
const FLS_CALLBACK_INFO = @OpaqueType();
|
||||
const RTL_BITMAP = @OpaqueType();
|
||||
const ACTIVATION_CONTEXT_DATA = @Type(.Opaque);
|
||||
const ASSEMBLY_STORAGE_MAP = @Type(.Opaque);
|
||||
const FLS_CALLBACK_INFO = @Type(.Opaque);
|
||||
const RTL_BITMAP = @Type(.Opaque);
|
||||
pub const PRTL_BITMAP = *RTL_BITMAP;
|
||||
const KAFFINITY = usize;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
usingnamespace @import("bits.zig");
|
||||
|
||||
pub const SOCKET = *@OpaqueType();
|
||||
pub const SOCKET = *@Type(.Opaque);
|
||||
pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0));
|
||||
pub const SOCKET_ERROR = -1;
|
||||
|
||||
|
|
|
@ -1,89 +1,89 @@
|
|||
const builtin = @import("builtin");
|
||||
|
||||
pub const struct_ZigClangConditionalOperator = @OpaqueType();
|
||||
pub const struct_ZigClangBinaryConditionalOperator = @OpaqueType();
|
||||
pub const struct_ZigClangAbstractConditionalOperator = @OpaqueType();
|
||||
pub const struct_ZigClangAPInt = @OpaqueType();
|
||||
pub const struct_ZigClangAPSInt = @OpaqueType();
|
||||
pub const struct_ZigClangAPFloat = @OpaqueType();
|
||||
pub const struct_ZigClangASTContext = @OpaqueType();
|
||||
pub const struct_ZigClangASTUnit = @OpaqueType();
|
||||
pub const struct_ZigClangArraySubscriptExpr = @OpaqueType();
|
||||
pub const struct_ZigClangArrayType = @OpaqueType();
|
||||
pub const struct_ZigClangAttributedType = @OpaqueType();
|
||||
pub const struct_ZigClangBinaryOperator = @OpaqueType();
|
||||
pub const struct_ZigClangBreakStmt = @OpaqueType();
|
||||
pub const struct_ZigClangBuiltinType = @OpaqueType();
|
||||
pub const struct_ZigClangCStyleCastExpr = @OpaqueType();
|
||||
pub const struct_ZigClangCallExpr = @OpaqueType();
|
||||
pub const struct_ZigClangCaseStmt = @OpaqueType();
|
||||
pub const struct_ZigClangCompoundAssignOperator = @OpaqueType();
|
||||
pub const struct_ZigClangCompoundStmt = @OpaqueType();
|
||||
pub const struct_ZigClangConstantArrayType = @OpaqueType();
|
||||
pub const struct_ZigClangContinueStmt = @OpaqueType();
|
||||
pub const struct_ZigClangDecayedType = @OpaqueType();
|
||||
pub const struct_ZigClangDecl = @OpaqueType();
|
||||
pub const struct_ZigClangDeclRefExpr = @OpaqueType();
|
||||
pub const struct_ZigClangDeclStmt = @OpaqueType();
|
||||
pub const struct_ZigClangDefaultStmt = @OpaqueType();
|
||||
pub const struct_ZigClangDiagnosticOptions = @OpaqueType();
|
||||
pub const struct_ZigClangDiagnosticsEngine = @OpaqueType();
|
||||
pub const struct_ZigClangDoStmt = @OpaqueType();
|
||||
pub const struct_ZigClangElaboratedType = @OpaqueType();
|
||||
pub const struct_ZigClangEnumConstantDecl = @OpaqueType();
|
||||
pub const struct_ZigClangEnumDecl = @OpaqueType();
|
||||
pub const struct_ZigClangEnumType = @OpaqueType();
|
||||
pub const struct_ZigClangExpr = @OpaqueType();
|
||||
pub const struct_ZigClangFieldDecl = @OpaqueType();
|
||||
pub const struct_ZigClangFileID = @OpaqueType();
|
||||
pub const struct_ZigClangForStmt = @OpaqueType();
|
||||
pub const struct_ZigClangFullSourceLoc = @OpaqueType();
|
||||
pub const struct_ZigClangFunctionDecl = @OpaqueType();
|
||||
pub const struct_ZigClangFunctionProtoType = @OpaqueType();
|
||||
pub const struct_ZigClangIfStmt = @OpaqueType();
|
||||
pub const struct_ZigClangImplicitCastExpr = @OpaqueType();
|
||||
pub const struct_ZigClangIncompleteArrayType = @OpaqueType();
|
||||
pub const struct_ZigClangIntegerLiteral = @OpaqueType();
|
||||
pub const struct_ZigClangMacroDefinitionRecord = @OpaqueType();
|
||||
pub const struct_ZigClangMacroExpansion = @OpaqueType();
|
||||
pub const struct_ZigClangMacroQualifiedType = @OpaqueType();
|
||||
pub const struct_ZigClangMemberExpr = @OpaqueType();
|
||||
pub const struct_ZigClangNamedDecl = @OpaqueType();
|
||||
pub const struct_ZigClangNone = @OpaqueType();
|
||||
pub const struct_ZigClangOpaqueValueExpr = @OpaqueType();
|
||||
pub const struct_ZigClangPCHContainerOperations = @OpaqueType();
|
||||
pub const struct_ZigClangParenExpr = @OpaqueType();
|
||||
pub const struct_ZigClangParenType = @OpaqueType();
|
||||
pub const struct_ZigClangParmVarDecl = @OpaqueType();
|
||||
pub const struct_ZigClangPointerType = @OpaqueType();
|
||||
pub const struct_ZigClangPreprocessedEntity = @OpaqueType();
|
||||
pub const struct_ZigClangRecordDecl = @OpaqueType();
|
||||
pub const struct_ZigClangRecordType = @OpaqueType();
|
||||
pub const struct_ZigClangReturnStmt = @OpaqueType();
|
||||
pub const struct_ZigClangSkipFunctionBodiesScope = @OpaqueType();
|
||||
pub const struct_ZigClangSourceManager = @OpaqueType();
|
||||
pub const struct_ZigClangSourceRange = @OpaqueType();
|
||||
pub const struct_ZigClangStmt = @OpaqueType();
|
||||
pub const struct_ZigClangStringLiteral = @OpaqueType();
|
||||
pub const struct_ZigClangStringRef = @OpaqueType();
|
||||
pub const struct_ZigClangSwitchStmt = @OpaqueType();
|
||||
pub const struct_ZigClangTagDecl = @OpaqueType();
|
||||
pub const struct_ZigClangType = @OpaqueType();
|
||||
pub const struct_ZigClangTypedefNameDecl = @OpaqueType();
|
||||
pub const struct_ZigClangTypedefType = @OpaqueType();
|
||||
pub const struct_ZigClangUnaryExprOrTypeTraitExpr = @OpaqueType();
|
||||
pub const struct_ZigClangUnaryOperator = @OpaqueType();
|
||||
pub const struct_ZigClangValueDecl = @OpaqueType();
|
||||
pub const struct_ZigClangVarDecl = @OpaqueType();
|
||||
pub const struct_ZigClangWhileStmt = @OpaqueType();
|
||||
pub const struct_ZigClangFunctionType = @OpaqueType();
|
||||
pub const struct_ZigClangPredefinedExpr = @OpaqueType();
|
||||
pub const struct_ZigClangInitListExpr = @OpaqueType();
|
||||
pub const ZigClangPreprocessingRecord = @OpaqueType();
|
||||
pub const ZigClangFloatingLiteral = @OpaqueType();
|
||||
pub const ZigClangConstantExpr = @OpaqueType();
|
||||
pub const ZigClangCharacterLiteral = @OpaqueType();
|
||||
pub const ZigClangStmtExpr = @OpaqueType();
|
||||
pub const struct_ZigClangConditionalOperator = @Type(.Opaque);
|
||||
pub const struct_ZigClangBinaryConditionalOperator = @Type(.Opaque);
|
||||
pub const struct_ZigClangAbstractConditionalOperator = @Type(.Opaque);
|
||||
pub const struct_ZigClangAPInt = @Type(.Opaque);
|
||||
pub const struct_ZigClangAPSInt = @Type(.Opaque);
|
||||
pub const struct_ZigClangAPFloat = @Type(.Opaque);
|
||||
pub const struct_ZigClangASTContext = @Type(.Opaque);
|
||||
pub const struct_ZigClangASTUnit = @Type(.Opaque);
|
||||
pub const struct_ZigClangArraySubscriptExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangArrayType = @Type(.Opaque);
|
||||
pub const struct_ZigClangAttributedType = @Type(.Opaque);
|
||||
pub const struct_ZigClangBinaryOperator = @Type(.Opaque);
|
||||
pub const struct_ZigClangBreakStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangBuiltinType = @Type(.Opaque);
|
||||
pub const struct_ZigClangCStyleCastExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangCallExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangCaseStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangCompoundAssignOperator = @Type(.Opaque);
|
||||
pub const struct_ZigClangCompoundStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangConstantArrayType = @Type(.Opaque);
|
||||
pub const struct_ZigClangContinueStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangDecayedType = @Type(.Opaque);
|
||||
pub const struct_ZigClangDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangDeclRefExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangDeclStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangDefaultStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangDiagnosticOptions = @Type(.Opaque);
|
||||
pub const struct_ZigClangDiagnosticsEngine = @Type(.Opaque);
|
||||
pub const struct_ZigClangDoStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangElaboratedType = @Type(.Opaque);
|
||||
pub const struct_ZigClangEnumConstantDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangEnumDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangEnumType = @Type(.Opaque);
|
||||
pub const struct_ZigClangExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangFieldDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangFileID = @Type(.Opaque);
|
||||
pub const struct_ZigClangForStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangFullSourceLoc = @Type(.Opaque);
|
||||
pub const struct_ZigClangFunctionDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangFunctionProtoType = @Type(.Opaque);
|
||||
pub const struct_ZigClangIfStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangImplicitCastExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangIncompleteArrayType = @Type(.Opaque);
|
||||
pub const struct_ZigClangIntegerLiteral = @Type(.Opaque);
|
||||
pub const struct_ZigClangMacroDefinitionRecord = @Type(.Opaque);
|
||||
pub const struct_ZigClangMacroExpansion = @Type(.Opaque);
|
||||
pub const struct_ZigClangMacroQualifiedType = @Type(.Opaque);
|
||||
pub const struct_ZigClangMemberExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangNamedDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangNone = @Type(.Opaque);
|
||||
pub const struct_ZigClangOpaqueValueExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangPCHContainerOperations = @Type(.Opaque);
|
||||
pub const struct_ZigClangParenExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangParenType = @Type(.Opaque);
|
||||
pub const struct_ZigClangParmVarDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangPointerType = @Type(.Opaque);
|
||||
pub const struct_ZigClangPreprocessedEntity = @Type(.Opaque);
|
||||
pub const struct_ZigClangRecordDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangRecordType = @Type(.Opaque);
|
||||
pub const struct_ZigClangReturnStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangSkipFunctionBodiesScope = @Type(.Opaque);
|
||||
pub const struct_ZigClangSourceManager = @Type(.Opaque);
|
||||
pub const struct_ZigClangSourceRange = @Type(.Opaque);
|
||||
pub const struct_ZigClangStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangStringLiteral = @Type(.Opaque);
|
||||
pub const struct_ZigClangStringRef = @Type(.Opaque);
|
||||
pub const struct_ZigClangSwitchStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangTagDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangType = @Type(.Opaque);
|
||||
pub const struct_ZigClangTypedefNameDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangTypedefType = @Type(.Opaque);
|
||||
pub const struct_ZigClangUnaryExprOrTypeTraitExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangUnaryOperator = @Type(.Opaque);
|
||||
pub const struct_ZigClangValueDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangVarDecl = @Type(.Opaque);
|
||||
pub const struct_ZigClangWhileStmt = @Type(.Opaque);
|
||||
pub const struct_ZigClangFunctionType = @Type(.Opaque);
|
||||
pub const struct_ZigClangPredefinedExpr = @Type(.Opaque);
|
||||
pub const struct_ZigClangInitListExpr = @Type(.Opaque);
|
||||
pub const ZigClangPreprocessingRecord = @Type(.Opaque);
|
||||
pub const ZigClangFloatingLiteral = @Type(.Opaque);
|
||||
pub const ZigClangConstantExpr = @Type(.Opaque);
|
||||
pub const ZigClangCharacterLiteral = @Type(.Opaque);
|
||||
pub const ZigClangStmtExpr = @Type(.Opaque);
|
||||
|
||||
pub const ZigClangBO = extern enum {
|
||||
PtrMemD,
|
||||
|
|
|
@ -4022,7 +4022,8 @@ fn transCreateNodeFloat(c: *Context, int: var) !*ast.Node {
|
|||
}
|
||||
|
||||
fn transCreateNodeOpaqueType(c: *Context) !*ast.Node {
|
||||
const call_node = try transCreateNodeBuiltinFnCall(c, "@OpaqueType");
|
||||
const call_node = try transCreateNodeBuiltinFnCall(c, "@Type");
|
||||
try call_node.params.push(try transCreateNodeEnumLiteral(c, "Opaque"));
|
||||
call_node.rparen_token = try appendToken(c, .RParen, ")");
|
||||
return &call_node.base;
|
||||
}
|
||||
|
|
|
@ -1992,7 +1992,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
});
|
||||
|
||||
cases.add("directly embedding opaque type in struct and union",
|
||||
\\const O = @OpaqueType();
|
||||
\\const O = @Type(.Opaque);
|
||||
\\const Foo = struct {
|
||||
\\ o: O,
|
||||
\\};
|
||||
|
@ -2007,7 +2007,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
\\ var bar: Bar = undefined;
|
||||
\\}
|
||||
\\export fn c() void {
|
||||
\\ var baz: *@OpaqueType() = undefined;
|
||||
\\ var baz: *@Type(.Opaque) = undefined;
|
||||
\\ const qux = .{baz.*};
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
|
@ -2971,7 +2971,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
});
|
||||
|
||||
cases.add("unknown length pointer to opaque",
|
||||
\\export const T = [*]@OpaqueType();
|
||||
\\export const T = [*]@Type(.Opaque);
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:21: error: unknown-length pointer to opaque",
|
||||
});
|
||||
|
@ -6127,8 +6127,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
"tmp.zig:2:31: error: index 2 outside array of size 2",
|
||||
});
|
||||
|
||||
cases.add("wrong pointer coerced to pointer to @OpaqueType()",
|
||||
\\const Derp = @OpaqueType();
|
||||
cases.add("wrong pointer coerced to pointer to @Type(.Opaque)",
|
||||
\\const Derp = @Type(.Opaque);
|
||||
\\extern fn bar(d: *Derp) void;
|
||||
\\export fn foo() void {
|
||||
\\ var x = @as(u8, 1);
|
||||
|
@ -6166,7 +6166,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
\\export fn entry9() void {
|
||||
\\ var z: noreturn = return;
|
||||
\\}
|
||||
\\const Opaque = @OpaqueType();
|
||||
\\const Opaque = @Type(.Opaque);
|
||||
\\const Foo = struct {
|
||||
\\ fn bar(self: *const Foo) void {}
|
||||
\\};
|
||||
|
@ -6320,7 +6320,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
});
|
||||
|
||||
cases.add("field access of opaque type",
|
||||
\\const MyType = @OpaqueType();
|
||||
\\const MyType = @Type(.Opaque);
|
||||
\\
|
||||
\\export fn entry() bool {
|
||||
\\ var x: i32 = 1;
|
||||
|
@ -6936,7 +6936,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
});
|
||||
|
||||
cases.add("function returning opaque type",
|
||||
\\const FooType = @OpaqueType();
|
||||
\\const FooType = @Type(.Opaque);
|
||||
\\export fn bar() !FooType {
|
||||
\\ return error.InvalidValue;
|
||||
\\}
|
||||
|
@ -6954,7 +6954,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
|||
});
|
||||
|
||||
cases.add("generic function returning opaque type",
|
||||
\\const FooType = @OpaqueType();
|
||||
\\const FooType = @Type(.Opaque);
|
||||
\\fn generic(comptime T: type) !T {
|
||||
\\ return undefined;
|
||||
\\}
|
||||
|
|
|
@ -74,7 +74,7 @@ pub fn addCases(cases: *tests.GenHContext) void {
|
|||
});
|
||||
|
||||
cases.add("declare opaque type",
|
||||
\\const Foo = @OpaqueType();
|
||||
\\const Foo = @Type(.Opaque);
|
||||
\\
|
||||
\\export fn entry(foo: ?*Foo) void { }
|
||||
, &[_][]const u8{
|
||||
|
|
|
@ -444,9 +444,9 @@ export fn writeToVRam() void {
|
|||
vram[0] = 'X';
|
||||
}
|
||||
|
||||
const OpaqueA = @OpaqueType();
|
||||
const OpaqueB = @OpaqueType();
|
||||
test "@OpaqueType" {
|
||||
const OpaqueA = @Type(.Opaque);
|
||||
const OpaqueB = @Type(.Opaque);
|
||||
test "opaque types" {
|
||||
expect(*OpaqueA != *OpaqueB);
|
||||
expect(mem.eql(u8, @typeName(OpaqueA), "OpaqueA"));
|
||||
expect(mem.eql(u8, @typeName(OpaqueB), "OpaqueB"));
|
||||
|
|
|
@ -36,9 +36,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
|||
\\struct foo { int x; int y[]; };
|
||||
\\struct bar { int x; int y[0]; };
|
||||
, &[_][]const u8{
|
||||
\\pub const struct_foo = @OpaqueType();
|
||||
\\pub const struct_foo = @Type(.Opaque);
|
||||
,
|
||||
\\pub const struct_bar = @OpaqueType();
|
||||
\\pub const struct_bar = @Type(.Opaque);
|
||||
});
|
||||
|
||||
cases.add("nested loops without blocks",
|
||||
|
@ -106,7 +106,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
|||
\\pub const struct_arcan_shmif_page = //
|
||||
,
|
||||
\\warning: unsupported type: 'Atomic'
|
||||
\\ @OpaqueType(); //
|
||||
\\ @Type(.Opaque); //
|
||||
,
|
||||
\\ warning: struct demoted to opaque type - unable to translate type of field abufused
|
||||
, // TODO should be `addr: *struct_arcan_shmif_page`
|
||||
|
@ -285,8 +285,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
|||
\\ struct opaque_2 *cast = (struct opaque_2 *)opaque;
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
\\pub const struct_opaque = @OpaqueType();
|
||||
\\pub const struct_opaque_2 = @OpaqueType();
|
||||
\\pub const struct_opaque = @Type(.Opaque);
|
||||
\\pub const struct_opaque_2 = @Type(.Opaque);
|
||||
\\pub export fn function(arg_opaque_1: ?*struct_opaque) void {
|
||||
\\ var opaque_1 = arg_opaque_1;
|
||||
\\ var cast: ?*struct_opaque_2 = @ptrCast(?*struct_opaque_2, opaque_1);
|
||||
|
@ -524,7 +524,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
|||
\\ struct Foo *foo;
|
||||
\\};
|
||||
, &[_][]const u8{
|
||||
\\pub const struct_Foo = @OpaqueType();
|
||||
\\pub const struct_Foo = @Type(.Opaque);
|
||||
,
|
||||
\\pub const struct_Bar = extern struct {
|
||||
\\ foo: ?*struct_Foo,
|
||||
|
@ -601,7 +601,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
|||
\\struct Foo;
|
||||
\\struct Foo *some_func(struct Foo *foo, int x);
|
||||
, &[_][]const u8{
|
||||
\\pub const struct_Foo = @OpaqueType();
|
||||
\\pub const struct_Foo = @Type(.Opaque);
|
||||
,
|
||||
\\pub extern fn some_func(foo: ?*struct_Foo, x: c_int) ?*struct_Foo;
|
||||
,
|
||||
|
|
Loading…
Reference in New Issue