db: tools for printing raw SQL instead of human readable info for the db
[smatch.git] / test-linearize.c
blob5cc54cd904e9f1de246174617c886d0630a9590f
1 /*
2 * Parse and linearize the tree for testing.
4 * Copyright (C) 2003 Transmeta Corp.
5 * 2003-2004 Linus Torvalds
7 * Licensed under the Open Software License version 1.1
8 */
9 #include <stdarg.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string.h>
13 #include <ctype.h>
14 #include <unistd.h>
15 #include <fcntl.h>
17 #include "lib.h"
18 #include "allocate.h"
19 #include "token.h"
20 #include "parse.h"
21 #include "symbol.h"
22 #include "expression.h"
23 #include "linearize.h"
25 static void clean_up_symbols(struct symbol_list *list)
27 struct symbol *sym;
29 FOR_EACH_PTR(list, sym) {
30 struct entrypoint *ep;
32 expand_symbol(sym);
33 ep = linearize_symbol(sym);
34 if (ep)
35 show_entry(ep);
36 } END_FOR_EACH_PTR(sym);
39 int main(int argc, char **argv)
41 struct string_list *filelist = NULL;
42 char *file;
44 clean_up_symbols(sparse_initialize(argc, argv, &filelist));
45 FOR_EACH_PTR_NOTAG(filelist, file) {
46 clean_up_symbols(sparse(file));
47 } END_FOR_EACH_PTR_NOTAG(file);
48 return 0;