LordGolias/sqf

False positive on operators within macros that turn them to strings

Opened this issue · 3 comments

This is a pretty specific one, but came across it in the ace rangecard code:

missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5), 1, 2, 3, 4, 5];

The macros turns it's contents into a string, but the linter interprets the % as a binary operator and errors. I'm personally unsure how best to approach fixing this, would just entirely disregarding the arguments supplied to a macro make sense?

If the preprocessor # operator is correctly added to the parser and evaluated within macro replacement, it would fix this issue for #define instances in the current file (as far as I can tell this will need to be done anyway in order to also implement the # sqf operator, see: #37).

If in future #include statements would check if the file exists and actually include it in the current file, this would then further fix it for #define instances in separate files.

Same for using macro arguments which have same name as commands, eg. GVAR(score).