math: don't return high values in get_fuzzy_max()
[smatch.git] / compile.c
blobd405b22d6c8d4582f7a51ad68eb856ae3ca99f3f
1 /*
2 * Example trivial client program that uses the sparse library
3 * and x86 backend.
5 * Copyright (C) 2003 Transmeta Corp.
6 * 2003 Linus Torvalds
7 * Copyright 2003 Jeff Garzik
9 * Licensed under the Open Software License version 1.1
12 #include <stdarg.h>
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <string.h>
16 #include <ctype.h>
17 #include <unistd.h>
18 #include <fcntl.h>
20 #include "lib.h"
21 #include "allocate.h"
22 #include "token.h"
23 #include "parse.h"
24 #include "symbol.h"
25 #include "expression.h"
26 #include "compile.h"
28 static void clean_up_symbols(struct symbol_list *list)
30 struct symbol *sym;
32 FOR_EACH_PTR(list, sym) {
33 expand_symbol(sym);
34 emit_one_symbol(sym);
35 } END_FOR_EACH_PTR(sym);
38 int main(int argc, char **argv)
40 char *file;
41 struct string_list *filelist = NULL;
43 clean_up_symbols(sparse_initialize(argc, argv, &filelist));
44 FOR_EACH_PTR_NOTAG(filelist, file) {
45 struct symbol_list *list;
46 const char *basename = strrchr(file, '/');
47 basename = basename ? basename+1 : file;
49 list = sparse(file);
51 // Do type evaluation and simplification
52 emit_unit_begin(basename);
53 clean_up_symbols(list);
54 emit_unit_end();
55 } END_FOR_EACH_PTR_NOTAG(file);
57 #if 0
58 // And show the allocation statistics
59 show_ident_alloc();
60 show_token_alloc();
61 show_symbol_alloc();
62 show_expression_alloc();
63 show_statement_alloc();
64 show_string_alloc();
65 show_bytes_alloc();
66 #endif
67 return 0;