aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-02-07 21:04:24 +0100
committerChristopher Li <sparse@chrisli.org>2017-02-13 09:34:46 +0800
commit8d688c9a6ee220ce00b30afd8bdffa34434c9950 (patch)
treec534fcf44389939701f37396c5060a4789251b73
parentaf67375f340c29ba481c29a2cdda49d68db85d53 (diff)
downloadsparse-dev-8d688c9a6ee220ce00b30afd8bdffa34434c9950.tar.gz
define __LONG_MAX__ & __SIZEOF_POINTER__
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> Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--lib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 38ff165b..65887c40 100644
--- a/lib.c
+++ b/lib.c
@@ -802,7 +802,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)