[PATCH] fix sparse warnings
[smatch.git] / parse.h
blobbc4781f95d7e730113afc1ef6bc3834694fb960c
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
7 * 2003 Linus Torvalds
9 * Licensed under the Open Software License version 1.1
12 #include "symbol.h"
14 enum statement_type {
15 STMT_NONE,
16 STMT_EXPRESSION,
17 STMT_COMPOUND,
18 STMT_IF,
19 STMT_RETURN,
20 STMT_CASE,
21 STMT_SWITCH,
22 STMT_ITERATOR,
23 STMT_LABEL,
24 STMT_GOTO,
25 STMT_ASM,
26 STMT_CONTEXT,
27 STMT_RANGE,
30 struct statement {
31 enum statement_type type;
32 struct position pos;
33 union {
34 struct /* label_arg */ {
35 struct symbol *label;
36 struct statement *label_statement;
38 struct expression *expression;
39 struct /* return_statement */ {
40 struct expression *ret_value;
41 struct symbol *ret_target;
43 struct /* if_statement */ {
44 struct expression *if_conditional;
45 struct statement *if_true;
46 struct statement *if_false;
48 struct /* compound_struct */ {
49 struct symbol_list *syms;
50 struct statement_list *stmts;
51 struct symbol *ret;
53 struct /* labeled_struct */ {
54 struct symbol *label_identifier;
55 struct statement *label_statement;
57 struct /* case_struct */ {
58 struct expression *case_expression;
59 struct expression *case_to;
60 struct statement *case_statement;
61 struct symbol *case_label;
63 struct /* switch_struct */ {
64 struct expression *switch_expression;
65 struct statement *switch_statement;
66 struct symbol *switch_break, *switch_case;
68 struct /* iterator_struct */ {
69 struct symbol *iterator_break;
70 struct symbol *iterator_continue;
71 struct symbol_list *iterator_syms;
72 struct statement *iterator_pre_statement;
73 struct expression *iterator_pre_condition;
75 struct statement *iterator_statement;
77 struct statement *iterator_post_statement;
78 struct expression *iterator_post_condition;
80 struct /* goto_struct */ {
81 struct symbol *goto_label;
83 /* computed gotos have these: */
84 struct expression *goto_expression;
85 struct symbol_list *target_list;
87 struct /* goto_bb */ {
88 struct expression *bb_conditional;
89 struct symbol *bb_target;
91 struct /* multijmp */ {
92 struct expression *multi_from;
93 struct expression *multi_to;
94 struct symbol *multi_target;
96 struct /* asm */ {
97 struct expression *asm_string;
98 struct expression_list *asm_outputs;
99 struct expression_list *asm_inputs;
100 struct expression_list *asm_clobbers;
102 struct /* range */ {
103 struct expression *range_expression;
104 struct expression *range_low;
105 struct expression *range_high;
110 extern struct symbol_list *function_computed_target_list;
111 extern struct statement_list *function_computed_goto_list;
113 extern struct token *parse_expression(struct token *, struct expression **);
114 extern struct symbol *label_symbol(struct token *token);
116 extern int show_statement(struct statement *);
117 extern void show_statement_list(struct statement_list *, const char *);
118 extern int show_expression(struct expression *);
120 extern struct token *external_declaration(struct token *token, struct symbol_list **list);
122 extern struct symbol *ctype_integer(unsigned long spec);
123 extern struct symbol *ctype_fp(unsigned long spec);
125 extern void copy_statement(struct statement *src, struct statement *dst);
126 extern int inline_function(struct expression *expr, struct symbol *sym);
127 extern void uninline(struct symbol *sym);
129 #endif /* PARSE_H */