smatch_clear_buffer: memcpy() should set the destination to unknown
[smatch.git] / obfuscate.c
blob1015510bb41cd05e74147fe3a276484e879d0554
1 /*
2 * Example trivial client program that uses the sparse library
3 * to tokenize, preprocess 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 struct string_list *filelist = NULL;
53 char *file;
55 emit_symbol_list(sparse_initialize(argc, argv, &filelist));
56 FOR_EACH_PTR_NOTAG(filelist, file) {
57 emit_symbol_list(sparse(file));
58 } END_FOR_EACH_PTR_NOTAG(file);
59 return 0;