[PATCH] More address space checking
[smatch.git] / obfuscate.c
blob277c956c20aae23c22d6b4298480ee41bd342d2c
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-2004 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"
25 #include "linearize.h"
27 static void emit_entrypoint(struct entrypoint *ep)
32 static void emit_symbol(struct symbol *sym)
34 struct entrypoint *ep;
35 ep = linearize_symbol(sym);
36 if (ep)
37 emit_entrypoint(ep);
40 static void emit_symbol_list(struct symbol_list *list)
42 struct symbol *sym;
44 FOR_EACH_PTR(list, sym) {
45 expand_symbol(sym);
46 emit_symbol(sym);
47 } END_FOR_EACH_PTR(sym);
50 int main(int argc, char **argv)
52 sparse_initialize(argc, argv);
53 while (*argv)
54 emit_symbol_list(sparse(argv));
55 return 0;