https://github.com/shader-slang/slang
Raw File
Tip revision: dd435512219f435ea13498e6124930fd4cf823a9 authored by Tim Foley on 18 November 2019, 18:36:38 UTC
Further refactoring of semantic checking (#1102)
Tip revision: dd43551
define-function-like.slang
//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); }
back to top