summaryrefslogtreecommitdiffstats
path: root/tests/preprocessor/define-function-like.slang
blob: fa82940779103c166a5e287a70799e6fc9dceab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//TEST(smoke):SIMPLE:
// support for function-like macros

#define FOO(x) 1.0 + x

float foo(float y) { return FOO(y) * 2.0; }

// simple token pasting

#define PASTE(a,b) a##b

PASTE(flo,at) bar() { return 0.0; }

// no space before parens? not a function-like macro

#define M (x) - (x)

// Error: undefined identifier `x`
float bar(float a) { return M(a); }