diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-01-31 21:47:01 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-02-04 00:35:03 +0100 |
commit | 2889393c78c586ae63f0f0af1754b2d8edf83dd2 (patch) | |
tree | b8acf1366df38181ec7e74173895ef6420e2b634 | |
parent | e7a833f32307dcffcd7370acde6ab5eeaecb704c (diff) | |
download | sparse-2889393c78c586ae63f0f0af1754b2d8edf83dd2.tar.gz |
lib.c: move handle_arch_m64_finalize() to init_target()
It must be done after init_target because of some archs (PPC32,
mips32, ...) have int32_t set to long. These 32-bit ints would
then become 64-bit.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Tested-by: Uwe Kleine-König <uwe@kleine-koenig.org>
-rw-r--r-- | lib.c | 42 | ||||
-rw-r--r-- | target.c | 35 |
2 files changed, 36 insertions, 41 deletions
@@ -472,44 +472,6 @@ static char **handle_switch_m(char *arg, char **next) return next; } -static void handle_arch_m64_finalize(void) -{ - switch (arch_m64) { - case ARCH_X32: - max_int_alignment = 8; - int64_ctype = &llong_ctype; - uint64_ctype = &ullong_ctype; - break; - case ARCH_LP32: - /* default values */ - int64_ctype = &llong_ctype; - uint64_ctype = &ullong_ctype; - intmax_ctype = &llong_ctype; - uintmax_ctype = &ullong_ctype; - return; - case ARCH_LP64: - bits_in_long = 64; - max_int_alignment = 8; - size_t_ctype = &ulong_ctype; - ssize_t_ctype = &long_ctype; - intmax_ctype = &long_ctype; - uintmax_ctype = &ulong_ctype; - goto case_64bit_common; - case ARCH_LLP64: - bits_in_long = 32; - max_int_alignment = 8; - size_t_ctype = &ullong_ctype; - ssize_t_ctype = &llong_ctype; - int64_ctype = &llong_ctype; - uint64_ctype = &ullong_ctype; - goto case_64bit_common; - case_64bit_common: - bits_in_pointer = 64; - pointer_alignment = 8; - break; - } -} - static void handle_arch_msize_long_finalize(void) { if (arch_msize_long) { @@ -520,7 +482,6 @@ static void handle_arch_msize_long_finalize(void) static void handle_arch_finalize(void) { - handle_arch_m64_finalize(); handle_arch_msize_long_finalize(); } @@ -1498,8 +1459,6 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list handle_switch_W_finalize(); handle_switch_v_finalize(); - handle_arch_finalize(); - // Redirect stdout if needed if (dump_macro_defs || preprocess_only) do_output = 1; @@ -1515,6 +1474,7 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list if (filelist) { // Initialize type system init_target(); + handle_arch_finalize(); init_ctype(); predefined_macros(); @@ -114,6 +114,41 @@ void init_target(void) break; } + switch (arch_m64) { + case ARCH_X32: + max_int_alignment = 8; + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; + break; + case ARCH_LP32: + /* default values */ + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; + intmax_ctype = &llong_ctype; + uintmax_ctype = &ullong_ctype; + break; + case ARCH_LP64: + bits_in_long = 64; + max_int_alignment = 8; + size_t_ctype = &ulong_ctype; + ssize_t_ctype = &long_ctype; + intmax_ctype = &long_ctype; + uintmax_ctype = &ulong_ctype; + goto case_64bit_common; + case ARCH_LLP64: + bits_in_long = 32; + max_int_alignment = 8; + size_t_ctype = &ullong_ctype; + ssize_t_ctype = &llong_ctype; + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; + goto case_64bit_common; + case_64bit_common: + bits_in_pointer = 64; + pointer_alignment = 8; + break; + } + #if defined(__CYGWIN__) wchar_ctype = &ushort_ctype; #endif |