diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-11-24 16:49:14 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-11-28 00:52:07 +0100 |
| commit | 6bca188679d235ddbad2e97aa3e4186a4730686e (patch) | |
| tree | c65def4c0940b6c4d1bd2afe0c611fe3b2c02cee /target.c | |
| parent | 61b8e17e1456b272dbc9c14e599fb6a20984aaf6 (diff) | |
| download | sparse-dev-6bca188679d235ddbad2e97aa3e4186a4730686e.tar.gz | |
arch: use a variable for the OS
There are a few OS-specific settings and handling them
with #ifdef is 1) ugly, 2) can only work with when specifically
built for this OS (either a native or cross-build).
So, use a variable to hold the OS and initialize it to the one
used to compile sparse. This avoid the ugly #ifdef and allow
simpler transition if if the future sparse would take the OS
in parameter (maybe as triple).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'target.c')
| -rw-r--r-- | target.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -83,13 +83,19 @@ void init_target(void) wchar_ctype = &long_ctype; /* fall through */ case MACH_X86_64: -#if defined(__APPLE__) - int64_ctype = &llong_ctype; - uint64_ctype = &ullong_ctype; -#endif -#if defined(__FreeBSD__) || defined(__APPLE__) - wint_ctype = &int_ctype; -#endif + switch (arch_os) { + case OS_CYGWIN: + wchar_ctype = &ushort_ctype; + break; + case OS_DARWIN: + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; + wint_ctype = &int_ctype; + break; + case OS_FREEBSD: + wint_ctype = &int_ctype; + break; + } break; case MACH_M68K: case MACH_SPARC32: @@ -178,8 +184,4 @@ void init_target(void) pointer_alignment = 8; break; } - -#if defined(__CYGWIN__) - wchar_ctype = &ushort_ctype; -#endif } |
