satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
57 stars 13 forks source link

warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #163

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

When building with CLion using lldb 3.9.2 I get these warnings - why undefined behavior? https://github.com/satoshinm/NetCraft/issues/156

/NetCraft/src/main.c:3354:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#ifdef BUILD_NUM
 ^
/NetCraft/src/main.c:3357:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#ifdef BUILD_WASM
 ^
/NetCraft/src/main.c:3361:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#ifdef BUILD_COMMIT
 ^
/NetCraft/src/main.c:3364:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#ifdef BUILD_BRANCH
 ^
satoshinm commented 7 years ago

This is presumably because snprintf is a macro on some platforms? https://stackoverflow.com/questions/28343501/is-it-legal-to-use-the-line-directive-in-a-macro-argument