KoffeinFlummi / armake2

Successor to armake written in Rust
GNU General Public License v2.0
50 stars 17 forks source link

Define and comment on same line #24

Closed jonpas closed 5 years ago

jonpas commented 5 years ago

Following triggers a pre-processor error:

#undef PREP // make.py can't redefine already defined macros

Work-around:

// make.py can't redefine already defined macros
#undef PREP
Krzmbrzl commented 5 years ago

Did you check that this is actually valid im arm's preprocessor? If it is, are multiline comments also permitted. Also how are do comments influence multiline macros?

jonpas commented 5 years ago

It works with Mikero, IIRC it works in Arma directly as well because I use it in missions.

Multiline macros don't support inline comments, period.

severgun commented 5 years ago

Same with includes in config.cpp #include CfgMySuperFixes.hpp // Best config fixes in the world

Krzmbrzl commented 5 years ago

Okay I just performed a bit of digging and found the following

  1. jonpas is right: Comments on the same line as defines is completely valid
  2. Single line comments do also break multi-line defines
  3. Multi-line comments on the other hand don't
#define BLA Something // I am a comment\
is wrong
BLA

preprocesses to


is wrong
Something 
#define BLA Something /* I am a comment*/\
is wrong
BLA

preprocesses to


Something is wrong

and

#define BLA Something /* I am
a mutline
comment */\
is wrong
BLA

preprocesses to


Something is wrong
jonpas commented 5 years ago

Interesting! Was fully sure not even /* */ comments are supported there.

severgun commented 5 years ago

This issue do not allow to build ACE and others who include A3 defines(dikCodes as an example)