cgen: add support for $if (mach|darwin|hpux|gnu|qnx|bsd)

pull/5096/head
pancake 2020-05-28 13:33:12 +02:00 committed by GitHub
parent d688d356a7
commit 2943bdc1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -3219,6 +3219,21 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) string {
'macos' { 'macos' {
return '__APPLE__' return '__APPLE__'
} }
'mach' {
return '__MACH__'
}
'darwin' {
return '__DARWIN__'
}
'hpux' {
return '__HPUX__'
}
'gnu' {
return '__GNU__'
}
'qnx' {
return '__QNX__'
}
'linux' { 'linux' {
return '__linux__' return '__linux__'
} }
@ -3231,6 +3246,9 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) string {
'netbsd' { 'netbsd' {
return '__NetBSD__' return '__NetBSD__'
} }
'bsd' {
return '__BSD__'
}
'dragonfly' { 'dragonfly' {
return '__DragonFly__' return '__DragonFly__'
} }