mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: support for $if amd64 {}
and $if aarch64 {}
This commit is contained in:
parent
6eea13ecc2
commit
8c7bcad6b1
@ -4355,12 +4355,21 @@ fn (mut g Gen) comp_if_to_ifdef(name string, is_comptime_optional bool) string {
|
|||||||
'no_bounds_checking' {
|
'no_bounds_checking' {
|
||||||
return 'CUSTOM_DEFINE_no_bounds_checking'
|
return 'CUSTOM_DEFINE_no_bounds_checking'
|
||||||
}
|
}
|
||||||
|
// architectures:
|
||||||
|
'amd64' {
|
||||||
|
return '__V_amd64'
|
||||||
|
}
|
||||||
|
'aarch64' {
|
||||||
|
return '__V_aarch64'
|
||||||
|
}
|
||||||
|
// bitness:
|
||||||
'x64' {
|
'x64' {
|
||||||
return 'TARGET_IS_64BIT'
|
return 'TARGET_IS_64BIT'
|
||||||
}
|
}
|
||||||
'x32' {
|
'x32' {
|
||||||
return 'TARGET_IS_32BIT'
|
return 'TARGET_IS_32BIT'
|
||||||
}
|
}
|
||||||
|
// endianness:
|
||||||
'little_endian' {
|
'little_endian' {
|
||||||
return 'TARGET_ORDER_IS_LITTLE'
|
return 'TARGET_ORDER_IS_LITTLE'
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,13 @@ const (
|
|||||||
#define __NOINLINE __attribute__((noinline))
|
#define __NOINLINE __attribute__((noinline))
|
||||||
#define __IRQHANDLER __attribute__((interrupt))
|
#define __IRQHANDLER __attribute__((interrupt))
|
||||||
|
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
#define __V_amd64 1
|
||||||
|
#endif
|
||||||
|
#if defined(__aarch64__) || defined(__arm64__)
|
||||||
|
#define __V_aarch64 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:
|
// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define __V_GCC__
|
#define __V_GCC__
|
||||||
|
Loading…
Reference in New Issue
Block a user