| 1 |
/* */ |
| 2 |
|
| 3 |
#define CC 'c' |
| 4 |
_Static_assert(CC == 'c', "1"); |
| 5 |
|
| 6 |
#define I32 3 |
| 7 |
_Static_assert(I32 == 3, "3"); |
| 8 |
|
| 9 |
#define U32 4U |
| 10 |
_Static_assert(U32 == 4U, "4"); |
| 11 |
|
| 12 |
#define I64 5L |
| 13 |
_Static_assert(I64 == 5U, "5"); |
| 14 |
|
| 15 |
#define U64 6UL |
| 16 |
_Static_assert(U64 == 6UL, "6"); |
| 17 |
|
| 18 |
#define F32 7.0f |
| 19 |
_Static_assert(F32 == 7.0f, "7"); |
| 20 |
|
| 21 |
#define F64 8.0f |
| 22 |
_Static_assert(F64 == 8.0, "8"); |
| 23 |
|
| 24 |
#define F80 9.0f |
| 25 |
_Static_assert(F80 == 9.0L, "9"); |
| 26 |
|
| 27 |
#define SSS "hello" |
| 28 |
_Static_assert(SSS[0] == 'h', "10"); |
| 29 |
|
| 30 |
#define ABC 12 |
| 31 |
#define GHI (size) abbadabba |
| 32 |
#define DEF (ABC + 5) |
| 33 |
|
| 34 |
#define ADD(a, b) a + b |
| 35 |
#define SUB() 3 - 2 |
| 36 |
|
| 37 |
#define NO_BODY() |
| 38 |
#define NO_BODY_PARAMS(a, b) |
| 39 |
#define DO_WHILE() do { } while(0) |
| 40 |
|
| 41 |
#define pr16199_trigger(cond,func,args) _Generic (cond, default: func args) |
| 42 |
#define pr16199_skipped1(a) (1) |
| 43 |
#define pr16199_skipped2(b) (2) |
| 44 |
#define pr16199_ice 0x3 |
| 45 |
|
| 46 |
#define M16199Ea(TYPE) (TYPE __x;) |
| 47 |
#define M16199E(X,S,M) ({ M16199Ea(S *); }) |
| 48 |
|
| 49 |
#define M16199Da(TYPE,VAR) ((TYPE)(VAR)) |
| 50 |
#define M16199D(X,S,M) ({ int *__x = (X); M16199Da(S *, __x); }) |
| 51 |
int pr16199d() { return 7; } |
| 52 |
|
| 53 |
#define M16199C(X,S,M) ({ int __x; }) |
| 54 |
int pr16199c() |
| 55 |
{ |
| 56 |
return 8; |
| 57 |
} |
| 58 |
|
| 59 |
// https://issues.dlang.org/show_bug.cgi?id=24639 |
| 60 |
#define NEGATIVE_I32 -1 |
| 61 |
#define NEGATIVE_U32 -2U |
| 62 |
#define NEGATIVE_I64 -3LL |
| 63 |
#define NEGATIVE_U64 -4LLU |
| 64 |
#define NEGATIVE_F32 -5.0f |
| 65 |
#define NEGATIVE_F64 -6.0 |