Module "linux" will be " 1 "
ShigekiKarita opened this issue · 4 comments
ShigekiKarita commented
input file: test.dpp
module foo.linux.bar;
preprocess result: d++ --preprocess-only test.dpp
module foo. 1 .bar;
import core.stdc.config;
import core.stdc.stdarg: va_list;
static import core.simd;
static import std.conv;
struct Int128 { long lower; long upper; }
struct UInt128 { ulong lower; ulong upper; }
struct __locale_data { int dummy; }
alias _Bool = bool;
struct dpp {
static struct Opaque(int N) {
void[N] bytes;
}
static bool isEmpty(T)() {
return T.tupleof.length == 0;
}
static struct Move(T) {
T* ptr;
}
static auto move(T)(ref T value) {
return Move!T(&value);
}
mixin template EnumD(string name, T, string prefix) if(is(T == enum)) {
private static string _memberMixinStr(string member) {
import std.conv: text;
import std.array: replace;
return text(` `, member.replace(prefix, ""), ` = `, T.stringof, `.`, member, `,`);
}
private static string _enumMixinStr() {
import std.array: join;
string[] ret;
ret ~= "enum " ~ name ~ "{";
static foreach(member; __traits(allMembers, T)) {
ret ~= _memberMixinStr(member);
}
ret ~= "}";
return ret.join("\n");
}
mixin(_enumMixinStr());
}
}
extern(C)
{
}
atilaneves commented
Unfortunately that's what happens when the preprocessor is involved. dpp can't control what predefined macros clang brings to the table.
The only way around it is to have an option to not run the C preprocessor. Or, of course, rename the module.
ShigekiKarita commented
Thanks for suggestions. I will rename that.
2020年5月11日(月) 21:24 Atila Neves <notifications@github.com>:
… Unfortunately that's what happens when the preprocessor is involved. dpp
can't control what predefined macros clang brings to the table.
The only way around it is to have an option to not run the C preprocessor.
Or, of course, rename the module.
—in
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#258 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTOZ3TXQ5GAERXFNGWMQJDRQ7U7LANCNFSM4M43EGBA>
.
atilaneves commented
There's also #259
ShigekiKarita commented
Nice!