]> Git Repo - binutils.git/blob - gdb/c-typeprint.c
* c-exp.y (exp:STRING): Convert C strings into array-of-char
[binutils.git] / gdb / c-typeprint.c
1 /* Support for printing C and C++ types for GDB, the GNU debugger.
2    Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20 #include "defs.h"
21 #include "obstack.h"
22 #include "bfd.h"                /* Binary File Description */
23 #include "symtab.h"
24 #include "gdbtypes.h"
25 #include "expression.h"
26 #include "value.h"
27 #include "gdbcore.h"
28 #include "target.h"
29 #include "command.h"
30 #include "gdbcmd.h"
31 #include "language.h"
32 #include "demangle.h"
33 #include "c-lang.h"
34 #include "typeprint.h"
35
36 #include <string.h>
37 #include <errno.h>
38
39 extern int demangle;    /* whether to print C++ syms raw or source-form */
40
41 static void
42 c_type_print_args PARAMS ((struct type *, FILE *));
43
44 static void
45 c_type_print_varspec_suffix PARAMS ((struct type *, FILE *, int, int, int));
46
47 static void
48 cp_type_print_derivation_info PARAMS ((FILE *, struct type *));
49
50 void
51 c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
52
53 void
54 c_type_print_base PARAMS ((struct type *, FILE *, int, int));
55
56 \f
57 /* Print a description of a type in the format of a 
58    typedef for the current language.
59    NEW is the new name for a type TYPE. */
60
61 void
62 c_typedef_print (type, new, stream)
63    struct type *type;
64    struct symbol *new;
65    FILE *stream;
66 {
67    switch (current_language->la_language)
68    {
69 #ifdef _LANG_c
70    case language_c:
71    case language_cplus:
72       fprintf_filtered(stream, "typedef ");
73       type_print(type,"",stream,0);
74       if(TYPE_NAME ((SYMBOL_TYPE (new))) == 0
75          || !STREQ (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_NAME (new)))
76         fprintf_filtered(stream,  " %s", SYMBOL_SOURCE_NAME(new));
77       break;
78 #endif
79 #ifdef _LANG_m2
80    case language_m2:
81       fprintf_filtered(stream, "TYPE ");
82       if(!TYPE_NAME(SYMBOL_TYPE(new)) ||
83          !STREQ (TYPE_NAME(SYMBOL_TYPE(new)), SYMBOL_NAME(new)))
84         fprintf_filtered(stream, "%s = ", SYMBOL_SOURCE_NAME(new));
85       else
86          fprintf_filtered(stream, "<builtin> = ");
87       type_print(type,"",stream,0);
88       break;
89 #endif
90 /* start-sanitize-chill */
91 #ifdef _LANG_chill
92    case language_chill:
93       error ("Missing Chill support in function c_typedef_print."); /*FIXME*/
94 #endif
95 /* end-sanitize-chill */
96    default:
97       error("Language not supported.");
98    }
99    fprintf_filtered(stream, ";\n");
100 }
101
102
103 /* LEVEL is the depth to indent lines by.  */
104
105 void
106 c_print_type (type, varstring, stream, show, level)
107      struct type *type;
108      char *varstring;
109      FILE *stream;
110      int show;
111      int level;
112 {
113   register enum type_code code;
114   int demangled_args;
115
116   c_type_print_base (type, stream, show, level);
117   code = TYPE_CODE (type);
118   if ((varstring != NULL && *varstring != '\0')
119       ||
120       /* Need a space if going to print stars or brackets;
121          but not if we will print just a type name.  */
122       ((show > 0 || TYPE_NAME (type) == 0)
123        &&
124        (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
125         || code == TYPE_CODE_METHOD
126         || code == TYPE_CODE_ARRAY
127         || code == TYPE_CODE_MEMBER
128         || code == TYPE_CODE_REF)))
129     fputs_filtered (" ", stream);
130   c_type_print_varspec_prefix (type, stream, show, 0);
131
132   fputs_filtered (varstring, stream);
133
134   /* For demangled function names, we have the arglist as part of the name,
135      so don't print an additional pair of ()'s */
136
137   demangled_args = varstring[strlen(varstring) - 1] == ')';
138   c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
139
140 }
141
142 /* Print the C++ method arguments ARGS to the file STREAM.  */
143
144 void
145 cp_type_print_method_args (args, prefix, varstring, staticp, stream)
146      struct type **args;
147      char *prefix;
148      char *varstring;
149      int staticp;
150      FILE *stream;
151 {
152   int i;
153
154   fputs_demangled (prefix, stream, DMGL_ANSI | DMGL_PARAMS);
155   fputs_demangled (varstring, stream, DMGL_ANSI | DMGL_PARAMS);
156   fputs_filtered (" (", stream);
157   if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
158     {
159       i = !staticp;             /* skip the class variable */
160       while (1)
161         {
162           type_print (args[i++], "", stream, 0);
163           if (!args[i]) 
164             {
165               fprintf_filtered (stream, " ...");
166               break;
167             }
168           else if (args[i]->code != TYPE_CODE_VOID)
169             {
170               fprintf_filtered (stream, ", ");
171             }
172           else break;
173         }
174     }
175   fprintf_filtered (stream, ")");
176 }
177   
178 /* If TYPE is a derived type, then print out derivation information.
179    Print only the actual base classes of this type, not the base classes
180    of the base classes.  I.E.  for the derivation hierarchy:
181
182         class A { int a; };
183         class B : public A {int b; };
184         class C : public B {int c; };
185
186    Print the type of class C as:
187
188         class C : public B {
189                 int c;
190         }
191
192    Not as the following (like gdb used to), which is not legal C++ syntax for
193    derived types and may be confused with the multiple inheritance form:
194
195         class C : public B : public A {
196                 int c;
197         }
198
199    In general, gdb should try to print the types as closely as possible to
200    the form that they appear in the source code. */
201
202 static void
203 cp_type_print_derivation_info (stream, type)
204      FILE *stream;
205      struct type *type;
206 {
207   char *name;
208   int i;
209
210   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
211     {
212       fputs_filtered (i == 0 ? ": " : ", ", stream);
213       fprintf_filtered (stream, "%s%s ",
214                         BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
215                         BASETYPE_VIA_VIRTUAL(type, i) ? " virtual" : "");
216       name = type_name_no_tag (TYPE_BASECLASS (type, i));
217       fprintf_filtered (stream, "%s", name ? name : "(null)");
218     }
219   if (i > 0)
220     {
221       fputs_filtered (" ", stream);
222     }
223 }
224
225 /* Print any asterisks or open-parentheses needed before the
226    variable name (to describe its type).
227
228    On outermost call, pass 0 for PASSED_A_PTR.
229    On outermost call, SHOW > 0 means should ignore
230    any typename for TYPE and show its details.
231    SHOW is always zero on recursive calls.  */
232
233 void
234 c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
235      struct type *type;
236      FILE *stream;
237      int show;
238      int passed_a_ptr;
239 {
240   char *name;
241   if (type == 0)
242     return;
243
244   if (TYPE_NAME (type) && show <= 0)
245     return;
246
247   QUIT;
248
249   switch (TYPE_CODE (type))
250     {
251     case TYPE_CODE_PTR:
252       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
253       fprintf_filtered (stream, "*");
254       break;
255
256     case TYPE_CODE_MEMBER:
257       if (passed_a_ptr)
258         fprintf_filtered (stream, "(");
259       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
260       fprintf_filtered (stream, " ");
261       name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
262       if (name)
263         fputs_filtered (name, stream);
264       else
265         c_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
266       fprintf_filtered (stream, "::");
267       break;
268
269     case TYPE_CODE_METHOD:
270       if (passed_a_ptr)
271         fprintf (stream, "(");
272       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
273       if (passed_a_ptr)
274         {
275           fprintf_filtered (stream, " ");
276           c_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
277           fprintf_filtered (stream, "::");
278         }
279       break;
280
281     case TYPE_CODE_REF:
282       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
283       fprintf_filtered (stream, "&");
284       break;
285
286     case TYPE_CODE_FUNC:
287       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
288       if (passed_a_ptr)
289         fprintf_filtered (stream, "(");
290       break;
291
292     case TYPE_CODE_ARRAY:
293       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
294       if (passed_a_ptr)
295         fprintf_filtered (stream, "(");
296       break;
297
298     case TYPE_CODE_UNDEF:
299     case TYPE_CODE_STRUCT:
300     case TYPE_CODE_UNION:
301     case TYPE_CODE_ENUM:
302     case TYPE_CODE_INT:
303     case TYPE_CODE_FLT:
304     case TYPE_CODE_VOID:
305     case TYPE_CODE_ERROR:
306     case TYPE_CODE_CHAR:
307     case TYPE_CODE_BOOL:
308     case TYPE_CODE_SET:
309     case TYPE_CODE_RANGE:
310     case TYPE_CODE_STRING:
311       /* These types need no prefix.  They are listed here so that
312          gcc -Wall will reveal any types that haven't been handled.  */
313       break;
314     }
315 }
316
317 static void
318 c_type_print_args (type, stream)
319      struct type *type;
320      FILE *stream;
321 {
322   int i;
323   struct type **args;
324
325   fprintf_filtered (stream, "(");
326   args = TYPE_ARG_TYPES (type);
327   if (args != NULL)
328     {
329       if (args[1] == NULL)
330         {
331           fprintf_filtered (stream, "...");
332         }
333       else
334         {
335           for (i = 1;
336                args[i] != NULL && args[i]->code != TYPE_CODE_VOID;
337                i++)
338             {
339               c_print_type (args[i], "", stream, -1, 0);
340               if (args[i+1] == NULL)
341                 {
342                   fprintf_filtered (stream, "...");
343                 }
344               else if (args[i+1]->code != TYPE_CODE_VOID)
345                 {
346                   fprintf_filtered (stream, ",");
347                   wrap_here ("    ");
348                 }
349             }
350         }
351     }
352   fprintf_filtered (stream, ")");
353 }
354
355 /* Print any array sizes, function arguments or close parentheses
356    needed after the variable name (to describe its type).
357    Args work like c_type_print_varspec_prefix.  */
358
359 static void
360 c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
361      struct type *type;
362      FILE *stream;
363      int show;
364      int passed_a_ptr;
365      int demangled_args;
366 {
367   if (type == 0)
368     return;
369
370   if (TYPE_NAME (type) && show <= 0)
371     return;
372
373   QUIT;
374
375   switch (TYPE_CODE (type))
376     {
377     case TYPE_CODE_ARRAY:
378       if (passed_a_ptr)
379         fprintf_filtered (stream, ")");
380       
381       fprintf_filtered (stream, "[");
382       if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
383         fprintf_filtered (stream, "%d",
384                           (TYPE_LENGTH (type)
385                            / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
386       fprintf_filtered (stream, "]");
387       
388       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
389       break;
390
391     case TYPE_CODE_MEMBER:
392       if (passed_a_ptr)
393         fprintf_filtered (stream, ")");
394       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
395       break;
396
397     case TYPE_CODE_METHOD:
398       if (passed_a_ptr)
399         fprintf_filtered (stream, ")");
400       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
401       if (passed_a_ptr)
402         {
403           c_type_print_args (type, stream);
404         }
405       break;
406
407     case TYPE_CODE_PTR:
408     case TYPE_CODE_REF:
409       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0);
410       break;
411
412     case TYPE_CODE_FUNC:
413       c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
414                                  passed_a_ptr, 0);
415       if (passed_a_ptr)
416         fprintf_filtered (stream, ")");
417       if (!demangled_args)
418         fprintf_filtered (stream, "()");
419       break;
420
421     case TYPE_CODE_UNDEF:
422     case TYPE_CODE_STRUCT:
423     case TYPE_CODE_UNION:
424     case TYPE_CODE_ENUM:
425     case TYPE_CODE_INT:
426     case TYPE_CODE_FLT:
427     case TYPE_CODE_VOID:
428     case TYPE_CODE_ERROR:
429     case TYPE_CODE_CHAR:
430     case TYPE_CODE_BOOL:
431     case TYPE_CODE_SET:
432     case TYPE_CODE_RANGE:
433     case TYPE_CODE_STRING:
434       /* These types do not need a suffix.  They are listed so that
435          gcc -Wall will report types that may not have been considered.  */
436       break;
437     }
438 }
439
440 /* Print the name of the type (or the ultimate pointer target,
441    function value or array element), or the description of a
442    structure or union.
443
444    SHOW nonzero means don't print this type as just its name;
445    show its real definition even if it has a name.
446    SHOW zero means print just typename or struct tag if there is one
447    SHOW negative means abbreviate structure elements.
448    SHOW is decremented for printing of structure elements.
449
450    LEVEL is the depth to indent by.
451    We increase it for some recursive calls.  */
452
453 void
454 c_type_print_base (type, stream, show, level)
455      struct type *type;
456      FILE *stream;
457      int show;
458      int level;
459 {
460   char *name;
461   register int i;
462   register int len;
463   register int lastval;
464   char *mangled_name;
465   char *demangled_name;
466   enum {s_none, s_public, s_private, s_protected} section_type;
467   QUIT;
468
469   wrap_here ("    ");
470   if (type == NULL)
471     {
472       fputs_filtered ("<type unknown>", stream);
473       return;
474     }
475
476   /* When SHOW is zero or less, and there is a valid type name, then always
477      just print the type name directly from the type. */
478
479   if ((show <= 0) && (TYPE_NAME (type) != NULL))
480     {
481       fputs_filtered (TYPE_NAME (type), stream);
482       return;
483     }
484
485   switch (TYPE_CODE (type))
486     {
487     case TYPE_CODE_ARRAY:
488     case TYPE_CODE_PTR:
489     case TYPE_CODE_MEMBER:
490     case TYPE_CODE_REF:
491     case TYPE_CODE_FUNC:
492     case TYPE_CODE_METHOD:
493       c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
494       break;
495
496     case TYPE_CODE_STRUCT:
497       fprintf_filtered (stream,
498                         HAVE_CPLUS_STRUCT (type) ? "class " : "struct ");
499       goto struct_union;
500
501     case TYPE_CODE_UNION:
502       fprintf_filtered (stream, "union ");
503     struct_union:
504       if ((name = type_name_no_tag (type)) != NULL)
505         {
506           fputs_filtered (name, stream);
507           fputs_filtered (" ", stream);
508           wrap_here ("    ");
509         }
510       if (show < 0)
511         fprintf_filtered (stream, "{...}");
512       else
513         {
514           check_stub_type (type);
515           
516           cp_type_print_derivation_info (stream, type);
517           
518           fprintf_filtered (stream, "{\n");
519           if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
520             {
521               if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
522                 fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
523               else
524                 fprintfi_filtered (level + 4, stream, "<no data fields>\n");
525             }
526
527           /* Start off with no specific section type, so we can print
528              one for the first field we find, and use that section type
529              thereafter until we find another type. */
530
531           section_type = s_none;
532
533           /* If there is a base class for this type,
534              do not print the field that it occupies.  */
535
536           len = TYPE_NFIELDS (type);
537           for (i = TYPE_N_BASECLASSES (type); i < len; i++)
538             {
539               QUIT;
540               /* Don't print out virtual function table.  */
541               if ((TYPE_FIELD_NAME (type, i))[5] == CPLUS_MARKER &&
542                   !strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
543                 continue;
544
545               /* If this is a C++ class we can print the various C++ section
546                  labels. */
547
548               if (HAVE_CPLUS_STRUCT (type))
549                 {
550                   if (TYPE_FIELD_PROTECTED (type, i))
551                     {
552                       if (section_type != s_protected)
553                         {
554                           section_type = s_protected;
555                           fprintfi_filtered (level + 2, stream,
556                                              "protected:\n");
557                         }
558                     }
559                   else if (TYPE_FIELD_PRIVATE (type, i))
560                     {
561                       if (section_type != s_private)
562                         {
563                           section_type = s_private;
564                           fprintfi_filtered (level + 2, stream, "private:\n");
565                         }
566                     }
567                   else
568                     {
569                       if (section_type != s_public)
570                         {
571                           section_type = s_public;
572                           fprintfi_filtered (level + 2, stream, "public:\n");
573                         }
574                     }
575                 }
576
577               print_spaces_filtered (level + 4, stream);
578               if (TYPE_FIELD_STATIC (type, i))
579                 {
580                   fprintf_filtered (stream, "static ");
581                 }
582               c_print_type (TYPE_FIELD_TYPE (type, i),
583                             TYPE_FIELD_NAME (type, i),
584                             stream, show - 1, level + 4);
585               if (!TYPE_FIELD_STATIC (type, i)
586                   && TYPE_FIELD_PACKED (type, i))
587                 {
588                   /* It is a bitfield.  This code does not attempt
589                      to look at the bitpos and reconstruct filler,
590                      unnamed fields.  This would lead to misleading
591                      results if the compiler does not put out fields
592                      for such things (I don't know what it does).  */
593                   fprintf_filtered (stream, " : %d",
594                                     TYPE_FIELD_BITSIZE (type, i));
595                 }
596               fprintf_filtered (stream, ";\n");
597             }
598
599           /* If there are both fields and methods, put a space between. */
600           len = TYPE_NFN_FIELDS (type);
601           if (len && section_type != s_none)
602              fprintf_filtered (stream, "\n");
603
604           /* C++: print out the methods */
605
606           for (i = 0; i < len; i++)
607             {
608               struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
609               int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
610               char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
611               int is_constructor = name && STREQ(method_name, name);
612               for (j = 0; j < len2; j++)
613                 {
614                   QUIT;
615                   if (TYPE_FN_FIELD_PROTECTED (f, j))
616                     {
617                       if (section_type != s_protected)
618                         {
619                           section_type = s_protected;
620                           fprintfi_filtered (level + 2, stream,
621                                              "protected:\n");
622                         }
623                     }
624                   else if (TYPE_FN_FIELD_PRIVATE (f, j))
625                     {
626                       if (section_type != s_private)
627                         {
628                           section_type = s_private;
629                           fprintfi_filtered (level + 2, stream, "private:\n");
630                         }
631                     }
632                   else
633                     {
634                       if (section_type != s_public)
635                         {
636                           section_type = s_public;
637                           fprintfi_filtered (level + 2, stream, "public:\n");
638                         }
639                     }
640
641                   print_spaces_filtered (level + 4, stream);
642                   if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
643                     fprintf_filtered (stream, "virtual ");
644                   else if (TYPE_FN_FIELD_STATIC_P (f, j))
645                     fprintf_filtered (stream, "static ");
646                   if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
647                     {
648                       /* Keep GDB from crashing here.  */
649                       fprintf (stream, "<undefined type> %s;\n",
650                                TYPE_FN_FIELD_PHYSNAME (f, j));
651                       break;
652                     }
653                   else if (!is_constructor)
654                     {
655                       type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
656                                   "", stream, 0);
657                       fputs_filtered (" ", stream);
658                     }
659                   if (TYPE_FN_FIELD_STUB (f, j))
660                     {
661                       /* Build something we can demangle.  */
662                       mangled_name = gdb_mangle_name (type, i, j);
663                       demangled_name =
664                           cplus_demangle (mangled_name,
665                                           DMGL_ANSI | DMGL_PARAMS);
666                       if (demangled_name == NULL)
667                         fprintf_filtered (stream, "<badly mangled name %s>",
668                             mangled_name);
669                       else 
670                         {
671                           fprintf_filtered (stream, "%s",
672                               strchr (demangled_name, ':') + 2);
673                           free (demangled_name);
674                         }
675                       free (mangled_name);
676                     }
677                   else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
678                         && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
679                     cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1,
680                                                "~", method_name, 0, stream);
681                   else
682                     cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
683                                                method_name,
684                                                TYPE_FN_FIELD_STATIC_P (f, j),
685                                                stream);
686
687                   fprintf_filtered (stream, ";\n");
688                 }
689             }
690
691           fprintfi_filtered (level, stream, "}");
692         }
693       break;
694
695     case TYPE_CODE_ENUM:
696       fprintf_filtered (stream, "enum ");
697       if ((name = type_name_no_tag (type)) != NULL)
698         {
699           fputs_filtered (name, stream);
700           fputs_filtered (" ", stream);
701         }
702       wrap_here ("    ");
703       if (show < 0)
704         fprintf_filtered (stream, "{...}");
705       else
706         {
707           fprintf_filtered (stream, "{");
708           len = TYPE_NFIELDS (type);
709           lastval = 0;
710           for (i = 0; i < len; i++)
711             {
712               QUIT;
713               if (i) fprintf_filtered (stream, ", ");
714               wrap_here ("    ");
715               fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
716               if (lastval != TYPE_FIELD_BITPOS (type, i))
717                 {
718                   fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
719                   lastval = TYPE_FIELD_BITPOS (type, i);
720                 }
721               lastval++;
722             }
723           fprintf_filtered (stream, "}");
724         }
725       break;
726
727     case TYPE_CODE_VOID:
728       fprintf_filtered (stream, "void");
729       break;
730
731     case TYPE_CODE_UNDEF:
732       fprintf_filtered (stream, "struct <unknown>");
733       break;
734
735     case TYPE_CODE_ERROR:
736       fprintf_filtered (stream, "<unknown type>");
737       break;
738
739     case TYPE_CODE_RANGE:
740       /* This should not occur */
741       fprintf_filtered (stream, "<range type>");
742       break;
743
744     default:
745       /* Handle types not explicitly handled by the other cases,
746          such as fundamental types.  For these, just print whatever
747          the type name is, as recorded in the type itself.  If there
748          is no type name, then complain. */
749       if (TYPE_NAME (type) != NULL)
750         {
751           fputs_filtered (TYPE_NAME (type), stream);
752         }
753       else
754         {
755           error ("Invalid type code (%d) in symbol table.", TYPE_CODE (type));
756         }
757       break;
758     }
759 }
760
This page took 0.067719 seconds and 4 git commands to generate.