sourcepawn
sourcepawn copied to clipboard
Multiline macro functions are complaining about missing newline on SM compiler 1.13.0.7243 as well as 1.12.0.7201
Code at this link:
#define SET_PROP(%1,%2,%3) \
public %1 Set%2(int client, %1 val){ \
this.Set(client, val, %3);}
Output:
rtd/classes/rollers.sp(36) : error 155: expected newline, but found 'public'
36 | #define SET_PROP(%1,%2,%3) \
------------------------------^
rtd/classes/rollers.sp(37) : error 155: expected newline, but found 'public'
37 | public %1 Set%2(int client, %1 val){ \
-------------------------------------^
rtd/classes/rollers.sp(39) : error 155: expected newline, but found 'public'
39 |
---------^
and continuing
This code was compiling correctly on SM 1.11 compiler
I ran into this same problem and out of curiosity I collapsed the define statement to one line like so:
#define GET_PROP(%1,%2,%3) public %1 Get%2(int client){ return view_as<%1>(this.Get(client, %3));}
But I still get the error message when I try to invoke the macro
rtd/classes/rollers.sp(36) : error 155: expected newline, but found 'public'
36 | GET_PROP(bool,InRoll,0)
-------------------------------------^
So I'm not sure it's as much a multiline macro issue as a function style macro which is tripping this compiler error