From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id D108D98C12A; Fri, 19 Jan 2024 14:47:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D108D98C12A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1705664823; bh=Az/MXXnu8DSqMTsQGMnSx3huqG2jpRPbKN2ynJC3NVI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ifO3L7/+osKkoNonnHsnht4gHEwhPb/e4FHRTnUo/XIcep4NR6zppA1MBwk31CL7n PuTiBpWADEH62YUZ/gkrjCLxbs248YH/F6uola0d38Lpl9Vnsq5YmjvA362etx5X0W 50E6eKt3qfP6fxlzrzNHWGTg2iokW8wVJPU0kTBQ= Received: from smtp16.i.mail.ru (smtp16.i.mail.ru [95.163.41.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4A304988E43 for ; Fri, 19 Jan 2024 14:37:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4A304988E43 Received: by smtp16.i.mail.ru with esmtpa (envelope-from ) id 1rQnBi-00FDC7-1i; Fri, 19 Jan 2024 14:37:31 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Fri, 19 Jan 2024 14:32:43 +0300 Message-ID: <9774772ca9d917abf7ff886bfe1d5529db263547.1705661401.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9C4CE30293DC5317395D6394F36AD8F79D705B8024BA04EFB1313CFAB8367EF908E2BE116634AD74DA677A7E032BEFA6A65762D6AFAB5AA5F88687216CC303E0C85807EF2F34B1E1E X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F65C230EDDCD559EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378CE8F54174C31B858638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D86AEB15147AE2DF71F3BE0EE06B70AEC7117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC1BE95B8C87527B4BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269176DF2183F8FC7C0FE3A47D6FA29121068655334FD4449CB33AC447995A7AD1857739F23D657EF2BD5E8D9A59859A8B68A0907C648FB30DE089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A53EF3375EE3B07EC33DE3FD803DF40A2F768D43959CACA240F87CCE6106E1FC07E67D4AC08A07B9B0034D30FDF2F620DB9C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFB8719212D08958DB0A32FC21B6A2584B8DD177993FE227863848B65D6ADCDD6F7D7FE2FA29F577876197189FEE4B1C7AC0256FBDA70BB10C99E3B059E01D3BCFA74DFFEFA5DC0E7F02C26D483E81D6BE5EF9655DD6DEA7D65774BB76CC95456EEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojJsr4kcGAUCNBukTmctdxTQ== X-DA7885C5: CF6CE1F38A9C015F22358C9D20223E7B3A8C708C4BA6C40FAFA485B18079B831D8288D6B1992AB67EF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393590D8C940224AE3392B1CC3B2242749A399D3B9A2570F5E90FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 20/25] test: enable LuaJIT test X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch changes `dofile()` to the corresponding `require()` of the helper functions. It adds groups with the names of subtests and enables the test in . Part of tarantool/tarantool#9398 --- .../LuaJIT-tests/lib/ffi/ffi_parse_struct.lua | 335 +++++++++--------- test/LuaJIT-tests/lib/ffi/index | 1 + 2 files changed, 176 insertions(+), 160 deletions(-) diff --git a/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua b/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua index 16a3d053..cb231c33 100644 --- a/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua +++ b/test/LuaJIT-tests/lib/ffi/ffi_parse_struct.lua @@ -1,113 +1,123 @@ local ffi = require("ffi") -dofile("../common/ffi_util.inc") +local checkfail = require("common.ffi.checkfail") +local checktypes = require("common.ffi.checktypes") +local fails = require("common.fails") -checkfail{ - "struct", - "struct {", - "struct xx xx {}", - "struct { int x }", - "struct { int x, }", - "struct { int x,y }", - "struct { void x; }", - "struct { int x(void); }", - "struct recursive1 { struct recursive1 { } x; }", - "union", - "union {", - "union xx xx {}", - "union { int x }", - "union { int x, }", - "union { int x,y }", - "union { void x; }", - "union { int x(void); }", - "union recursive1 { union recursive1 { } x; }", -} +local P = ffi.sizeof("void *") +local A = (ffi.arch == "x86" and not ffi.abi("win")) and 4 or 8 + +do --- checkfail + checkfail{ + "struct", + "struct {", + "struct xx xx {}", + "struct { int x }", + "struct { int x, }", + "struct { int x,y }", + "struct { void x; }", + "struct { int x(void); }", + "struct recursive1 { struct recursive1 { } x; }", + "union", + "union {", + "union xx xx {}", + "union { int x }", + "union { int x, }", + "union { int x,y }", + "union { void x; }", + "union { int x(void); }", + "union recursive1 { union recursive1 { } x; }", + } +end -- NYI: rollback doesn't recover struct state -- ffi.cdef("struct zzz") -- fails(ffi.cdef, "struct zzz { int") -- ffi.cdef("struct zzz { int x; }") -ffi.cdef("struct foo; typedef struct foo foo_t;") -assert(ffi.sizeof("struct foo") == nil) -assert(ffi.sizeof("foo_t") == nil) -ffi.cdef("struct foo { int x,y; };") -assert(ffi.sizeof("struct foo") == 8) -assert(ffi.sizeof("foo_t") == 8) -assert(ffi.sizeof(ffi.typeof("struct foo")) == 8) -assert(ffi.sizeof(ffi.typeof("foo_t")) == 8) -ffi.cdef("struct foo;") -fails(ffi.cdef, "struct foo {};") -fails(ffi.cdef, "union foo;") -fails(ffi.cdef, "union foo {};") -fails(ffi.cdef, "enum foo;") -fails(ffi.cdef, "enum foo { ZZZ1 };") - -local P = ffi.sizeof("void *") -local A = (ffi.arch == "x86" and not ffi.abi("win")) and 4 or 8 +do --- siezeofs and invalid decalarations + ffi.cdef("struct foo; typedef struct foo struct_foo_t;") + assert(ffi.sizeof("struct foo") == nil) + assert(ffi.sizeof("struct_foo_t") == nil) + ffi.cdef("struct foo { int x,y; };") + assert(ffi.sizeof("struct foo") == 8) + assert(ffi.sizeof("struct_foo_t") == 8) + assert(ffi.sizeof(ffi.typeof("struct foo")) == 8) + assert(ffi.sizeof(ffi.typeof("struct_foo_t")) == 8) + ffi.cdef("struct foo;") + fails(ffi.cdef, "struct foo {};") + fails(ffi.cdef, "union foo;") + fails(ffi.cdef, "union foo {};") + fails(ffi.cdef, "enum foo;") + fails(ffi.cdef, "enum foo { ZZZ1 };") +end -checktypes{ - 0, 1, "struct {}", - 1, 1, "struct { char x; }", - 2, 1, "struct { char x,y; }", - 4, 1, "struct { char x,y; char a,b; }", - 4, 2, "struct { char x; short y; }", - 4, 2, "struct { short x; char y; }", - 8, 4, "struct { char x; int y; }", - 8, 4, "struct { int x; char y; }", - 12, 4, "struct { char x; int y; char z; }", - P*4, P, "struct { char x,*y,**z,a,b,c,d; }", - 64, 4, "struct { struct { struct { struct { int x,y; } a,b; } a,b; } a,b; }", - 4, 4, "struct { struct { struct { struct { int x; }; }; }; }", - 8, 4, "struct { struct foo; }", - 8, 4, "struct { foo_t; }", - 8, 8, "struct __attribute__((aligned(sizeof(foo_t)))) { int a; }", - 6, 2, "struct { char a; char x; short y; char z; char c; }", - 10, 2, "struct { char a; struct { char x; short y; char z; } b; char c; }", - 8, A, "struct { double a; }", - A+8, A, "struct { int a; double b; }", - 8, A, "struct { long long a; }", - A+8, A, "struct { int a; long long b; }", - 16, A, "struct { _Complex a; }", - A+16, A, "struct { int a; _Complex b; }", - 8, 8, "struct { float __attribute__((mode(__V2SF__))) a; }", - 16, 8, "struct { int a; float __attribute__((mode(__V2SF__))) b; }", - 16, 8, "struct { float __attribute__((mode(__V2SF__))) a[2]; }", - 24, 8, "struct { int a; float __attribute__((mode(__V2SF__))) b[2]; }", - 16, 16, "struct { float __attribute__((vector_size(16))) a; }", - 32, 16, "struct { int a; float __attribute__((vector_size(16))) b; }", -} +do --- struct base + checktypes{ + 0, 1, "struct {}", + 1, 1, "struct { char x; }", + 2, 1, "struct { char x,y; }", + 4, 1, "struct { char x,y; char a,b; }", + 4, 2, "struct { char x; short y; }", + 4, 2, "struct { short x; char y; }", + 8, 4, "struct { char x; int y; }", + 8, 4, "struct { int x; char y; }", + 12, 4, "struct { char x; int y; char z; }", + P*4, P, "struct { char x,*y,**z,a,b,c,d; }", + 64, 4, "struct { struct { struct { struct { int x,y; } a,b; } a,b; } a,b; }", + 4, 4, "struct { struct { struct { struct { int x; }; }; }; }", + 8, 4, "struct { struct foo; }", + 8, 4, "struct { struct_foo_t; }", + 8, 8, "struct __attribute__((aligned(sizeof(struct_foo_t)))) { int a; }", + 6, 2, "struct { char a; char x; short y; char z; char c; }", + 10, 2, "struct { char a; struct { char x; short y; char z; } b; char c; }", + 8, A, "struct { double a; }", + A+8, A, "struct { int a; double b; }", + 8, A, "struct { long long a; }", + A+8, A, "struct { int a; long long b; }", + 16, A, "struct { _Complex a; }", + A+16, A, "struct { int a; _Complex b; }", + 8, 8, "struct { float __attribute__((mode(__V2SF__))) a; }", + 16, 8, "struct { int a; float __attribute__((mode(__V2SF__))) b; }", + 16, 8, "struct { float __attribute__((mode(__V2SF__))) a[2]; }", + 24, 8, "struct { int a; float __attribute__((mode(__V2SF__))) b[2]; }", + 16, 16, "struct { float __attribute__((vector_size(16))) a; }", + 32, 16, "struct { int a; float __attribute__((vector_size(16))) b; }", + } +end -checktypes{ - 0, 1, "union {}", - 1, 1, "union { char x; }", - 1, 1, "union { char x,y; }", - 2, 2, "union { char x; short y; }", - 2, 2, "union { short x; char y; }", - 4, 4, "union { char x; int y; }", - 4, 4, "union { int x; char y; }", - 4, 4, "union { char x; int y; short z; }", - P, P, "union { char x,*y,**z,a,b,c,d; }", - 4, 4, "union { union { union { union { int x,y; } a,b; } a,b; } a,b; }", - 4, 4, "union { union { union { union { int x; }; }; }; }", - 2, 2, "union { union { short x; }; char y; }", - 2, 2, "union { struct { short x; }; char y; }", - 4, 2, "struct { union { short x; }; char y; }", - 2, 1, "union { struct { char a,b; }; char y; }", - 2, 1, "struct { union { char a,b; }; char y; }", - 8, A, "union { double a; }", - 8, A, "union { int a; double b; }", - 8, A, "union { long long a; }", - 8, A, "union { int a; long long b; }", - 16, A, "union { _Complex a; }", - 16, A, "union { int a; _Complex b; }", - 8, 8, "union { float __attribute__((mode(__V2SF__))) a; }", - 8, 8, "union { int a; float __attribute__((mode(__V2SF__))) b; }", - 16, 16, "union { float __attribute__((vector_size(16))) a; }", - 16, 16, "union { int a; float __attribute__((vector_size(16))) b; }", -} +do --- unions + checktypes{ + 0, 1, "union {}", + 1, 1, "union { char x; }", + 1, 1, "union { char x,y; }", + 2, 2, "union { char x; short y; }", + 2, 2, "union { short x; char y; }", + 4, 4, "union { char x; int y; }", + 4, 4, "union { int x; char y; }", + 4, 4, "union { char x; int y; short z; }", + P, P, "union { char x,*y,**z,a,b,c,d; }", + 4, 4, "union { union { union { union { int x,y; } a,b; } a,b; } a,b; }", + 4, 4, "union { union { union { union { int x; }; }; }; }", + 2, 2, "union { union { short x; }; char y; }", + 2, 2, "union { struct { short x; }; char y; }", + 4, 2, "struct { union { short x; }; char y; }", + 2, 1, "union { struct { char a,b; }; char y; }", + 2, 1, "struct { union { char a,b; }; char y; }", + 8, A, "union { double a; }", + 8, A, "union { int a; double b; }", + 8, A, "union { long long a; }", + 8, A, "union { int a; long long b; }", + 16, A, "union { _Complex a; }", + 16, A, "union { int a; _Complex b; }", + 8, 8, "union { float __attribute__((mode(__V2SF__))) a; }", + 8, 8, "union { int a; float __attribute__((mode(__V2SF__))) b; }", + 16, 16, "union { float __attribute__((vector_size(16))) a; }", + 16, 16, "union { int a; float __attribute__((vector_size(16))) b; }", + } +end -do +do --- struct offsetof local ct ct = ffi.typeof("struct { int a; char b; short c; int d; }") assert(ffi.offsetof(ct, "a") == 0) @@ -129,40 +139,44 @@ do assert(ffi.offsetof(ct, "b") == A) end -checkfail{ - "struct { int :; }", - "struct { int a:; }", - "struct { int a:bad; }", - "struct { int a:0; }", - "struct { int a:33; }", - "struct { int a:-1; }", - "struct { _Bool a:2; }", - "struct { double a:2; }", - "struct { complex a:2; }", - "struct { int __attribute__((mode(__TI__))) a:2; }", - "struct { int __attribute__((vector_size(16))) a:2; }", - "struct { int a[2]:2; }", - "struct { void a:2; }", -} +do --- checkfail bitfields + checkfail{ + "struct { int :; }", + "struct { int a:; }", + "struct { int a:bad; }", + "struct { int a:0; }", + "struct { int a:33; }", + "struct { int a:-1; }", + "struct { _Bool a:2; }", + "struct { double a:2; }", + "struct { complex a:2; }", + "struct { int __attribute__((mode(__TI__))) a:2; }", + "struct { int __attribute__((vector_size(16))) a:2; }", + "struct { int a[2]:2; }", + "struct { void a:2; }", + } +end -checktypes{ - 4, 4, "struct { unsigned a:1; }", - 4, 4, "struct { unsigned a:1, b:1, c:1; }", - 1, 1, "struct { _Bool a:1, b:1, c:1; }", - 8, 4, "struct { unsigned a:16, b:16, c:16; }", - 8, 4, "struct { unsigned a:17, b:16, c:16; }", - 12, 4, "struct { unsigned a:17, b:16, c:17; }", - 12, 4, "struct { unsigned a:16, b:17, c:16; }", - 8, 4, "struct { unsigned a:16, :16, c:16; }", - 8, 4, "struct { unsigned a:17, :16, c:16; }", - 12, 4, "struct { unsigned a:17, :16, c:17; }", - 12, 4, "struct { unsigned a:16, :17, c:16; }", - 8, 4, "struct { unsigned a:16, :0, c:16; }", - 4, 4, "struct { unsigned a:16, b:16, :0, :0; }", - 8, 4, "struct { unsigned a:16, :0, :0, :0, c:16; }", - 1, 1, "struct { char a:1; _Bool b:1; }", - 1, 1, "struct { char a:1; signed char b:1; unsigned char c:1; }", -} +do --- bitfields + checktypes{ + 4, 4, "struct { unsigned a:1; }", + 4, 4, "struct { unsigned a:1, b:1, c:1; }", + 1, 1, "struct { _Bool a:1, b:1, c:1; }", + 8, 4, "struct { unsigned a:16, b:16, c:16; }", + 8, 4, "struct { unsigned a:17, b:16, c:16; }", + 12, 4, "struct { unsigned a:17, b:16, c:17; }", + 12, 4, "struct { unsigned a:16, b:17, c:16; }", + 8, 4, "struct { unsigned a:16, :16, c:16; }", + 8, 4, "struct { unsigned a:17, :16, c:16; }", + 12, 4, "struct { unsigned a:17, :16, c:17; }", + 12, 4, "struct { unsigned a:16, :17, c:16; }", + 8, 4, "struct { unsigned a:16, :0, c:16; }", + 4, 4, "struct { unsigned a:16, b:16, :0, :0; }", + 8, 4, "struct { unsigned a:16, :0, :0, :0, c:16; }", + 1, 1, "struct { char a:1; _Bool b:1; }", + 1, 1, "struct { char a:1; signed char b:1; unsigned char c:1; }", + } +end -- NYI: bit fields > 32 bit -- local L = ffi.alignof("struct { long long a; }") @@ -170,35 +184,36 @@ checktypes{ -- L, L, "struct { long long a:1; }", -- } --- Bit field packing. -checktypes{ - 1, 1, "struct { _Bool a:1, b:1, c:1; }", - 4, 4, "struct { short a:9; int b:9; char c; }", - 4, 4, "struct { char a; int b:7; }", - 4, 4, "struct { short a; char b; int c:7; }", - 4, 4, "struct { char a:7; int b:7; int c:7; int d:10; }", - 4, 1, "struct { char a:7; char b:7; char c:7; char d:7; }", - 4, 4, "struct { char a:7; int b:7, c:7, d:7; int e:4; }", - 4, 4, "struct { char a:7; int b:7, c:7, d:7; char e:4; }", - 5, 1, "struct { char a:7; char b:7, c:7, d:7; char e:4; }", - 4, 1, "struct __attribute__((packed)) { char a:7; char b:7, c:7, d:7; char e:4; }", - 4, 4, "struct { char a:7; int b:7; int c:7; int d:10; }", - 8, 4, "struct { char a:7; int b:7; char c:7; int d:10; }", - 4, 1, "struct __attribute__((packed)) { char a:7; int b:7; char c:7; int d:10; }", - 4, 1, "struct { char a:7; int b:7; char c:7; int d:10; } __attribute__((packed))", - 2, 1, "struct __attribute__((packed)) { char a:4; char b:8; }", - 2, 1, "struct __attribute__((packed)) { char a:4; char :0; char b:4; }", - 1, 1, "struct __attribute__((packed)) { _Bool a:1; _Bool b:1; }", - 2, 1, "struct __attribute__((packed)) { _Bool a:1; _Bool b:1 __attribute((aligned(1))); }", - 4, 2, "struct __attribute__((packed)) { _Bool a:1; _Bool b:1 __attribute((aligned(2))); }", - 8, 4, "struct { _Bool a:1; int b __attribute((aligned(2))); }", - 16, 8, "struct { _Bool a:1; int b __attribute((aligned(8))); }", - 6, 2, "struct { _Bool a:1; int b __attribute((aligned(2))) __attribute((packed)); }", - 6, 2, "struct __attribute__((packed)) { _Bool a:1; int b __attribute((aligned(2))); }", - 6, 2, "struct __attribute__((packed)) { _Bool a:1; int b __attribute((aligned(2))) __attribute((packed)); }", -} +do --- Bit field packing. + checktypes{ + 1, 1, "struct { _Bool a:1, b:1, c:1; }", + 4, 4, "struct { short a:9; int b:9; char c; }", + 4, 4, "struct { char a; int b:7; }", + 4, 4, "struct { short a; char b; int c:7; }", + 4, 4, "struct { char a:7; int b:7; int c:7; int d:10; }", + 4, 1, "struct { char a:7; char b:7; char c:7; char d:7; }", + 4, 4, "struct { char a:7; int b:7, c:7, d:7; int e:4; }", + 4, 4, "struct { char a:7; int b:7, c:7, d:7; char e:4; }", + 5, 1, "struct { char a:7; char b:7, c:7, d:7; char e:4; }", + 4, 1, "struct __attribute__((packed)) { char a:7; char b:7, c:7, d:7; char e:4; }", + 4, 4, "struct { char a:7; int b:7; int c:7; int d:10; }", + 8, 4, "struct { char a:7; int b:7; char c:7; int d:10; }", + 4, 1, "struct __attribute__((packed)) { char a:7; int b:7; char c:7; int d:10; }", + 4, 1, "struct { char a:7; int b:7; char c:7; int d:10; } __attribute__((packed))", + 2, 1, "struct __attribute__((packed)) { char a:4; char b:8; }", + 2, 1, "struct __attribute__((packed)) { char a:4; char :0; char b:4; }", + 1, 1, "struct __attribute__((packed)) { _Bool a:1; _Bool b:1; }", + 2, 1, "struct __attribute__((packed)) { _Bool a:1; _Bool b:1 __attribute((aligned(1))); }", + 4, 2, "struct __attribute__((packed)) { _Bool a:1; _Bool b:1 __attribute((aligned(2))); }", + 8, 4, "struct { _Bool a:1; int b __attribute((aligned(2))); }", + 16, 8, "struct { _Bool a:1; int b __attribute((aligned(8))); }", + 6, 2, "struct { _Bool a:1; int b __attribute((aligned(2))) __attribute((packed)); }", + 6, 2, "struct __attribute__((packed)) { _Bool a:1; int b __attribute((aligned(2))); }", + 6, 2, "struct __attribute__((packed)) { _Bool a:1; int b __attribute((aligned(2))) __attribute((packed)); }", + } +end -do +do --- pragma pack pop ffi.cdef[[ struct foo_packorig { char a; int b; short c; }; #pragma pack(1) @@ -236,7 +251,7 @@ do assert(ffi.sizeof("struct foo_packpop2") == 12) end -do +do --- pragma pack aligment ffi.cdef[[ #pragma pack(2) struct foo_packalign8 { diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index index 12b6387f..e3a34e30 100644 --- a/test/LuaJIT-tests/lib/ffi/index +++ b/test/LuaJIT-tests/lib/ffi/index @@ -19,6 +19,7 @@ ffi_new.lua ffi_parse_array.lua ffi_parse_basic.lua ffi_parse_cdef.lua +ffi_parse_struct.lua istype.lua jit_array.lua jit_complex.lua -- 2.43.0