WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
43.96k stars 1.92k forks source link

[Bug] #endif is considered an invalid directive if anything is on the immediate line after #1715

Closed EtiTheSpirit closed 4 months ago

EtiTheSpirit commented 4 months ago

Operating System

Windows

What's the issue you encountered?

Bit of a strange one here.

If more than one static branch is used in a file, they must be broken apart by at least one line, lest #endif be unrecognized as a directive.

How can the issue be reproduced?

Create a new file (can be blank), and open the pattern editor. Enter the following code to the pattern:

#ifdef GARBAGE
#endif
#ifndef GARBAGE
#endif

Attempt to compile this code. Line 4 will raise the following error:

E: error: Unknown directive 'endif'
E:   -->   in <Source Code>:4:7
E: 4 | #endif
E:           ^

Add a line break separating lines [1,2] and [3,4] as such:

#ifdef GARBAGE
#endif

#ifndef GARBAGE
#endif

Attempt to compile this code. This will succeed.

ImHex Version

1.33.2

ImHex Build Type

Installation type

MSI, Non-portable

Additional context?

No response

paxcut commented 4 months ago

This bug was fixed already on master (1.33.0) and the code without any spaces should compile and run without errors on a recent nightly master build. I just tried it on a May 14 nightly without any problems.

image