1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
struct BitfieldOne {
unsigned a;
unsigned : 0;
struct Nested {
float x;
unsigned y : 15;
unsigned z : 8;
} b;
int c : 5;
int d : 7;
int e : 13;
int f : 15;
int g : 8;
int h : 2;
float i;
int j : 3;
int k : 4;
unsigned long long l;
unsigned m;
};
struct BitfieldOne createBitfieldOne(void);
void consumeBitfieldOne(struct BitfieldOne one);
struct A {
int x;
};
struct A createA(void);
enum CrappyColor {
Red, Green, Blue
};
struct BitfieldSeparatorReference {
unsigned char a;
unsigned : 0;
unsigned char b;
};
typedef struct BitfieldSeparatorSameName {
unsigned char a;
unsigned : 0;
unsigned char b;
} BitfieldSeparatorSameName;
typedef struct BitfieldSeparatorDifferentNameStruct {
unsigned char a;
unsigned : 0;
unsigned char b;
} BitfieldSeparatorDifferentName;
typedef struct {
unsigned char a;
unsigned : 0;
unsigned char b;
} BitfieldSeparatorAnon;
typedef float vector_float3 __attribute__((__ext_vector_type__(3)));
struct SIMDStruct {
vector_float3 v;
};
void takesSIMDStruct(struct SIMDStruct);
struct HasRecursivePointers {
struct HasRecursivePointers *next;
void (*getNext)(struct HasRecursivePointers);
};
struct HasNestedUnion {
struct {
int x;
float f;
} s;
};
// Test sign extension behavior
char chareth(char a);
signed char signedChareth(signed char a);
unsigned char unsignedChareth(unsigned char a);
short eatMyShorts(short a);
unsigned short eatMyUnsignedShorts(unsigned short a);
int ints(int a);
unsigned unsigneds(unsigned a);
// Test static globals
static float staticFloat = 17.0;
static int staticInt = 42;
static const char * const staticString = "abc";
static inline void doubleTrouble(void) {
staticFloat *= 2.0;
}
#define SWIFT_ENUM(_type, _name) enum _name
typedef SWIFT_ENUM(int, AmazingColor) {
Cyan, Magenta, Yellow
} AmazingColor;
|