implied: cleanup debug output a little
[smatch.git] / smatch_flow.c
blob262cebc6ee1a3d12890134b74569389a2f28251e
1 /*
2 * sparse/smatch_flow.c
4 * Copyright (C) 2006,2008 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #define _GNU_SOURCE 1
11 #include <unistd.h>
12 #include <stdio.h>
13 #include "token.h"
14 #include "smatch.h"
15 #include "smatch_expression_stacks.h"
16 #include "smatch_extra.h"
17 #include "smatch_slist.h"
19 int final_pass;
21 static int __smatch_lineno = 0;
23 static char *base_file;
24 static const char *filename;
25 static char *pathname;
26 static char *full_filename;
27 static char *cur_func;
28 static int line_func_start;
29 static int loop_count;
30 int __expr_stmt_count;
31 static struct expression_list *switch_expr_stack = NULL;
33 struct expression_list *big_expression_stack;
34 struct statement_list *big_statement_stack;
35 int __in_pre_condition = 0;
36 int __bail_on_rest_of_function = 0;
37 char *get_function(void) { return cur_func; }
38 int get_lineno(void) { return __smatch_lineno; }
39 int inside_loop(void) { return !!loop_count; }
40 int in_expression_statement(void) { return !!__expr_stmt_count; }
42 static void split_symlist(struct symbol_list *sym_list);
43 static void split_declaration(struct symbol_list *sym_list);
44 static void split_expr_list(struct expression_list *expr_list);
45 static void add_inline_function(struct symbol *sym);
47 int option_assume_loops = 0;
48 int option_known_conditions = 0;
49 int option_two_passes = 0;
50 struct symbol *cur_func_sym = NULL;
52 const char *get_filename(void)
54 if (option_info)
55 return base_file;
56 if (option_full_path)
57 return full_filename;
58 return filename;
61 static void set_position(struct position pos)
63 int len;
64 static int prev_stream = -1;
66 __smatch_lineno = pos.line;
68 if (pos.stream == prev_stream)
69 return;
71 filename = stream_name(pos.stream);
73 free(full_filename);
74 pathname = getcwd(NULL, 0);
75 if (pathname) {
76 len = strlen(pathname) + 1 + strlen(filename) + 1;
77 full_filename = malloc(len);
78 snprintf(full_filename, len, "%s/%s", pathname, filename);
79 } else {
80 full_filename = alloc_string(filename);
82 free(pathname);
85 static int is_inline_func(struct expression *expr)
87 if (expr->type != EXPR_SYMBOL || !expr->symbol)
88 return 0;
89 if (expr->symbol->ctype.modifiers & MOD_INLINE)
90 return 1;
91 return 0;
94 void __split_expr(struct expression *expr)
96 if (!expr)
97 return;
99 // sm_msg(" Debug expr_type %d %s", expr->type, show_special(expr->op));
101 push_expression(&big_expression_stack, expr);
102 set_position(expr->pos);
103 __pass_to_client(expr, EXPR_HOOK);
105 switch (expr->type) {
106 case EXPR_PREOP:
107 if (expr->op == '*')
108 __pass_to_client(expr, DEREF_HOOK);
109 case EXPR_POSTOP:
110 __pass_to_client(expr, OP_HOOK);
111 __split_expr(expr->unop);
112 break;
113 case EXPR_STATEMENT:
114 __expr_stmt_count++;
115 __split_stmt(expr->statement);
116 __expr_stmt_count--;
117 break;
118 case EXPR_LOGICAL:
119 case EXPR_COMPARE:
120 __pass_to_client(expr, LOGIC_HOOK);
121 __handle_logic(expr);
122 break;
123 case EXPR_BINOP:
124 __pass_to_client(expr, BINOP_HOOK);
125 case EXPR_COMMA:
126 __split_expr(expr->left);
127 __split_expr(expr->right);
128 break;
129 case EXPR_ASSIGNMENT: {
130 struct expression *tmp;
132 if (!expr->right)
133 break;
135 __pass_to_client(expr, RAW_ASSIGNMENT_HOOK);
137 /* foo = !bar() */
138 if (__handle_condition_assigns(expr))
139 break;
140 /* foo = (x < 5 ? foo : 5); */
141 if (__handle_select_assigns(expr))
142 break;
143 /* foo = ({frob(); frob(); frob(); 1;}) */
144 if (__handle_expr_statement_assigns(expr))
145 break;
147 __split_expr(expr->right);
148 __pass_to_client(expr, ASSIGNMENT_HOOK);
149 tmp = strip_expr(expr->right);
150 if (tmp->type == EXPR_CALL)
151 __pass_to_client(expr, CALL_ASSIGNMENT_HOOK);
152 if (get_macro_name(tmp->pos))
153 __pass_to_client(expr, MACRO_ASSIGNMENT_HOOK);
154 __split_expr(expr->left);
155 break;
157 case EXPR_DEREF:
158 __pass_to_client(expr, DEREF_HOOK);
159 __split_expr(expr->deref);
160 break;
161 case EXPR_SLICE:
162 __split_expr(expr->base);
163 break;
164 case EXPR_CAST:
165 case EXPR_FORCE_CAST:
166 __pass_to_client(expr, CAST_HOOK);
167 __split_expr(expr->cast_expression);
168 break;
169 case EXPR_SIZEOF:
170 /* there isn't anything to pass a client from inside a sizeof() */
171 break;
172 case EXPR_CONDITIONAL:
173 case EXPR_SELECT:
174 if (known_condition_true(expr->conditional)) {
175 __split_expr(expr->cond_true);
176 break;
178 if (known_condition_false(expr->conditional)) {
179 __split_expr(expr->cond_false);
180 break;
182 __pass_to_client(expr, SELECT_HOOK);
183 __split_whole_condition(expr->conditional);
184 __split_expr(expr->cond_true);
185 __push_true_states();
186 __use_false_states();
187 __split_expr(expr->cond_false);
188 __merge_true_states();
189 break;
190 case EXPR_CALL:
191 if (sym_name_is("__builtin_constant_p", expr->fn))
192 break;
193 split_expr_list(expr->args);
194 __split_expr(expr->fn);
195 if (is_inline_func(expr->fn))
196 add_inline_function(expr->fn->symbol);
197 __pass_to_client(expr, FUNCTION_CALL_HOOK);
198 break;
199 case EXPR_INITIALIZER:
200 split_expr_list(expr->expr_list);
201 break;
202 case EXPR_IDENTIFIER:
203 __split_expr(expr->ident_expression);
204 break;
205 case EXPR_INDEX:
206 __split_expr(expr->idx_expression);
207 break;
208 case EXPR_POS:
209 __split_expr(expr->init_expr);
210 break;
211 case EXPR_SYMBOL:
212 __pass_to_client(expr, SYM_HOOK);
213 break;
214 case EXPR_STRING:
215 __pass_to_client(expr, STRING_HOOK);
216 break;
217 default:
218 break;
220 pop_expression(&big_expression_stack);
223 static int is_forever_loop(struct statement *stmt)
225 struct expression *expr;
227 expr = strip_expr(stmt->iterator_pre_condition);
228 if (!expr)
229 expr = stmt->iterator_post_condition;
230 if (!expr) {
231 /* this is a for(;;) loop... */
232 return 1;
235 if (expr->type == EXPR_VALUE && expr->value == 1)
236 return 1;
238 return 0;
241 static int loop_num;
242 static char *get_loop_name(int num)
244 char buf[256];
246 snprintf(buf, 255, "-loop%d", num);
247 buf[255] = '\0';
248 return alloc_sname(buf);
252 * Pre Loops are while and for loops.
254 static void handle_pre_loop(struct statement *stmt)
256 int once_through; /* we go through the loop at least once */
257 struct sm_state *extra_sm = NULL;
258 int unchanged = 0;
259 char *loop_name;
260 struct state_list *slist = NULL;
261 struct sm_state *sm = NULL;
263 loop_name = get_loop_name(loop_num);
264 loop_num++;
266 __split_stmt(stmt->iterator_pre_statement);
268 once_through = implied_condition_true(stmt->iterator_pre_condition);
270 loop_count++;
271 __push_continues();
272 __push_breaks();
274 __merge_gotos(loop_name);
276 extra_sm = __extra_handle_canonical_loops(stmt, &slist);
277 __in_pre_condition++;
278 __pass_to_client(stmt, PRELOOP_HOOK);
279 __split_whole_condition(stmt->iterator_pre_condition);
280 __in_pre_condition--;
281 FOR_EACH_PTR(slist, sm) {
282 set_state(sm->owner, sm->name, sm->sym, sm->state);
283 } END_FOR_EACH_PTR(sm);
284 free_slist(&slist);
285 if (extra_sm)
286 extra_sm = get_sm_state(extra_sm->owner, extra_sm->name, extra_sm->sym);
288 if (option_assume_loops)
289 once_through = 1;
291 __split_stmt(stmt->iterator_statement);
292 __warn_on_silly_pre_loops();
293 if (is_forever_loop(stmt)) {
294 struct state_list *slist;
296 __save_gotos(loop_name);
298 __push_fake_cur_slist();
299 __split_stmt(stmt->iterator_post_statement);
300 slist = __pop_fake_cur_slist();
302 __discard_continues();
303 __discard_false_states();
304 __use_breaks();
306 if (!__path_is_null())
307 __merge_slist_into_cur(slist);
308 free_slist(&slist);
309 } else {
310 __merge_continues();
311 unchanged = __iterator_unchanged(extra_sm);
312 __split_stmt(stmt->iterator_post_statement);
313 __save_gotos(loop_name);
314 __split_whole_condition(stmt->iterator_pre_condition);
315 nullify_path();
316 __merge_false_states();
317 if (once_through)
318 __discard_false_states();
319 else
320 __merge_false_states();
322 if (extra_sm && unchanged)
323 __extra_pre_loop_hook_after(extra_sm,
324 stmt->iterator_post_statement,
325 stmt->iterator_pre_condition);
326 __merge_breaks();
328 loop_count--;
332 * Post loops are do {} while();
334 static void handle_post_loop(struct statement *stmt)
336 char *loop_name;
338 loop_name = get_loop_name(loop_num);
339 loop_num++;
340 loop_count++;
342 __push_continues();
343 __push_breaks();
344 __merge_gotos(loop_name);
345 __split_stmt(stmt->iterator_statement);
346 __merge_continues();
347 if (!is_zero(stmt->iterator_post_condition))
348 __save_gotos(loop_name);
350 if (is_forever_loop(stmt)) {
351 __use_breaks();
352 } else {
353 __split_whole_condition(stmt->iterator_post_condition);
354 __use_false_states();
355 __merge_breaks();
357 loop_count--;
360 static int empty_statement(struct statement *stmt)
362 if (!stmt)
363 return 0;
364 if (stmt->type == STMT_EXPRESSION && !stmt->expression)
365 return 1;
366 return 0;
369 static int last_stmt_on_same_line()
371 struct statement *stmt;
372 int i = 0;
374 FOR_EACH_PTR_REVERSE(big_statement_stack, stmt) {
375 if (!i++)
376 continue;
377 if (stmt->pos.line == get_lineno())
378 return 1;
379 return 0;
380 } END_FOR_EACH_PTR_REVERSE(stmt);
381 return 0;
384 static struct statement *last_stmt;
385 static int is_last_stmt(struct statement *stmt)
387 if (stmt == last_stmt)
388 return 1;
389 return 0;
392 static void print_unreached_initializers(struct symbol_list *sym_list)
394 struct symbol *sym;
396 FOR_EACH_PTR(sym_list, sym) {
397 if (sym->initializer)
398 sm_msg("info: '%s' is not actually initialized (unreached code).",
399 (sym->ident ? sym->ident->name : "this variable"));
400 } END_FOR_EACH_PTR(sym);
403 static void print_unreached(struct statement *stmt)
405 static int print = 1;
407 if (!__path_is_null()) {
408 print = 1;
409 return;
411 if (!print)
412 return;
414 switch (stmt->type) {
415 case STMT_COMPOUND: /* after a switch before a case stmt */
416 case STMT_RANGE:
417 case STMT_CASE:
418 case STMT_LABEL:
419 return;
420 case STMT_DECLARATION: /* switch (x) { int a; case foo: ... */
421 print_unreached_initializers(stmt->declaration);
422 return;
423 case STMT_RETURN: /* gcc complains if you don't have a return statement */
424 if (is_last_stmt(stmt))
425 return;
426 break;
427 case STMT_GOTO:
428 if (!option_spammy)
429 return;
430 break;
431 default:
432 break;
434 if (!option_spammy && empty_statement(stmt))
435 return;
436 sm_msg("info: ignoring unreachable code.");
437 print = 0;
440 static void split_asm_constraints(struct expression_list *expr_list)
442 struct expression *expr;
443 int state = 0;
445 FOR_EACH_PTR(expr_list, expr) {
446 switch (state) {
447 case 0: /* identifier */
448 case 1: /* constraint */
449 state++;
450 continue;
451 case 2: /* expression */
452 state = 0;
453 __split_expr(expr);
454 continue;
456 } END_FOR_EACH_PTR(expr);
459 static int is_case_val(struct statement *stmt, long long val)
461 long long case_val;
463 if (stmt->type != STMT_CASE)
464 return 0;
465 if (!stmt->case_expression) {
466 __set_default();
467 return 1;
469 if (!get_value(stmt->case_expression, &case_val))
470 return 0;
471 if (case_val == val)
472 return 1;
473 return 0;
476 static void split_known_switch(struct statement *stmt, long long val)
478 struct statement *tmp;
480 __split_expr(stmt->switch_expression);
482 push_expression(&switch_expr_stack, stmt->switch_expression);
483 __save_switch_states(top_expression(switch_expr_stack));
484 nullify_path();
485 __push_default();
486 __push_breaks();
488 stmt = stmt->switch_statement;
490 if (!last_stmt)
491 last_stmt = last_ptr_list((struct ptr_list *)stmt->stmts);
493 __push_scope_hooks();
494 FOR_EACH_PTR(stmt->stmts, tmp) {
495 __smatch_lineno = tmp->pos.line;
496 if (is_case_val(tmp, val)) {
497 __merge_switches(top_expression(switch_expr_stack),
498 stmt->case_expression);
499 __pass_case_to_client(top_expression(switch_expr_stack),
500 stmt->case_expression);
502 if (__path_is_null())
503 continue;
504 __split_stmt(tmp);
505 if (__path_is_null()) {
506 __set_default();
507 goto out;
509 } END_FOR_EACH_PTR(tmp);
510 out:
511 __call_scope_hooks();
512 if (!__pop_default())
513 __merge_switches(top_expression(switch_expr_stack),
514 NULL);
515 __discard_switches();
516 __merge_breaks();
517 pop_expression(&switch_expr_stack);
520 void __split_stmt(struct statement *stmt)
522 long long val;
524 if (!stmt)
525 return;
527 if (out_of_memory() || __bail_on_rest_of_function) {
528 static char *printed = NULL;
530 if (printed != cur_func)
531 sm_msg("Function too hairy. Giving up.");
532 printed = cur_func;
533 return;
536 add_ptr_list(&big_statement_stack, stmt);
537 free_expression_stack(&big_expression_stack);
538 set_position(stmt->pos);
539 print_unreached(stmt);
540 __pass_to_client(stmt, STMT_HOOK);
542 switch (stmt->type) {
543 case STMT_DECLARATION:
544 split_declaration(stmt->declaration);
545 return;
546 case STMT_RETURN:
547 __split_expr(stmt->ret_value);
548 __pass_to_client(stmt->ret_value, RETURN_HOOK);
549 nullify_path();
550 return;
551 case STMT_EXPRESSION:
552 __split_expr(stmt->expression);
553 return;
554 case STMT_COMPOUND: {
555 struct statement *tmp;
557 if (!last_stmt)
558 last_stmt = last_ptr_list((struct ptr_list *)stmt->stmts);
559 __push_scope_hooks();
560 FOR_EACH_PTR(stmt->stmts, tmp) {
561 __split_stmt(tmp);
562 } END_FOR_EACH_PTR(tmp);
563 __call_scope_hooks();
564 return;
566 case STMT_IF:
567 if (known_condition_true(stmt->if_conditional)) {
568 __split_stmt(stmt->if_true);
569 return;
571 if (known_condition_false(stmt->if_conditional)) {
572 __split_stmt(stmt->if_false);
573 return;
575 if (option_known_conditions &&
576 implied_condition_true(stmt->if_conditional)) {
577 sm_info("this condition is true.");
578 __split_stmt(stmt->if_true);
579 return;
581 if (option_known_conditions &&
582 implied_condition_false(stmt->if_conditional)) {
583 sm_info("this condition is false.");
584 __split_stmt(stmt->if_false);
585 return;
587 __split_whole_condition(stmt->if_conditional);
588 __split_stmt(stmt->if_true);
589 if (empty_statement(stmt->if_true) &&
590 last_stmt_on_same_line() &&
591 !get_macro_name(stmt->if_true->pos))
592 sm_msg("warn: if();");
593 __push_true_states();
594 __use_false_states();
595 __split_stmt(stmt->if_false);
596 __merge_true_states();
597 return;
598 case STMT_ITERATOR:
599 if (stmt->iterator_pre_condition)
600 handle_pre_loop(stmt);
601 else if (stmt->iterator_post_condition)
602 handle_post_loop(stmt);
603 else {
604 // these are for(;;) type loops.
605 handle_pre_loop(stmt);
607 return;
608 case STMT_SWITCH:
609 if (get_value(stmt->switch_expression, &val)) {
610 split_known_switch(stmt, val);
611 return;
613 __split_expr(stmt->switch_expression);
614 push_expression(&switch_expr_stack, stmt->switch_expression);
615 __save_switch_states(top_expression(switch_expr_stack));
616 nullify_path();
617 __push_default();
618 __push_breaks();
619 __split_stmt(stmt->switch_statement);
620 if (!__pop_default())
621 __merge_switches(top_expression(switch_expr_stack),
622 NULL);
623 __discard_switches();
624 __merge_breaks();
625 pop_expression(&switch_expr_stack);
626 return;
627 case STMT_CASE:
628 __merge_switches(top_expression(switch_expr_stack),
629 stmt->case_expression);
630 __pass_case_to_client(top_expression(switch_expr_stack),
631 stmt->case_expression);
632 if (!stmt->case_expression)
633 __set_default();
634 __split_expr(stmt->case_expression);
635 __split_expr(stmt->case_to);
636 __split_stmt(stmt->case_statement);
637 return;
638 case STMT_LABEL:
639 if (stmt->label_identifier &&
640 stmt->label_identifier->type == SYM_LABEL &&
641 stmt->label_identifier->ident) {
642 loop_count = 1000000;
643 __merge_gotos(stmt->label_identifier->ident->name);
645 __split_stmt(stmt->label_statement);
646 return;
647 case STMT_GOTO:
648 __split_expr(stmt->goto_expression);
649 if (stmt->goto_label && stmt->goto_label->type == SYM_NODE) {
650 if (!strcmp(stmt->goto_label->ident->name, "break")) {
651 __process_breaks();
652 } else if (!strcmp(stmt->goto_label->ident->name,
653 "continue")) {
654 __process_continues();
656 } else if (stmt->goto_label &&
657 stmt->goto_label->type == SYM_LABEL &&
658 stmt->goto_label->ident) {
659 __save_gotos(stmt->goto_label->ident->name);
661 nullify_path();
662 return;
663 case STMT_NONE:
664 return;
665 case STMT_ASM:
666 __pass_to_client(stmt, ASM_HOOK);
667 __split_expr(stmt->asm_string);
668 split_asm_constraints(stmt->asm_outputs);
669 split_asm_constraints(stmt->asm_inputs);
670 split_asm_constraints(stmt->asm_clobbers);
671 return;
672 case STMT_CONTEXT:
673 return;
674 case STMT_RANGE:
675 __split_expr(stmt->range_expression);
676 __split_expr(stmt->range_low);
677 __split_expr(stmt->range_high);
678 return;
682 static void split_expr_list(struct expression_list *expr_list)
684 struct expression *expr;
686 FOR_EACH_PTR(expr_list, expr) {
687 __split_expr(expr);
688 } END_FOR_EACH_PTR(expr);
691 static void split_sym(struct symbol *sym)
693 if (!sym)
694 return;
695 if (!(sym->namespace & NS_SYMBOL))
696 return;
698 __split_stmt(sym->stmt);
699 __split_expr(sym->array_size);
700 split_symlist(sym->arguments);
701 split_symlist(sym->symbol_list);
702 __split_stmt(sym->inline_stmt);
703 split_symlist(sym->inline_symbol_list);
706 static void split_symlist(struct symbol_list *sym_list)
708 struct symbol *sym;
710 FOR_EACH_PTR(sym_list, sym) {
711 split_sym(sym);
712 } END_FOR_EACH_PTR(sym);
715 static struct expression *fake_assign_expr(struct symbol *sym)
717 struct expression *e_assign, *e_symbol;
719 e_assign = alloc_expression(sym->initializer->pos, EXPR_ASSIGNMENT);
720 e_symbol = alloc_expression(sym->pos, EXPR_SYMBOL);
721 e_assign->op = (int)'=';
722 e_symbol->symbol = sym;
723 e_symbol->symbol_name = sym->ident;
724 e_assign->left = e_symbol;
725 e_assign->right = sym->initializer;
726 return e_assign;
729 static void do_initializer_stuff(struct symbol *sym)
731 struct expression *assign;
733 if (!sym->initializer)
734 return;
735 assign = fake_assign_expr(sym);
736 __split_expr(assign);
739 static void split_declaration(struct symbol_list *sym_list)
741 struct symbol *sym;
743 FOR_EACH_PTR(sym_list, sym) {
744 __pass_to_client(sym, DECLARATION_HOOK);
745 do_initializer_stuff(sym);
746 split_sym(sym);
747 } END_FOR_EACH_PTR(sym);
750 static void split_function(struct symbol *sym)
752 struct symbol *base_type = get_base_type(sym);
754 cur_func_sym = sym;
755 if (base_type->stmt)
756 line_func_start = base_type->stmt->pos.line;
757 if (sym->ident)
758 cur_func = sym->ident->name;
759 __smatch_lineno = sym->pos.line;
760 last_stmt = NULL;
761 loop_count = 0;
762 sm_debug("new function: %s\n", cur_func);
763 if (option_two_passes) {
764 __unnullify_path();
765 loop_num = 0;
766 final_pass = 0;
767 __pass_to_client(sym, FUNC_DEF_HOOK);
768 __split_stmt(base_type->stmt);
769 __split_stmt(base_type->inline_stmt);
770 nullify_path();
772 __unnullify_path();
773 loop_num = 0;
774 final_pass = 1;
775 __pass_to_client(sym, FUNC_DEF_HOOK);
776 __split_stmt(base_type->stmt);
777 __split_stmt(base_type->inline_stmt);
778 __pass_to_client(sym, END_FUNC_HOOK);
779 cur_func = NULL;
780 line_func_start = 0;
781 clear_all_states();
782 free_data_info_allocs();
783 free_expression_stack(&switch_expr_stack);
784 __free_ptr_list((struct ptr_list **)&big_statement_stack);
785 __bail_on_rest_of_function = 0;
788 static struct symbol_list *inlines_called;
789 static void add_inline_function(struct symbol *sym)
791 static struct symbol_list *already_added;
792 struct symbol *tmp;
794 FOR_EACH_PTR(already_added, tmp) {
795 if (tmp == sym)
796 return;
797 } END_FOR_EACH_PTR(tmp);
799 add_ptr_list(&already_added, sym);
800 add_ptr_list(&inlines_called, sym);
803 static void process_inlines()
805 struct symbol *tmp;
807 FOR_EACH_PTR(inlines_called, tmp) {
808 split_function(tmp);
809 } END_FOR_EACH_PTR(tmp);
810 free_ptr_list(&inlines_called);
813 static void split_functions(struct symbol_list *sym_list)
815 struct symbol *sym;
817 FOR_EACH_PTR(sym_list, sym) {
818 set_position(sym->pos);
819 if (sym->type == SYM_NODE && get_base_type(sym)->type == SYM_FN) {
820 split_function(sym);
821 process_inlines();
822 } else {
823 __pass_to_client(sym, BASE_HOOK);
825 } END_FOR_EACH_PTR(sym);
826 __pass_to_client_no_data(END_FILE_HOOK);
829 void smatch(int argc, char **argv)
832 struct string_list *filelist = NULL;
833 struct symbol_list *sym_list;
835 if (argc < 2) {
836 printf("Usage: smatch [--debug] <filename.c>\n");
837 exit(1);
839 sparse_initialize(argc, argv, &filelist);
840 FOR_EACH_PTR_NOTAG(filelist, base_file) {
841 if (option_file_output) {
842 char buf[256];
844 snprintf(buf, sizeof(buf), "%s.smatch", base_file);
845 sm_outfd = fopen(buf, "w");
846 if (!sm_outfd) {
847 printf("Error: Cannot open %s\n", base_file);
848 exit(1);
851 sym_list = sparse_keep_tokens(base_file);
852 split_functions(sym_list);
853 } END_FOR_EACH_PTR_NOTAG(base_file);