mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Rollback global.
This commit is contained in:
@@ -6,7 +6,7 @@ struct Foo
|
||||
int x, y;
|
||||
}
|
||||
|
||||
private global Foo[10] array;
|
||||
private Foo[10] array;
|
||||
|
||||
// #expect: test.ll
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ struct Connection
|
||||
long length;
|
||||
}
|
||||
|
||||
private global Connection[3] link
|
||||
private Connection[3] link
|
||||
= { {1, "link1", 10},
|
||||
{2, "link2", 20},
|
||||
{3, "link3", 30} };
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
module test;
|
||||
|
||||
|
||||
global int*[] blurp = { &ptr, &ptr, (&ptr + 1), &ptr - 1, (int*)((iptr)(&ptr) - 4) };
|
||||
global int* c = (int*)((iptr)(&ptr) - 4);
|
||||
global int* c2 = (int*)((iptr)(&ptr) + 4);
|
||||
global int* c3 = (int*)(4 + (iptr)(&ptr));
|
||||
global iptr ff = (iptr)(&ptr);
|
||||
global int ptr = 0;
|
||||
int*[] blurp = { &ptr, &ptr, (&ptr + 1), &ptr - 1, (int*)((iptr)(&ptr) - 4) };
|
||||
int* c = (int*)((iptr)(&ptr) - 4);
|
||||
int* c2 = (int*)((iptr)(&ptr) + 4);
|
||||
int* c3 = (int*)(4 + (iptr)(&ptr));
|
||||
iptr ff = (iptr)(&ptr);
|
||||
int ptr = 0;
|
||||
|
||||
// #expect: test.ll
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ $else:
|
||||
$elif (0):
|
||||
$elif (0):
|
||||
$else:
|
||||
global int x = 1;
|
||||
int x = 1;
|
||||
$endif;
|
||||
$endif;
|
||||
|
||||
@@ -18,7 +18,7 @@ $endif;
|
||||
|
||||
$if (1):
|
||||
$assert(true);
|
||||
global int d = 5;
|
||||
int d = 5;
|
||||
$elif (0):
|
||||
$assert(false);
|
||||
$else:
|
||||
@@ -29,7 +29,7 @@ $if (0):
|
||||
$assert(true);
|
||||
$elif (1):
|
||||
$assert(true);
|
||||
global int c = 5;
|
||||
int c = 5;
|
||||
$else:
|
||||
$assert(false);
|
||||
$endif;
|
||||
@@ -38,7 +38,7 @@ $if (0):
|
||||
$assert(true);
|
||||
$elif (1):
|
||||
$assert(true);
|
||||
global int b = 4;
|
||||
int b = 4;
|
||||
$elif (0):
|
||||
$assert(false);
|
||||
$else:
|
||||
@@ -51,7 +51,7 @@ $elif (0):
|
||||
$assert(false);
|
||||
$elif (1):
|
||||
$assert(true);
|
||||
global int a = 3;
|
||||
int a = 3;
|
||||
$else:
|
||||
$assert(false);
|
||||
$endif;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// #target: x64-darwin
|
||||
|
||||
global int foo = 2.2 ? 1 : 2;
|
||||
global double bar = false ? 1.0 : 2;
|
||||
global bool baz = 1 ? false : true;
|
||||
int foo = 2.2 ? 1 : 2;
|
||||
double bar = false ? 1.0 : 2;
|
||||
bool baz = 1 ? false : true;
|
||||
|
||||
fn void test()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// #target: x64-darwin
|
||||
module foo;
|
||||
|
||||
global int[100] zfe;
|
||||
int[100] zfe;
|
||||
struct Bob
|
||||
{
|
||||
Bob[] x;
|
||||
@@ -37,29 +37,29 @@ union Foob
|
||||
Ar izzy;
|
||||
|
||||
|
||||
global long x = $alignof(zfe);
|
||||
global short y = $alignof("Bob.y");
|
||||
global int z = $alignof("Bob.y");
|
||||
global int w = $alignof(Bob.y);
|
||||
global int v = $alignof(v);
|
||||
global int x1 = $alignof("Ex.c");
|
||||
global int x2 = $alignof(Ex.y);
|
||||
global int x3 = $alignof(char[8]);
|
||||
global int x4 = $alignof("Ar.br[1]");
|
||||
global int x5 = $alignof(Ar.br[1]);
|
||||
global int x6 = $alignof(Ar.br[1]);
|
||||
global int x7 = $alignof(Ar.br[1]);
|
||||
global int x8 = $alignof(Ar.br[2]);
|
||||
global int x9 = $alignof("izzy.br[1]");
|
||||
global int x10 = $alignof("izzy.br[1]");
|
||||
global int x11 = $alignof(izzy.br[1]);
|
||||
global int z0 = $alignof("Foob.c");
|
||||
global int z00 = $alignof("Foob.c[0]");
|
||||
global int z01 = $alignof("Foob.c[1]");
|
||||
global int z02 = $alignof("Foob.c[2]");
|
||||
global int z03 = $alignof("Foob.c[3]");
|
||||
global int z04 = $alignof("Foob.c[4]");
|
||||
global int z05 = $alignof("Foob.c[5]");
|
||||
long x = $alignof(zfe);
|
||||
short y = $alignof("Bob.y");
|
||||
int z = $alignof("Bob.y");
|
||||
int w = $alignof(Bob.y);
|
||||
int v = $alignof(v);
|
||||
int x1 = $alignof("Ex.c");
|
||||
int x2 = $alignof(Ex.y);
|
||||
int x3 = $alignof(char[8]);
|
||||
int x4 = $alignof("Ar.br[1]");
|
||||
int x5 = $alignof(Ar.br[1]);
|
||||
int x6 = $alignof(Ar.br[1]);
|
||||
int x7 = $alignof(Ar.br[1]);
|
||||
int x8 = $alignof(Ar.br[2]);
|
||||
int x9 = $alignof("izzy.br[1]");
|
||||
int x10 = $alignof("izzy.br[1]");
|
||||
int x11 = $alignof(izzy.br[1]);
|
||||
int z0 = $alignof("Foob.c");
|
||||
int z00 = $alignof("Foob.c[0]");
|
||||
int z01 = $alignof("Foob.c[1]");
|
||||
int z02 = $alignof("Foob.c[2]");
|
||||
int z03 = $alignof("Foob.c[3]");
|
||||
int z04 = $alignof("Foob.c[4]");
|
||||
int z05 = $alignof("Foob.c[5]");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// #target: x64-darwin
|
||||
module foo;
|
||||
|
||||
global int[100] zfe;
|
||||
int[100] zfe;
|
||||
struct Bob
|
||||
{
|
||||
Bob[] x;
|
||||
@@ -36,21 +36,21 @@ union Foob
|
||||
}
|
||||
|
||||
|
||||
global short y = $offsetof("Bob.y");
|
||||
global int z = $offsetof("Bob.y");
|
||||
global int w = $offsetof(Bob.y);
|
||||
global int x1 = $offsetof("Ex.c[3]");
|
||||
global int x2 = $offsetof("Ex.y[1]");
|
||||
global int x4 = $offsetof("Ar.br[1]");
|
||||
global int x6 = $offsetof(Ar.br[1].x);
|
||||
global int x5 = $offsetof(Ar.br[1]);
|
||||
global int x7 = $offsetof("Ar.br[2].x");
|
||||
global int x8 = $offsetof(Ar.br[2]);
|
||||
global int z0 = $offsetof("Foob.c");
|
||||
global int z00 = $offsetof("Foob.c[0]");
|
||||
global int z01 = $offsetof("Foob.c[1]");
|
||||
global int z02 = $offsetof("Foob.c[5]");
|
||||
global int z03 = $offsetof("Foob.a");
|
||||
short y = $offsetof("Bob.y");
|
||||
int z = $offsetof("Bob.y");
|
||||
int w = $offsetof(Bob.y);
|
||||
int x1 = $offsetof("Ex.c[3]");
|
||||
int x2 = $offsetof("Ex.y[1]");
|
||||
int x4 = $offsetof("Ar.br[1]");
|
||||
int x6 = $offsetof(Ar.br[1].x);
|
||||
int x5 = $offsetof(Ar.br[1]);
|
||||
int x7 = $offsetof("Ar.br[2].x");
|
||||
int x8 = $offsetof(Ar.br[2]);
|
||||
int z0 = $offsetof("Foob.c");
|
||||
int z00 = $offsetof("Foob.c[0]");
|
||||
int z01 = $offsetof("Foob.c[1]");
|
||||
int z02 = $offsetof("Foob.c[5]");
|
||||
int z03 = $offsetof("Foob.a");
|
||||
|
||||
// #expect: foo.ll
|
||||
@foo.y = global i16 16, align 2
|
||||
|
||||
@@ -2,22 +2,22 @@ module foo;
|
||||
import bar;
|
||||
import bar::abc;
|
||||
|
||||
global long x = $sizeof(Baz);
|
||||
global short y = $sizeof("Baz");
|
||||
global int z = $sizeof(bar::Baz);
|
||||
global int w = $sizeof("bar::Baz");
|
||||
global int v = $sizeof("bar::abc::Foo");
|
||||
global int x1 = $sizeof(x);
|
||||
global int y1 = $sizeof("y");
|
||||
global int a = $sizeof("Baz.y");
|
||||
global int b = $sizeof("Deep.a.b");
|
||||
global int c = $sizeof("Deep.a.b.c");
|
||||
global int d = $sizeof("Deep[][100]");
|
||||
global int e = $sizeof("Deep[][100]**[100][]*");
|
||||
global int a2 = $sizeof("Baz.y");
|
||||
global int a3 = $sizeof(Baz.y);
|
||||
global int a4 = $sizeof(Baz.y);
|
||||
global int a5 = $sizeof(Baz.y);
|
||||
long x = $sizeof(Baz);
|
||||
short y = $sizeof("Baz");
|
||||
int z = $sizeof(bar::Baz);
|
||||
int w = $sizeof("bar::Baz");
|
||||
int v = $sizeof("bar::abc::Foo");
|
||||
int x1 = $sizeof(x);
|
||||
int y1 = $sizeof("y");
|
||||
int a = $sizeof("Baz.y");
|
||||
int b = $sizeof("Deep.a.b");
|
||||
int c = $sizeof("Deep.a.b.c");
|
||||
int d = $sizeof("Deep[][100]");
|
||||
int e = $sizeof("Deep[][100]**[100][]*");
|
||||
int a2 = $sizeof("Baz.y");
|
||||
int a3 = $sizeof(Baz.y);
|
||||
int a4 = $sizeof(Baz.y);
|
||||
int a5 = $sizeof(Baz.y);
|
||||
|
||||
module bar;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
global char[*] foob = x"a0";
|
||||
global char[*] fooz = x"00aabbccddeeff";
|
||||
global char[*] fooy = x'dead beef';
|
||||
global char[*] foow = x"4549234d e d";
|
||||
global char[*] foo64 = b64"SGVsbG8gV29ybGQ=";
|
||||
char[*] foob = x"a0";
|
||||
char[*] fooz = x"00aabbccddeeff";
|
||||
char[*] fooy = x'dead beef';
|
||||
char[*] foow = x"4549234d e d";
|
||||
char[*] foo64 = b64"SGVsbG8gV29ybGQ=";
|
||||
|
||||
// #expect: byte_literals.ll
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// #file: file1.c3
|
||||
module test;
|
||||
|
||||
global char a = ' ';
|
||||
global char b = '\r';
|
||||
global char c = '\t';
|
||||
global char d = '\n';
|
||||
global char e = '\0';
|
||||
global char f = '\'';
|
||||
global char g = '"';
|
||||
global char h = '\\';
|
||||
global char i = '\e';
|
||||
char a = ' ';
|
||||
char b = '\r';
|
||||
char c = '\t';
|
||||
char d = '\n';
|
||||
char e = '\0';
|
||||
char f = '\'';
|
||||
char g = '"';
|
||||
char h = '\\';
|
||||
char i = '\e';
|
||||
|
||||
// #expect: test.ll
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ private const uint DD = FOO;
|
||||
|
||||
private const FOO = ~(uint)(0);
|
||||
|
||||
private global uint x = AA;
|
||||
private global uint z = CC;
|
||||
private global char w = (char)(FOO);
|
||||
private global ushort v = (ushort)(FOO);
|
||||
private global uint z2 = DD;
|
||||
private uint x = AA;
|
||||
private uint z = CC;
|
||||
private char w = (char)(FOO);
|
||||
private ushort v = (ushort)(FOO);
|
||||
private uint z2 = DD;
|
||||
|
||||
fn void test()
|
||||
{
|
||||
|
||||
@@ -5,11 +5,11 @@ enum MyEnum : short
|
||||
BYE = -5
|
||||
}
|
||||
|
||||
global int myenum_max = MyEnum.max;
|
||||
global int myenum_min = MyEnum.min;
|
||||
global int myenum_elements = MyEnum.elements;
|
||||
global int myenum_alignof = $alignof(MyEnum);
|
||||
global int myenum_sizeof = $sizeof(MyEnum);
|
||||
int myenum_max = MyEnum.max;
|
||||
int myenum_min = MyEnum.min;
|
||||
int myenum_elements = MyEnum.elements;
|
||||
int myenum_alignof = $alignof(MyEnum);
|
||||
int myenum_sizeof = $sizeof(MyEnum);
|
||||
|
||||
// #expect: compile_time.ll
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module numbers;
|
||||
|
||||
global double a = 0x1.1p+1;
|
||||
global double b = -12.3e-12;
|
||||
global double c = 0x1.1p-1;
|
||||
global double d = 12.3e+12;
|
||||
double a = 0x1.1p+1;
|
||||
double b = -12.3e-12;
|
||||
double c = 0x1.1p-1;
|
||||
double d = 12.3e+12;
|
||||
|
||||
// #expect: numbers.ll
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ module foo;
|
||||
fn int test()
|
||||
{
|
||||
static int x = 1;
|
||||
global int y = 2;
|
||||
tlocal int y = 2;
|
||||
x++;
|
||||
return x;
|
||||
}
|
||||
|
||||
// #expect: foo.ll
|
||||
|
||||
@test.x = hidden thread_local global i32 1, align 4
|
||||
@test.y = hidden global i32 2, align 4
|
||||
@test.x = hidden global i32 1, align 4
|
||||
@test.y = hidden thread_local global i32 2, align 4
|
||||
|
||||
define i32 @foo.test()
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ fn void helloWorld()
|
||||
}
|
||||
fn int test_static()
|
||||
{
|
||||
global int x = 1;
|
||||
static int x = 1;
|
||||
x++;
|
||||
printf("Test static %d\n", x);
|
||||
return x;
|
||||
@@ -201,7 +201,7 @@ fn Type getMult(Type a)
|
||||
{
|
||||
return a * a;
|
||||
}
|
||||
global Type argh = 234;
|
||||
Type argh = 234;
|
||||
|
||||
errtype MyErr
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ fn void helloWorld()
|
||||
}
|
||||
fn int test_static()
|
||||
{
|
||||
global int x = 1;
|
||||
static int x = 1;
|
||||
x++;
|
||||
printf("Test static %d\n", x);
|
||||
return x;
|
||||
@@ -203,7 +203,7 @@ fn Type getMult(Type a)
|
||||
{
|
||||
return a * a;
|
||||
}
|
||||
global Type argh = 234;
|
||||
Type argh = 234;
|
||||
|
||||
errtype MyErr
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ struct UzGlobs
|
||||
MinInfo* pInfo;
|
||||
}
|
||||
|
||||
extern global UzGlobs g;
|
||||
extern UzGlobs g;
|
||||
|
||||
fn int extract_or_test_files()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module foo;
|
||||
|
||||
global int baz @extname("foobar") = 123;
|
||||
int baz @extname("foobar") = 123;
|
||||
|
||||
// #expect: foo.ll
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ const IA = 3877u;
|
||||
const IC = 29573u;
|
||||
const SEED = 42u;
|
||||
|
||||
global uint seed = SEED;
|
||||
uint seed = SEED;
|
||||
|
||||
fn float fasta_rand(float max)
|
||||
{
|
||||
@@ -14,7 +14,7 @@ fn float fasta_rand(float max)
|
||||
return max * seed / IM;
|
||||
}
|
||||
|
||||
private global char[] alu =
|
||||
private char[] alu =
|
||||
"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG"
|
||||
"GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA"
|
||||
"CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT"
|
||||
@@ -27,8 +27,8 @@ extern fn int atoi(char *s);
|
||||
extern fn int printf(char *s, ...);
|
||||
extern fn void putchar(int c);
|
||||
|
||||
global char[] iub = "acgtBDHKMNRSVWY";
|
||||
global double[] iub_p = {
|
||||
char[] iub = "acgtBDHKMNRSVWY";
|
||||
double[] iub_p = {
|
||||
0.27,
|
||||
0.12,
|
||||
0.12,
|
||||
@@ -45,8 +45,8 @@ global double[] iub_p = {
|
||||
0.02,
|
||||
0.02 };
|
||||
|
||||
global char[] homosapiens = "acgt";
|
||||
global double[] homosapiens_p = {
|
||||
char[] homosapiens = "acgt";
|
||||
double[] homosapiens_p = {
|
||||
0.3029549426680,
|
||||
0.1979883004921,
|
||||
0.1975473066391,
|
||||
|
||||
@@ -17,7 +17,7 @@ fn int test()
|
||||
int[1] azz = {};
|
||||
int[*] a = {};
|
||||
var $foo = { 11, 22, 33 };
|
||||
global int foo1 = $foo[1];
|
||||
static int foo1 = $foo[1];
|
||||
int foo2 = $foo[2];
|
||||
var $foos = { "Hello!" };
|
||||
char* str = $foos[0];
|
||||
|
||||
@@ -16,7 +16,7 @@ struct Bar
|
||||
fn void test()
|
||||
{
|
||||
Bar[] b = { { 1, 2 } };
|
||||
global Bar[] c = { { 1, 2 } };
|
||||
static Bar[] c = { { 1, 2 } };
|
||||
io::printf("%d %d\n", b[0].y, c[0].y);
|
||||
b[0].y += 1;
|
||||
c[0].y += 1;
|
||||
@@ -30,7 +30,7 @@ fn int main()
|
||||
return 1;
|
||||
}
|
||||
|
||||
// #expect: statics.ll
|
||||
/* #expect: statics.ll
|
||||
|
||||
%Bar = type { i32, i32 }
|
||||
%"Bar[]" = type { %Bar*, i64 }
|
||||
|
||||
@@ -14,9 +14,9 @@ struct Bar
|
||||
}
|
||||
|
||||
|
||||
global Bar[] arrbar = { { 3, 4 }, { 8, 9 }};
|
||||
global int[] xd = { 1, 2 };
|
||||
global int* fofeo = &&(int[2]{ 3, 4 });
|
||||
Bar[] arrbar = { { 3, 4 }, { 8, 9 }};
|
||||
int[] xd = { 1, 2 };
|
||||
int* fofeo = &&(int[2]{ 3, 4 });
|
||||
|
||||
fn int main()
|
||||
{
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// #target: x64-darwin
|
||||
module foo;
|
||||
|
||||
global int aa = 'ä';
|
||||
global int x = 'ABCD';
|
||||
global uint y = 'Helo';
|
||||
global ushort z = '\x31\x32';
|
||||
global int d = '\u0031';
|
||||
global char b = '\x40';
|
||||
global uint abc = '\U133222AB';
|
||||
global uint foo = '謝';
|
||||
int aa = 'ä';
|
||||
int x = 'ABCD';
|
||||
uint y = 'Helo';
|
||||
ushort z = '\x31\x32';
|
||||
int d = '\u0031';
|
||||
char b = '\x40';
|
||||
uint abc = '\U133222AB';
|
||||
uint foo = '謝';
|
||||
|
||||
/* #expect: foo.ll
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
module const_pointer;
|
||||
|
||||
private global double foo = 17;
|
||||
private global double bar = 12.0;
|
||||
private global float xx = 12.0;
|
||||
private double foo = 17;
|
||||
private double bar = 12.0;
|
||||
private float xx = 12.0;
|
||||
|
||||
private global void*[3] data = { &foo, &bar, &xx };
|
||||
private void*[3] data = { &foo, &bar, &xx };
|
||||
|
||||
// #expect: const_pointer.ll
|
||||
/* #expect: const_pointer.ll
|
||||
|
||||
@const_pointer.foo = protected global double 1.700000e+01, align 8
|
||||
@const_pointer.bar = protected global double 1.200000e+01, align 8
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// #target: x64-darwin
|
||||
|
||||
global char[] y = "hello";
|
||||
char[] y = "hello";
|
||||
|
||||
fn void test()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module test;
|
||||
|
||||
private global Foo a;
|
||||
private Foo a;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
|
||||
@@ -6,16 +6,16 @@ struct Foo
|
||||
long bar;
|
||||
}
|
||||
|
||||
private global usize x = $sizeof(Foo);
|
||||
private usize x = $sizeof(Foo);
|
||||
|
||||
private global Foo foo1 = { 1, 2 };
|
||||
private global Foo foo2 = { .foo = 2 };
|
||||
private global Foo foo3 = { .bar = 3 };
|
||||
private global Foo foo4 = { .bar = 4, .foo = 4, .bar = 1 };
|
||||
private global Foo foo5 = {};
|
||||
private global Foo foo6;
|
||||
private Foo foo1 = { 1, 2 };
|
||||
private Foo foo2 = { .foo = 2 };
|
||||
private Foo foo3 = { .bar = 3 };
|
||||
private Foo foo4 = { .bar = 4, .foo = 4, .bar = 1 };
|
||||
private Foo foo5 = {};
|
||||
private Foo foo6;
|
||||
private const Foo FOO7 = { 1, 2 };
|
||||
private global Foo foo8 = FOO7;
|
||||
private Foo foo8 = FOO7;
|
||||
|
||||
// #expect: structo.ll
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ struct Foo1 @packed @align(4)
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo1) == 12);
|
||||
global Foo1 foo1 = { 1, 2 };
|
||||
Foo1 foo1 = { 1, 2 };
|
||||
|
||||
// <{ i8, i64, [3 x i8] }>
|
||||
struct Foo2 @packed @align(4)
|
||||
@@ -18,7 +18,7 @@ struct Foo2 @packed @align(4)
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo2) == 12);
|
||||
global Foo2 foo2 = { 1, 2 };
|
||||
Foo2 foo2 = { 1, 2 };
|
||||
|
||||
// <{ i8, i64, [7 x i8] }>
|
||||
struct Foo3 @packed @align(8)
|
||||
@@ -27,7 +27,7 @@ struct Foo3 @packed @align(8)
|
||||
long bar;
|
||||
}
|
||||
|
||||
global Foo3 foo3 = { 1, 2 };
|
||||
Foo3 foo3 = { 1, 2 };
|
||||
$assert($sizeof(Foo3) == 16);
|
||||
|
||||
// <{ i8, i64 }>
|
||||
@@ -38,7 +38,7 @@ struct Foo4 @packed
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo4) == 9);
|
||||
global Foo4 foo4 = { 1, 2 };
|
||||
Foo4 foo4 = { 1, 2 };
|
||||
|
||||
// { i32, [12 x i8], i8, [15 x i8] }
|
||||
struct Foo5
|
||||
@@ -48,7 +48,7 @@ struct Foo5
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo5) == 32);
|
||||
global Foo5 foo5 = { 1, 2 };
|
||||
Foo5 foo5 = { 1, 2 };
|
||||
|
||||
fn int test5(ichar x)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ struct Foo6 @packed
|
||||
}
|
||||
|
||||
$assert($sizeof(Foo6) == 8);
|
||||
global Foo6 foo6 = { 1, 2, 3 };
|
||||
Foo6 foo6 = { 1, 2, 3 };
|
||||
|
||||
// #expect: struct2.ll
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ union Foo
|
||||
double b;
|
||||
}
|
||||
|
||||
private global Foo f = { .a = 23 };
|
||||
private global Foo g = { .b = 2.3 };
|
||||
private global Foo h = { .a = 23, .b = 2.3 };
|
||||
global Foo i = { .b = 2.3, .a = 23 };
|
||||
private Foo f = { .a = 23 };
|
||||
private Foo g = { .b = 2.3 };
|
||||
private Foo h = { .a = 23, .b = 2.3 };
|
||||
Foo i = { .b = 2.3, .a = 23 };
|
||||
|
||||
// #expect: test.ll
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ struct Foo
|
||||
int z;
|
||||
}
|
||||
|
||||
global Foo foo1 = { .a = 3, .z = 4 };
|
||||
global Foo foo2 = { .b = 3, .z = 4 };
|
||||
Foo foo1 = { .a = 3, .z = 4 };
|
||||
Foo foo2 = { .b = 3, .z = 4 };
|
||||
|
||||
struct Blend_Map_Entry
|
||||
{
|
||||
@@ -22,10 +22,10 @@ struct Blend_Map_Entry
|
||||
}
|
||||
}
|
||||
|
||||
global Blend_Map_Entry a = { .vals = { .colour = { 1, 2, 3, 4, 5 } } };
|
||||
global Blend_Map_Entry b = { .vals = { .point_Slope = { 6, 7 } } };
|
||||
global Blend_Map_Entry c = { .vals.colour[2] = 1 };
|
||||
global Blend_Map_Entry d = { .vals.colour = { 1, 2, 3, 4, 5 } };
|
||||
Blend_Map_Entry a = { .vals = { .colour = { 1, 2, 3, 4, 5 } } };
|
||||
Blend_Map_Entry b = { .vals = { .point_Slope = { 6, 7 } } };
|
||||
Blend_Map_Entry c = { .vals.colour[2] = 1 };
|
||||
Blend_Map_Entry d = { .vals.colour = { 1, 2, 3, 4, 5 } };
|
||||
|
||||
fn void test(Blend_Map_Entry* foo)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// #target: x64-darwin
|
||||
global int[<4>] baz = { 1, 4, 5, 7 };
|
||||
int[<4>] baz = { 1, 4, 5, 7 };
|
||||
|
||||
fn void main()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user