1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: better NetBSD and OpenBSD support in vfmt and $if

This commit is contained in:
radare 2020-03-17 12:43:59 +01:00 committed by GitHub
parent e2eb0f17d7
commit f5e44fbef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 8 deletions

View File

@ -32,8 +32,11 @@ const (
['linux', '_lin.v', '_linux.v', '_nix.v'],
['macos', '_mac.v', '_darwin.v'],
['freebsd', '_bsd.v', '_freebsd.v'],
['netbsd', '_bsd.v', '_netbsd.v'],
['openbsd', '_bsd.v', '_openbsd.v'],
['solaris', '_solaris.v'],
['haiku', '_haiku.v'],
['qnx', '_qnx.v'],
]
FORMATTED_FILE_TOKEN = '\@\@\@' + 'FORMATTED_FILE: '
)

View File

@ -369,15 +369,27 @@ fn (v &V) platform_postfix_to_ifdefguard(name string) string {
'_nix.v' {
'#ifndef _WIN32'
}
'_qnx.v' {
'#ifndef __QNX__'
}
'_lin.v', '_linux.v' {
'#ifdef __linux__'
}
'_mac.v', '_darwin.v' {
'#ifdef __APPLE__'
}
'_bsd.v', '_freebsd.v '{
'_freebsd.v' {
'#ifdef __FreeBSD__'
}
'_openbsd.v' {
'#ifdef __OpenBSD__'
}
'_netbsd.v' {
'#ifdef __NetBSD__'
}
'_bsd.v' {
'#ifdef __FreeBSD__ || __NetBSD__ || __OpenBSD__'
}
'_solaris.v' {
'#ifdef __sun'
}