Since we're making much more progress now, allow more warnings.
[smatch.git] / test-parsing.c
blob3abcbfd0e7d7c94b0b87433ebc4c16cef8f81833
1 #include <stdarg.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <ctype.h>
6 #include <unistd.h>
7 #include <fcntl.h>
9 #include "lib.h"
10 #include "token.h"
11 #include "parse.h"
12 #include "symbol.h"
14 int main(int argc, char **argv)
16 int fd = open(argv[1], O_RDONLY);
17 struct token *token;
18 struct symbol_list *list = NULL;
20 if (fd < 0)
21 die("No such file: %s", argv[1]);
22 init_symbols();
24 // Tokenize the input stream
25 token = tokenize(argv[1], fd, NULL);
27 // Pre-process the stream
28 token = preprocess(token);
30 // Parse the resulting C code
31 translation_unit(token, &list);
33 // Show the end result.
34 show_symbol_list(list);
36 // And show the allocation statistics
37 show_ident_alloc();
38 show_token_alloc();
39 show_symbol_alloc();
40 show_expression_alloc();
41 show_statement_alloc();
42 show_string_alloc();
43 show_bytes_alloc();
44 return 0;