summaryrefslogtreecommitdiffstats
path: root/tests/preprocessor/define-function-like.slang
blob: f1dd9caa4b2fe180bd36ddb06577e0a1bebf05f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//TEST: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); }