linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 3/4] define __LONG_MAX__ & __SIZEOF_POINTER__
Date: Tue,  7 Feb 2017 21:04:24 +0100	[thread overview]
Message-ID: <20170207200425.34189-4-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170207200425.34189-1-luc.vanoostenryck@gmail.com>

They're part of GCC's common predefined macros and some
code & header files depends on them.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 lib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib.c b/lib.c
index 018fa145e..2a1bbac87 100644
--- a/lib.c
+++ b/lib.c
@@ -804,7 +804,13 @@ static char **handle_switch(char *arg, char **next)
 
 static void predefined_macros(void)
 {
+	unsigned long long val;
+
 	add_pre_buffer("#define __CHECKER__ 1\n");
+
+	val = (1ULL << (bits_in_long-1)) - 1;
+	add_pre_buffer("#weak_define __LONG_MAX__ %#llxLL\n", val);
+	add_pre_buffer("#weak_define __SIZEOF_POINTER__ %d\n", bits_in_pointer/8);
 }
 
 void declare_builtin_functions(void)
-- 
2.11.0


  parent reply	other threads:[~2017-02-07 20:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 20:04 [PATCH 0/4] improve -m32/-m64 Luc Van Oostenryck
2017-02-07 20:04 ` [PATCH 1/4] define __LP64__ & _LP64 if arch_m64 is enabled Luc Van Oostenryck
2017-02-07 20:04 ` [PATCH 2/4] add an helper for common predefined macros Luc Van Oostenryck
2017-02-07 20:04 ` Luc Van Oostenryck [this message]
2017-02-07 20:04 ` [RFC,PATCH 4/4] add support for LLP64 arch Luc Van Oostenryck
2017-02-08 21:24   ` Christopher Li
2017-02-08 22:01     ` Luc Van Oostenryck
2017-02-08 22:15     ` [PATCH v2] " Luc Van Oostenryck
2017-02-08 22:33       ` 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=20170207200425.34189-4-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).