added a bunch of gcc builtins
[smatch.git] / test-parsing.c
blob5aafae9b68b69c26f28040e172dc945f40314f04
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;
39 list = sparse_initialize(argc, argv);
41 // Simplification
42 clean_up_symbols(list);
44 #if 1
45 show_symbol_list(list, "\n\n");
46 printf("\n\n");
47 #endif
49 while (*argv) {
50 list = sparse(argv);
52 // Simplification
53 clean_up_symbols(list);
55 #if 1
56 // Show the end result.
57 show_symbol_list(list, "\n\n");
58 printf("\n\n");
59 #endif
62 #if 0
63 // And show the allocation statistics
64 show_ident_alloc();
65 show_token_alloc();
66 show_symbol_alloc();
67 show_expression_alloc();
68 show_statement_alloc();
69 show_string_alloc();
70 show_bytes_alloc();
71 #endif
72 return 0;