OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Whitespace prevents a macro from being recognized.

Open Hinaichigo opened this issue 3 years ago • 8 comments

This applies to de0b016484a68f8f752da82755522bfe07b58261 When trying to compile vgstation13-coders/vgstation13, I encountered the following error:

Error at code\modules\mob\living\say.dm:474:17: Type /mob/living does not have a proc named "isborer"

The lines at that location are:

473	if(isborer(M) || ((M in dead_mob_list) && !istype(M, /mob/new_player)))
474		if(isborer (M)) //for borers that are IN CONTROL
475			B = M //why it no typecast
476			if(B.controlling)
477				M = B.host

isborer is defined as: #define isborer(A) istype(A, /mob/living/simple_animal/borer)

isborerin line 473 works fine but it causes an error in line 474, seemingly because of the whitespace.

Hinaichigo avatar May 21 '22 23:05 Hinaichigo

Would trimming/ignoring all whitespace after the first non-whitespace character in a line be a valid way to fix this?

Hinaichigo avatar May 21 '22 23:05 Hinaichigo

I hate that this compiles in BYOND.

ike709 avatar May 21 '22 23:05 ike709

Would trimming/ignoring all whitespace after the first non-whitespace character in a line be a valid way to fix this?

No. Whitespace has meaning even past the indentation, such as in a.b.c expressions. Having whitespace between the periods there should error.

wixoaGit avatar May 22 '22 00:05 wixoaGit

This error doesn't occur anymore as of recently, I think it might have been fixed.

Edit: nevermind, it's still present.

Hinaichigo avatar Jun 30 '22 20:06 Hinaichigo

I can still reproduce this error with this test case:

#define TEST(A) world.log << A

/world/New()
	..()
	TEST (1)

wixoaGit avatar Jun 30 '22 23:06 wixoaGit

should this even be fixed for parity reasons? I think it's worth breaking here

ZeWaka avatar Jul 02 '22 00:07 ZeWaka

Honestly IMO this is an acceptable breaking change, yeah. BYOND shouldn't allow this to begin with and it's apparently quite a rare occurrence because it hasn't come up before.

ike709 avatar Jul 02 '22 00:07 ike709

I'm leaning towards fixing this since the C preprocessor has this same behavior.

wixoaGit avatar Jul 02 '22 19:07 wixoaGit