Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3:Update
sparse
sparse-0.4.4-add_m64_support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sparse-0.4.4-add_m64_support.patch of Package sparse
commit 7aa79f8401f08ff9dd56088e8cbc394e646e3389 Author: Christopher Li <sparse@chrisli.org> AuthorDate: Fri Mar 23 02:58:20 2012 -0700 Commit: Christopher Li <sparse@chrisli.org> CommitDate: Fri Mar 23 10:50:54 2012 -0700 Adding default for m64/m32 handle This is improved version of Pekka Enberg's patch "Fix including glibc headers on x86-64". To avoid setting 64 bit define in the -m32 case, the 64 bit initialization needs to delay until all arguments are handled. Signed-off-by: Christopher Li <sparse@chrisli.org> --- lib.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/lib.c b/lib.c index 30ffd89..b4d3944 100644 --- a/lib.c +++ b/lib.c @@ -224,6 +224,15 @@ static enum { STANDARD_C89, STANDARD_GNU89, STANDARD_GNU99, } standard = STANDARD_GNU89; +#ifdef __x86_64__ +#define ARCH_M64_DEFAULT 1 +#else +#define ARCH_M64_DEFAULT 0 +#endif + +int arch_m64 = ARCH_M64_DEFAULT; +int arch_msize_long = 0; + #define CMDLINE_INCLUDE 20 int cmdline_include_nr = 0; struct cmdline_include cmdline_include[CMDLINE_INCLUDE]; @@ -344,19 +353,47 @@ static char **handle_switch_M(char *arg, char **next) static char **handle_switch_m(char *arg, char **next) { if (!strcmp(arg, "m64")) { + arch_m64 = 1; + } else if (!strcmp(arg, "m32")) { + arch_m64 = 0; + } else if (!strcmp(arg, "msize-long")) { + arch_msize_long = 1; + } + return next; +} + +static void handle_arch_m64_finalize(void) +{ + if (arch_m64) { bits_in_long = 64; max_int_alignment = 8; bits_in_pointer = 64; pointer_alignment = 8; size_t_ctype = &ulong_ctype; ssize_t_ctype = &long_ctype; - } else if (!strcmp(arg, "msize-long")) { +#ifdef __x86_64__ + add_pre_buffer("#weak_define x86_64 1\n"); + add_pre_buffer("#weak_define __x86_64 1\n"); + add_pre_buffer("#weak_define __x86_64__ 1\n"); +#endif + } +} + +static void handle_arch_msize_long_finalize(void) +{ + if (arch_msize_long) { size_t_ctype = &ulong_ctype; ssize_t_ctype = &long_ctype; } - return next; } +static void handle_arch_finalize(void) +{ + handle_arch_m64_finalize(); + handle_arch_msize_long_finalize(); +} + + static char **handle_switch_o(char *arg, char **next) { if (!strcmp (arg, "o")) { // "-o foo" @@ -934,6 +971,8 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list handle_switch_W_finalize(); handle_switch_v_finalize(); + handle_arch_finalize(); + list = NULL; if (!ptr_list_empty(filelist)) { // Initialize type system
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor