SpacemanDMM icon indicating copy to clipboard operation
SpacemanDMM copied to clipboard

Duplicate #includes should not duplicate parsing

Open Kaiochao opened this issue 2 years ago • 1 comments

Currently, we get "duplicate definition" errors from the parser when a file gets included multiple times, indicating that the file is actually being parsed at every #include of it, which is not how compilation works:

http://www.byond.com/docs/ref/index.html#/DM/preprocessor/include

If a file is included multiple times, only the first occurrence will be processed.

One workaround (only needed for parsing, not compilation):

// top of file
#ifndef WHATEVER_FILE
#define WHATEVER_FILE

// code goes here

#endif
// end of file

I think this was the true issue behind #97, rather than the warning itself.

Kaiochao avatar May 12 '22 05:05 Kaiochao

As far as I can tell this is implemented. Can you provide a test project that demonstrates the problem?

SpaceManiac avatar May 12 '22 23:05 SpaceManiac