[PATCH] Fix address space ordering problem
[smatch.git] / test-parsing.c
blobd2b95750235b3679a0f05f27ddb808d44e3a5f3d
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 sparse_initialize(argc, argv);
38 while (*argv) {
39 struct symbol_list *list = sparse(argv);
41 // Simplification
42 clean_up_symbols(list);
44 #if 1
45 // Show the end result.
46 show_symbol_list(list, "\n\n");
47 printf("\n\n");
48 #endif
51 #if 0
52 // And show the allocation statistics
53 show_ident_alloc();
54 show_token_alloc();
55 show_symbol_alloc();
56 show_expression_alloc();
57 show_statement_alloc();
58 show_string_alloc();
59 show_bytes_alloc();
60 #endif
61 return 0;