From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] make -m32/-m64 more useful
Date: Wed, 7 Dec 2016 18:38:02 +0100 [thread overview]
Message-ID: <20161207173802.23314-1-luc.vanoostenryck@gmail.com> (raw)
The option -m64 to just set the size of longs & pointers to 64 bits.
This patch makes this option much more effective by:
- adding define for LONG_MAX & SIZEOF_POINTER
- define __LP64__
- let the dual option, -m32, do the same as -m64 but for 32 bit
---
lib.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib.c b/lib.c
index d5b56b01..e5b0bb63 100644
--- a/lib.c
+++ b/lib.c
@@ -402,9 +402,21 @@ static void handle_arch_m64_finalize(void)
pointer_alignment = 8;
size_t_ctype = &ulong_ctype;
ssize_t_ctype = &long_ctype;
+ add_pre_buffer("#weak_define __LONG_MAX__ 0x7fffffffffffffff\n");
+ add_pre_buffer("#weak_define __SIZEOF_POINTER__ 8\n");
+ add_pre_buffer("#weak_define __LP64__ 1\n");
#ifdef __x86_64__
add_pre_buffer("#weak_define __x86_64__ 1\n");
#endif
+ } else {
+ bits_in_long = 32;
+ max_int_alignment = 4;
+ bits_in_pointer = 32;
+ pointer_alignment = 4;
+ size_t_ctype = &ulong_ctype;
+ ssize_t_ctype = &long_ctype;
+ add_pre_buffer("#weak_define __LONG_MAX__ 0x7fffffff\n");
+ add_pre_buffer("#weak_define __SIZEOF_POINTER__ 4\n");
}
}
--
2.10.2
next reply other threads:[~2016-12-07 18:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 17:38 Luc Van Oostenryck [this message]
2017-02-07 2:28 ` [PATCH] make -m32/-m64 more useful Christopher Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161207173802.23314-1-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).