mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Revert "v.gen.c: use the __V_architecture macro in v.pref.get_host_arch()"
This reverts commit 5452ba4653
.
This commit is contained in:
parent
339f2cd180
commit
dc654b0121
@ -51,7 +51,7 @@ pub fn pref_arch_to_table_language(pref_arch pref.Arch) Language {
|
||||
.i386 {
|
||||
Language.i386
|
||||
}
|
||||
._auto, ._max {
|
||||
._auto {
|
||||
Language.v
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ pub enum Arch {
|
||||
rv64 // 64-bit risc-v
|
||||
rv32 // 32-bit risc-v
|
||||
i386
|
||||
_max
|
||||
}
|
||||
|
||||
const (
|
||||
@ -755,16 +754,20 @@ pub fn cc_from_string(cc_str string) CompilerType {
|
||||
}
|
||||
|
||||
pub fn get_host_arch() Arch {
|
||||
// NB: we can not use `$if arch` here, because V skips cgen for the non
|
||||
// current comptime branches by default, so there is a bootstrapping
|
||||
// problem => the __V_architecture macro is used to resolve it.
|
||||
// TODO: think about how to solve it for non C backends, perhaps we
|
||||
// need a comptime `$if native {` too, and/or a mechanism to always
|
||||
// generate all branches for specific functions?
|
||||
if C.__V_architecture <= int(Arch._auto) || C.__V_architecture >= int(Arch._max) {
|
||||
panic('unknown host CPU architecture')
|
||||
$if amd64 {
|
||||
return .amd64
|
||||
}
|
||||
return Arch(C.__V_architecture)
|
||||
// $if i386 {
|
||||
// return .amd64
|
||||
// }
|
||||
// $if arm64 { // requires new vc
|
||||
$if aarch64 {
|
||||
return .arm64
|
||||
}
|
||||
// $if arm32 {
|
||||
// return .arm32
|
||||
// }
|
||||
panic('unknown host OS')
|
||||
}
|
||||
|
||||
fn parse_define(mut prefs Preferences, define string) {
|
||||
|
Loading…
Reference in New Issue
Block a user