Get comparison sizes right.
[smatch.git] / test-parsing.c
blob7f6f4bf45c0b2eafa4b33973f5940daacbd85c77
1 /*
2 * Example trivial client program that uses the sparse library
3 * to tokenize, pre-process and parse a C file, and prints out
4 * the results.
6 * Copyright (C) 2003 Transmeta Corp.
7 * 2003 Linus Torvalds
9 * Licensed under the Open Software License version 1.1
11 #include <stdarg.h>
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include <ctype.h>
16 #include <unistd.h>
17 #include <fcntl.h>
19 #include "lib.h"
20 #include "allocate.h"
21 #include "token.h"
22 #include "parse.h"
23 #include "symbol.h"
24 #include "expression.h"
26 static void clean_up_symbols(struct symbol_list *list)
28 struct symbol *sym;
30 FOR_EACH_PTR(list, sym) {
31 expand_symbol(sym);
32 } END_FOR_EACH_PTR(sym);
35 int main(int argc, char **argv)
37 struct symbol_list *list = sparse(argc, argv);
39 // Simplification
40 clean_up_symbols(list);
42 #if 1
43 // Show the end result.
44 show_symbol_list(list, "\n\n");
45 printf("\n\n");
46 #endif
48 #if 0
49 // And show the allocation statistics
50 show_ident_alloc();
51 show_token_alloc();
52 show_symbol_alloc();
53 show_expression_alloc();
54 show_statement_alloc();
55 show_string_alloc();
56 show_bytes_alloc();
57 #endif
58 return 0;