OpenDreamProject / OpenDream

A project for running games made in the DM programming language
MIT License
208 stars 112 forks source link

Preprocessor doesnt fold signs next to defines/doesn't add parentheses around defines #1892

Open Furrior opened 3 months ago

Furrior commented 3 months ago

The input works fine in byond, the output doesnt. While OD still works with such a code, it probably should be handled at preprocessor step for compatibility. I used --dump-preprocessor --no-standard compiler arguments

#define A -1

/proc/Run_Test()
    ASSERT(-A == 1)

Becomes invalid code

/proc/Run_Test()
    ASSERT(--1 == 1)