aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-02-07 21:04:23 +0100
committerChristopher Li <sparse@chrisli.org>2017-02-13 09:34:45 +0800
commitaf67375f340c29ba481c29a2cdda49d68db85d53 (patch)
treed5d4f29b7ad97d6bfe057b4abcc286b7bbd2f6d4
parent84e7bd4a455f228adb4b7d882965c8786fbe65ca (diff)
downloadsparse-dev-af67375f340c29ba481c29a2cdda49d68db85d53.tar.gz
add an helper for common predefined macros
Eventually, most of what GCC predefine (gcc -E -dM) should be defined here. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--lib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index a801d8c1..38ff165b 100644
--- a/lib.c
+++ b/lib.c
@@ -800,6 +800,11 @@ static char **handle_switch(char *arg, char **next)
return next;
}
+static void predefined_macros(void)
+{
+ add_pre_buffer("#define __CHECKER__ 1\n");
+}
+
void declare_builtin_functions(void)
{
/* Gaah. gcc knows tons of builtin <string.h> functions */
@@ -1152,7 +1157,7 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list
init_ctype();
create_builtin_stream();
- add_pre_buffer("#define __CHECKER__ 1\n");
+ predefined_macros();
if (!preprocess_only)
declare_builtin_functions();