Closed tom-tan closed 1 year ago
It only happens on macOS with cpp that is bundled in XCode. Here are codes to reproduce this issue.
#ifndef _ISSUE_H_INCLUDED_ #define _ISSUE_H_INCLUDED_
- issue.dpp ```d #include "issue.h" void main() {}
$ dub run -q dpp -- --ignore-system-paths --preprocess-only issue.dpp $ dmd -run issue.d
The above commands are successfully executed.
dmd -run fails with the following messages:
dmd -run
$ dmd -run issue.d issue.d(57): Error: declaration expected, not `#` issue.d(67): Error: unmatched closing brace
I reproduce it on Github Actions with this configuration. Here is a difference between clang-cpp (used in Github Actions for dpp) and /usr/bin/cpp (default cpp on Github Actions).
clang-cpp
/usr/bin/cpp
preprocessed by clang-cpp (result of Github Actions)
... extern(C) { static if(!is(typeof(DEF_VAL))) { private enum enumMixinStr_DEF_VAL = `enum DEF_VAL = 0;`; static if(is(typeof({ mixin(enumMixinStr_DEF_VAL); }))) { mixin(enumMixinStr_DEF_VAL); } }
} ...
- preprocessed by `cpp` ([result of Github Actions](https://github.com/tom-tan/dpp/runs/8076609723?check_suite_focus=true#step:6:67)) ```d ... extern(C) { #ifdef DEF_VAL #endif static if(!is(typeof(DEF_VAL))) { private enum enumMixinStr_DEF_VAL = `enum DEF_VAL = 0;`; static if(is(typeof({ mixin(enumMixinStr_DEF_VAL); }))) { mixin(enumMixinStr_DEF_VAL); } } } ...
It would be nice if dpp can work with /usr/bin/cpp.
It only happens on macOS with cpp that is bundled in XCode. Here are codes to reproduce this issue.
define DEF_VAL 0
endif
How to reproduce
Expected behavior
The above commands are successfully executed.
Actual behavior
dmd -run
fails with the following messages:Note
I reproduce it on Github Actions with this configuration. Here is a difference between
clang-cpp
(used in Github Actions for dpp) and/usr/bin/cpp
(default cpp on Github Actions).preprocessed by
clang-cpp
(result of Github Actions)} ...
It would be nice if dpp can work with
/usr/bin/cpp
.