Add "__volatile" and "__volatile__" for gcc compatibility.
[smatch.git] / show-parse.c
blob69d138777fb0d6ad0b93457bab1ec7ea76cddcd7
1 /*
2 * sparse/show-parse.c
4 * Copyright (C) 2003 Transmeta Corp.
6 * Licensed under the Open Software License version 1.1
8 * Print out results of parsing for debugging and testing.
9 */
10 #include <stdarg.h>
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <string.h>
14 #include <ctype.h>
15 #include <unistd.h>
16 #include <fcntl.h>
18 #include "lib.h"
19 #include "token.h"
20 #include "parse.h"
21 #include "symbol.h"
22 #include "scope.h"
23 #include "expression.h"
24 #include "target.h"
26 static void do_debug_symbol(struct symbol *sym, int indent)
28 static const char indent_string[] = " ";
29 static const char *typestr[] = {
30 "base", "node", "ptr.", "fn..",
31 "arry", "strt", "unin", "enum",
32 "tdef", "tpof", "memb", "bitf",
33 "labl"
36 if (!sym)
37 return;
38 fprintf(stderr, "%.*s%s%3d:%lu %lx %s (as: %d, context: %x:%x) %p (%s:%d:%d)\n",
39 indent, indent_string, typestr[sym->type],
40 sym->bit_size, sym->ctype.alignment,
41 sym->ctype.modifiers, show_ident(sym->ident),
42 sym->ctype.as, sym->ctype.context, sym->ctype.contextmask,
43 sym, input_streams[sym->pos.stream].name, sym->pos.line, sym->pos.pos);
44 if (sym->type == SYM_FN) {
45 int i = 1;
46 struct symbol *arg;
47 FOR_EACH_PTR(sym->arguments, arg) {
48 fprintf(stderr, "< arg%d:\n", i);
49 do_debug_symbol(arg, 0);
50 fprintf(stderr, " end arg%d >\n", i);
51 i++;
52 } END_FOR_EACH_PTR;
54 do_debug_symbol(sym->ctype.base_type, indent+2);
57 void debug_symbol(struct symbol *sym)
59 do_debug_symbol(sym, 0);
63 * Symbol type printout. The type system is by far the most
64 * complicated part of C - everything else is trivial.
66 const char *modifier_string(unsigned long mod)
68 static char buffer[100];
69 char *p = buffer;
70 const char *res,**ptr, *names[] = {
71 "auto", "register", "static", "extern",
72 "const", "volatile", "[signed]", "[unsigned]",
73 "[char]", "[short]", "[long]", "[long]",
74 "[typdef]", "[structof]", "[unionof]", "[enum]",
75 "[typeof]", "[attribute]", "inline", "[addressable]",
76 "[nocast]", "[noderef]",
77 NULL
79 ptr = names;
80 while ((res = *ptr++) != NULL) {
81 if (mod & 1) {
82 char c;
83 while ((c = *res++) != '\0')
84 *p++ = c;
85 *p++ = ' ';
87 mod >>= 1;
89 *p = 0;
90 return buffer;
93 void show_struct_member(struct symbol *sym, void *data, int flags)
95 if (flags & ITERATE_FIRST)
96 printf(" {\n\t");
97 printf("%s:%d:%ld at offset %ld", show_ident(sym->ident), sym->bit_size, sym->ctype.alignment, sym->offset);
98 if (sym->fieldwidth)
99 printf("[%d..%d]", sym->bit_offset, sym->bit_offset+sym->fieldwidth-1);
100 if (flags & ITERATE_LAST)
101 printf("\n} ");
102 else
103 printf(", ");
106 static void show_one_symbol(struct symbol *sym, void *sep, int flags)
108 show_symbol(sym);
109 if (!(flags & ITERATE_LAST))
110 printf("%s", (const char *)sep);
113 void show_symbol_list(struct symbol_list *list, const char *sep)
115 symbol_iterate(list, show_one_symbol, (void *)sep);
118 struct type_name {
119 char *start;
120 char *end;
123 static void prepend(struct type_name *name, const char *fmt, ...)
125 static char buffer[512];
126 int n;
128 va_list args;
129 va_start(args, fmt);
130 n = vsprintf(buffer, fmt, args);
131 va_end(args);
133 name->start -= n;
134 memcpy(name->start, buffer, n);
137 static void append(struct type_name *name, const char *fmt, ...)
139 static char buffer[512];
140 int n;
142 va_list args;
143 va_start(args, fmt);
144 n = vsprintf(buffer, fmt, args);
145 va_end(args);
147 memcpy(name->end, buffer, n);
148 name->end += n;
151 static void do_show_type(struct symbol *sym, struct type_name *name)
153 int i, modlen;
154 const char *mod;
155 static struct ctype_name {
156 struct symbol *sym;
157 char *name;
158 } typenames[] = {
159 { & char_ctype, "char" },
160 { &uchar_ctype, "unsigned char" },
161 { & short_ctype, "short" },
162 { &ushort_ctype, "unsigned short" },
163 { & int_ctype, "int" },
164 { &uint_ctype, "unsigned int" },
165 { & long_ctype, "long" },
166 { &ulong_ctype, "unsigned long" },
167 { & llong_ctype, "long long" },
168 { &ullong_ctype, "unsigned long long" },
170 { &void_ctype, "void" },
171 { &bool_ctype, "bool" },
172 { &string_ctype, "string" },
174 { &float_ctype, "float" },
175 { &double_ctype, "double" },
176 { &ldouble_ctype,"long double" },
179 if (!sym)
180 return;
182 for (i = 0; i < sizeof(typenames)/sizeof(typenames[0]); i++) {
183 if (typenames[i].sym == sym) {
184 int len = strlen(typenames[i].name);
185 *--name->start = ' ';
186 name->start -= len;
187 memcpy(name->start, typenames[i].name, len);
188 return;
192 /* Prepend */
193 switch (sym->type) {
194 case SYM_PTR:
195 prepend(name, "*");
196 break;
197 case SYM_FN:
198 prepend(name, "( ");
199 break;
200 case SYM_STRUCT:
201 prepend(name, "struct %s ", show_ident(sym->ident));
202 return;
204 case SYM_UNION:
205 prepend(name, "union %s ", show_ident(sym->ident));
206 return;
208 case SYM_ENUM:
209 prepend(name, "enum %s ", show_ident(sym->ident));
210 return;
212 case SYM_NODE:
213 append(name, "%s", show_ident(sym->ident));
214 break;
216 case SYM_BITFIELD:
217 append(name, ":%d", sym->fieldwidth);
218 break;
220 case SYM_LABEL:
221 append(name, "label(%s:%p)", show_ident(sym->ident), sym);
222 break;
224 case SYM_ARRAY:
225 break;
227 default:
228 prepend(name, "unknown type %d", sym->type);
229 return;
232 mod = modifier_string(sym->ctype.modifiers);
233 modlen = strlen(mod);
234 name->start -= modlen;
235 memcpy(name->start, mod, modlen);
237 do_show_type(sym->ctype.base_type, name);
239 /* Postpend */
240 if (sym->ctype.as)
241 append(name, "<asn:%d>", sym->ctype.as);
243 switch (sym->type) {
244 case SYM_PTR:
245 return;
247 case SYM_FN:
248 append(name, " )( ... )");
249 return;
251 case SYM_ARRAY:
252 append(name, "[%d]", sym->array_size);
253 return;
254 default:
255 break;
259 void show_type(struct symbol *sym)
261 char array[200];
262 struct type_name name;
264 name.start = name.end = array+100;
265 do_show_type(sym, &name);
266 *name.end = 0;
267 printf("%s", name.start);
270 const char *show_typename(struct symbol *sym)
272 static char array[200];
273 struct type_name name;
275 name.start = name.end = array+100;
276 do_show_type(sym, &name);
277 *name.end = 0;
278 return name.start;
281 void show_symbol(struct symbol *sym)
283 struct symbol *type;
285 if (!sym)
286 return;
288 show_type(sym);
289 type = sym->ctype.base_type;
290 if (!type)
291 return;
294 * Show actual implementation information
296 switch (type->type) {
297 case SYM_STRUCT:
298 symbol_iterate(type->symbol_list, show_struct_member, NULL);
299 break;
301 case SYM_UNION:
302 symbol_iterate(type->symbol_list, show_struct_member, NULL);
303 break;
305 case SYM_FN:
306 printf("\n");
307 show_statement(type->stmt);
308 break;
310 default:
311 break;
314 if (sym->initializer) {
315 printf(" = \n");
316 show_expression(sym->initializer);
320 static int show_return_stmt(struct statement *stmt)
322 struct expression *expr = stmt->expression;
324 if (expr && expr->ctype) {
325 int val = show_expression(expr);
326 printf("\tmov.%d\t\tretval,v%d\n",
327 expr->ctype->bit_size, val);
329 printf("\tret\n");
330 return 0;
333 static int show_symbol_init(struct symbol *sym);
335 static int new_label(void)
337 static int label = 0;
338 return ++label;
342 * Print out a statement
344 int show_statement(struct statement *stmt)
346 if (!stmt)
347 return 0;
348 switch (stmt->type) {
349 case STMT_RETURN:
350 return show_return_stmt(stmt);
351 case STMT_COMPOUND: {
352 struct symbol *sym;
353 struct statement *s;
354 int last;
356 FOR_EACH_PTR(stmt->syms, sym) {
357 show_symbol_init(sym);
358 } END_FOR_EACH_PTR;
360 FOR_EACH_PTR(stmt->stmts, s) {
361 last = show_statement(s);
362 } END_FOR_EACH_PTR;
363 return last;
366 case STMT_EXPRESSION:
367 return show_expression(stmt->expression);
368 case STMT_IF: {
369 int val, target;
370 struct expression *cond = stmt->if_conditional;
372 if (cond->type == EXPR_VALUE) {
373 struct statement *s = stmt->if_true;
374 if (!cond->value)
375 s = stmt->if_false;
376 show_statement(s);
377 break;
379 val = show_expression(cond);
380 target = new_label();
381 printf("\tje\t\tv%d,.L%d\n", val, target);
382 show_statement(stmt->if_true);
383 if (stmt->if_false) {
384 int last = new_label();
385 printf("\tjmp\t\t.L%d\n", last);
386 printf(".L%d:\n", target);
387 target = last;
388 show_statement(stmt->if_false);
390 printf(".L%d:\n", target);
391 break;
393 case STMT_SWITCH: {
394 int val = show_expression(stmt->switch_expression);
395 printf("\tswitch v%d\n", val);
396 show_statement(stmt->switch_statement);
397 if (stmt->switch_break->used)
398 printf(".L%p:\n", stmt->switch_break);
399 break;
402 case STMT_CASE:
403 if (!stmt->case_expression)
404 printf("default");
405 else {
406 printf("case %lld", stmt->case_expression->value);
407 if (stmt->case_to) {
408 printf("...%lld", stmt->case_to->value);
412 printf(":\n");
413 show_statement(stmt->case_statement);
414 break;
416 case STMT_ITERATOR: {
417 struct statement *pre_statement = stmt->iterator_pre_statement;
418 struct expression *pre_condition = stmt->iterator_pre_condition;
419 struct statement *statement = stmt->iterator_statement;
420 struct statement *post_statement = stmt->iterator_post_statement;
421 struct expression *post_condition = stmt->iterator_post_condition;
422 int val, loop_top = 0, loop_bottom = 0;
424 show_statement(pre_statement);
425 if (pre_condition) {
426 if (pre_condition->type == EXPR_VALUE) {
427 if (!pre_condition->value)
428 break;
429 pre_condition = NULL;
430 } else {
431 loop_bottom = new_label();
432 val = show_expression(pre_condition);
433 printf("\tje\t\tv%d, .L%d\n", val, loop_bottom);
436 if (!post_condition || post_condition->type != EXPR_VALUE || post_condition->value)
437 loop_top = new_label();
438 printf(".L%d:\n", loop_top);
439 show_statement(statement);
440 if (stmt->iterator_continue->used)
441 printf(".L%p:\n", stmt->iterator_continue);
442 show_statement(post_statement);
443 if (!post_condition) {
444 printf("\tjmp\t\t.L%d\n", loop_top);
445 } else if (post_condition->type == EXPR_VALUE) {
446 if (post_condition->value)
447 printf("\tjmp\t\t.L%d\n", loop_top);
448 } else {
449 val = show_expression(post_condition);
450 printf("\tjne\t\tv%d, .L%d\n", val, loop_top);
452 if (stmt->iterator_break->used)
453 printf(".L%p:\n", stmt->iterator_break);
454 if (pre_condition)
455 printf(".L%d:\n", loop_bottom);
456 break;
458 case STMT_NONE:
459 printf("\t!NONE!\n");
460 break;
462 case STMT_LABEL:
463 printf(".L%p:\n", stmt->label_identifier);
464 show_statement(stmt->label_statement);
465 break;
467 case STMT_GOTO:
468 if (stmt->goto_expression) {
469 int val = show_expression(stmt->goto_expression);
470 printf("\tgoto *v%d\n", val);
471 } else {
472 printf("\tgoto .L%p\n", stmt->goto_label);
474 break;
475 case STMT_ASM:
476 printf("\tasm( .... )\n");
477 break;
480 return 0;
483 static void show_one_statement(struct statement *stmt, void *sep, int flags)
485 show_statement(stmt);
486 if (!(flags & ITERATE_LAST))
487 printf("%s", (const char *)sep);
490 void show_statement_list(struct statement_list *stmt, const char *sep)
492 statement_iterate(stmt, show_one_statement, (void *)sep);
495 static void show_one_expression(struct expression *expr, void *sep, int flags)
497 show_expression(expr);
498 if (!(flags & ITERATE_LAST))
499 printf("%s", (const char *)sep);
502 void show_expression_list(struct expression_list *list, const char *sep)
504 expression_iterate(list, show_one_expression, (void *)sep);
507 static int new_pseudo(void)
509 static int nr = 0;
510 return ++nr;
513 static int show_call_expression(struct expression *expr)
515 struct symbol *direct;
516 struct expression *arg, *fn;
517 int fncall, retval;
518 int framesize;
520 if (!expr->ctype) {
521 warn(expr->pos, "\tcall with no type!");
522 return 0;
525 framesize = 0;
526 FOR_EACH_PTR_REVERSE(expr->args, arg) {
527 int new = show_expression(arg);
528 int size = arg->ctype->bit_size;
529 printf("\tpush.%d\t\tv%d\n", size, new);
530 framesize += size >> 3;
531 } END_FOR_EACH_PTR;
533 fn = expr->fn;
535 /* Remove dereference, if any */
536 direct = NULL;
537 if (fn->type == EXPR_PREOP) {
538 if (fn->unop->type == EXPR_SYMBOL) {
539 struct symbol *sym = fn->unop->symbol;
540 if (sym->ctype.base_type->type == SYM_FN)
541 direct = sym;
544 if (direct) {
545 printf("\tcall\t\t%s\n", show_ident(direct->ident));
546 } else {
547 fncall = show_expression(fn);
548 printf("\tcall\t\t*v%d\n", fncall);
550 if (framesize)
551 printf("\tadd.%d\t\tvSP,vSP,$%d\n", BITS_IN_POINTER, framesize);
553 retval = new_pseudo();
554 printf("\tmov.%d\t\tv%d,retval\n", expr->ctype->bit_size, retval);
555 return retval;
558 static int show_binop(struct expression *expr)
560 int left = show_expression(expr->left);
561 int right = show_expression(expr->right);
562 int new = new_pseudo();
563 const char *opname;
564 static const char *name[] = {
565 ['+'] = "add", ['-'] = "sub",
566 ['*'] = "mul", ['/'] = "div",
567 ['%'] = "mod"
569 unsigned int op = expr->op;
571 opname = show_special(op);
572 if (op < sizeof(name)/sizeof(*name))
573 opname = name[op];
574 printf("\t%s.%d\t\tv%d,v%d,v%d\n", opname,
575 expr->ctype->bit_size,
576 new, left, right);
577 return new;
580 static int show_regular_preop(struct expression *expr)
582 int target = show_expression(expr->unop);
583 int new = new_pseudo();
584 static const char *name[] = {
585 ['!'] = "nonzero", ['-'] = "neg",
586 ['~'] = "not",
588 unsigned int op = expr->op;
589 const char *opname;
591 opname = show_special(op);
592 if (op < sizeof(name)/sizeof(*name))
593 opname = name[op];
594 printf("\t%s.%d\t\tv%d,v%d\n", opname, expr->ctype->bit_size, new, target);
595 return new;
599 * FIXME! Not all accesses are memory loads. We should
600 * check what kind of symbol is behind the dereference.
602 static int show_address_gen(struct expression *expr)
604 if (expr->type == EXPR_PREOP)
605 return show_expression(expr->unop);
606 return show_expression(expr->address);
609 static int show_load_gen(int bits, struct expression *expr, int addr)
611 int new = new_pseudo();
613 printf("\tld.%d\t\tv%d,[v%d]\n", bits, new, addr);
614 if (expr->type == EXPR_PREOP)
615 return new;
617 /* bitfield load! */
618 if (expr->bitpos)
619 printf("\tshr.%d\t\tv%d,v%d,$%d\n", bits, new, new, expr->bitpos);
620 printf("\tandi.%d\t\tv%d,v%d,$%llu\n", bits, new, new, (1ULL << expr->nrbits)-1);
621 return new;
624 static void show_store_gen(int bits, int value, struct expression *expr, int addr)
626 /* FIXME!!! Bitfield store! */
627 printf("\tst.%d\t\tv%d,[v%d]\n", bits, value, addr);
630 static int show_assignment(struct expression *expr)
632 struct expression *target = expr->left;
633 int val, addr, bits;
635 if (!expr->ctype)
636 return 0;
638 bits = expr->ctype->bit_size;
639 val = show_expression(expr->right);
640 addr = show_address_gen(target);
641 show_store_gen(bits, val, target, addr);
642 return val;
645 static int show_symbol_expr(struct symbol *sym);
647 static int show_initialization(struct symbol *sym, struct expression *expr)
649 int val, addr, bits;
651 if (!expr->ctype)
652 return 0;
654 bits = expr->ctype->bit_size;
655 val = show_expression(expr);
656 addr = show_symbol_expr(sym);
657 // FIXME! The "target" expression is for bitfield store information.
658 // Leave it NULL, which works fine.
659 show_store_gen(bits, val, NULL, addr);
660 return 0;
663 static int show_access(struct expression *expr)
665 int addr = show_address_gen(expr);
666 return show_load_gen(expr->ctype->bit_size, expr, addr);
669 static int show_inc_dec(struct expression *expr, int postop)
671 int addr = show_address_gen(expr->unop);
672 int retval, new;
673 const char *opname = expr->op == SPECIAL_INCREMENT ? "add" : "sub";
674 int bits = expr->ctype->bit_size;
676 retval = show_load_gen(bits, expr->unop, addr);
677 new = retval;
678 if (postop)
679 new = new_pseudo();
680 printf("\t%s.%d\t\tv%d,v%d,$1\n", opname, bits, new, retval);
681 show_store_gen(bits, new, expr->unop, addr);
682 return retval;
685 static int show_preop(struct expression *expr)
688 * '*' is an lvalue access, and is fundamentally different
689 * from an arithmetic operation. Maybe it should have an
690 * expression type of its own..
692 if (expr->op == '*')
693 return show_access(expr);
694 if (expr->op == SPECIAL_INCREMENT || expr->op == SPECIAL_DECREMENT)
695 return show_inc_dec(expr, 0);
696 return show_regular_preop(expr);
699 static int show_postop(struct expression *expr)
701 return show_inc_dec(expr, 1);
704 static int show_symbol_expr(struct symbol *sym)
706 int new = new_pseudo();
708 if (sym->ctype.modifiers & (MOD_TOPLEVEL | MOD_EXTERN | MOD_STATIC)) {
709 printf("\tmovi.%d\t\tv%d,$%s\n", BITS_IN_POINTER, new, show_ident(sym->ident));
710 return new;
712 if (sym->ctype.modifiers & MOD_ADDRESSABLE) {
713 printf("\taddi.%d\t\tv%d,vFP,$%lld\n", BITS_IN_POINTER, new, sym->value);
714 return new;
716 printf("\taddi.%d\t\tv%d,vFP,$xxx\n", BITS_IN_POINTER, new);
717 return new;
720 static int show_symbol_init(struct symbol *sym)
722 struct expression *expr = sym->initializer;
724 if (expr) {
725 int val, addr, bits;
727 bits = expr->ctype->bit_size;
728 val = show_expression(expr);
729 addr = show_symbol_expr(sym);
730 show_store_gen(bits, val, NULL, addr);
732 return 0;
735 static int type_is_signed(struct symbol *sym)
737 if (sym->type == SYM_NODE)
738 sym = sym->ctype.base_type;
739 if (sym->type == SYM_PTR)
740 return 0;
741 return !(sym->ctype.modifiers & MOD_UNSIGNED);
744 static int show_cast_expr(struct expression *expr)
746 struct symbol *old_type, *new_type;
747 int op = show_expression(expr->cast_expression);
748 int oldbits, newbits;
749 int new, is_signed;
751 old_type = expr->cast_expression->ctype;
752 new_type = expr->cast_type;
754 oldbits = old_type->bit_size;
755 newbits = new_type->bit_size;
756 if (oldbits >= newbits)
757 return op;
758 new = new_pseudo();
759 is_signed = type_is_signed(old_type);
760 if (is_signed) {
761 printf("\tsext%d.%d\tv%d,v%d\n", oldbits, newbits, new, op);
762 } else {
763 printf("\tandl.%d\t\tv%d,v%d,$%lu\n", newbits, new, op, (1UL << oldbits)-1);
765 return new;
768 static int show_value(struct expression *expr)
770 int new = new_pseudo();
771 unsigned long long value = expr->value;
773 printf("\tmovi.%d\t\tv%d,$%llu\n", expr->ctype->bit_size, new, value);
774 return new;
777 static int show_string_expr(struct expression *expr)
779 int new = new_pseudo();
781 printf("\tmovi.%d\t\tv%d,&%s\n", BITS_IN_POINTER, new, show_string(expr->string));
782 return new;
785 static int show_bitfield_expr(struct expression *expr)
787 return show_access(expr);
790 static int show_conditional_expr(struct expression *expr)
792 int cond = show_expression(expr->conditional);
793 int true = show_expression(expr->cond_true);
794 int false = show_expression(expr->cond_false);
795 int new = new_pseudo();
797 if (!true)
798 true = cond;
799 printf("[v%d]\tcmov.%d\t\tv%d,v%d,v%d\n", cond, expr->ctype->bit_size, new, true, false);
800 return new;
803 static int show_statement_expr(struct expression *expr)
805 return show_statement(expr->statement);
808 static int show_position_expr(struct expression *expr, struct symbol *base)
810 int new = show_expression(expr->init_expr);
811 struct symbol *ctype = expr->init_sym;
813 printf("\tinsert v%d at [%d:%d] of %s\n", new,
814 expr->init_offset, ctype->bit_offset,
815 show_ident(base->ident));
816 return 0;
819 static int show_initializer_expr(struct expression *expr, struct symbol *ctype)
821 struct expression *entry;
823 FOR_EACH_PTR(expr->expr_list, entry) {
824 // Nested initializers have their positions already
825 // recursively calculated - just output them too
826 if (entry->type == EXPR_INITIALIZER) {
827 show_initializer_expr(entry, ctype);
828 continue;
831 // Ignore initializer indexes and identifiers - the
832 // evaluator has taken them into account
833 if (entry->type == EXPR_IDENTIFIER || entry->type == EXPR_INDEX)
834 continue;
835 if (entry->type == EXPR_POS) {
836 show_position_expr(entry, ctype);
837 continue;
839 show_initialization(ctype, entry);
840 } END_FOR_EACH_PTR;
841 return 0;
845 * Print out an expression. Return the pseudo that contains the
846 * variable.
848 int show_expression(struct expression *expr)
850 if (!expr)
851 return 0;
853 if (!expr->ctype) {
854 struct position *pos = &expr->pos;
855 printf("\tno type at %s:%d:%d\n",
856 input_streams[pos->stream].name,
857 pos->line, pos->pos);
858 return 0;
861 switch (expr->type) {
862 case EXPR_CALL:
863 return show_call_expression(expr);
865 case EXPR_ASSIGNMENT:
866 return show_assignment(expr);
868 case EXPR_BINOP:
869 case EXPR_COMMA:
870 case EXPR_COMPARE:
871 case EXPR_LOGICAL:
872 return show_binop(expr);
873 case EXPR_PREOP:
874 return show_preop(expr);
875 case EXPR_POSTOP:
876 return show_postop(expr);
877 case EXPR_SYMBOL:
878 return show_symbol_expr(expr->symbol);
879 case EXPR_DEREF:
880 case EXPR_SIZEOF:
881 warn(expr->pos, "invalid expression after evaluation");
882 return 0;
883 case EXPR_CAST:
884 return show_cast_expr(expr);
885 case EXPR_VALUE:
886 return show_value(expr);
887 case EXPR_STRING:
888 return show_string_expr(expr);
889 case EXPR_BITFIELD:
890 return show_bitfield_expr(expr);
891 case EXPR_INITIALIZER:
892 return show_initializer_expr(expr, expr->ctype);
893 case EXPR_CONDITIONAL:
894 return show_conditional_expr(expr);
895 case EXPR_STATEMENT:
896 return show_statement_expr(expr);
898 // None of these should exist as direct expressions: they are only
899 // valid as sub-expressions of initializers.
900 case EXPR_POS:
901 warn(expr->pos, "unable to show plain initializer position expression");
902 return 0;
903 case EXPR_IDENTIFIER:
904 warn(expr->pos, "unable to show identifier expression");
905 return 0;
906 case EXPR_INDEX:
907 warn(expr->pos, "unable to show index expression");
908 return 0;
910 return 0;