home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / g++-dist / cplus-decl2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-25  |  67.8 KB  |  2,214 lines

  1. /* Process declarations and variables for C compiler.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.    Hacked by Michael Tiemann (tiemann@mcc.com)
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. /* Process declarations and symbol lookup for C front end.
  23.    Also constructs types; the standard scalar types at initialization,
  24.    and structure, union, array and enum types when they are declared.  */
  25.  
  26. /* ??? not all decl nodes are given the most useful possible
  27.    line numbers.  For example, the CONST_DECLs for enum values.  */
  28.  
  29. #include "config.h"
  30. #include "tree.h"
  31. #include "flags.h"
  32. #include "cplus-tree.h"
  33. #include "cplus-parse.h"
  34. #include "cplus-decl.h"
  35. #include "assert.h"
  36.  
  37. #define NULL 0
  38.  
  39. extern tree grokdeclarator ();
  40. static void grok_function_init ();
  41.  
  42. /* A list of virtual function tables we must make sure to write out.  */
  43. tree pending_vtables;
  44.  
  45. /* A list of static class variables.  This is needed, because a
  46.    static class variable can be declared inside the class without
  47.    an initializer, and then initialized, staticly, outside the class.  */
  48. tree pending_statics;
  49.  
  50. extern tree pending_addressable_inlines;
  51.  
  52. /* Used to help generate temporary names which are unique within
  53.    a function.  Reset to 0 by start_function.  */
  54.  
  55. static int temp_name_counter;
  56.  
  57. /* Same, but not reset.  Local temp variables and global temp variables
  58.    can have the same name.  */
  59. static int global_temp_name_counter;
  60.  
  61. /* The (assembler) name of the first globally-visible object output.  */
  62. extern char * first_global_object_name;
  63.  
  64. /* C (and C++) language-specific option variables.  */
  65.  
  66. /* Nonzero means allow type mismatches in conditional expressions;
  67.    just make their values `void'.   */
  68.  
  69. int flag_cond_mismatch;
  70.  
  71. /* Nonzero means don't recognize the keyword `asm'.  */
  72.  
  73. int flag_no_asm;
  74.  
  75. /* Nonzero means do some things the same way PCC does.  */
  76.  
  77. int flag_traditional;
  78.  
  79. /* Nonzero means warn about implicit declarations.  */
  80.  
  81. int warn_implicit = 1;
  82.  
  83. /* Nonzero means warn about function definitions that default the return type
  84.    or that use a null return and have a return-type other than void.  */
  85.  
  86. int warn_return_type;
  87.  
  88. /* Nonzero means give string constants the type `const char *'
  89.    to get extra warnings from them.  These warnings will be too numerous
  90.    to be useful, except in thoroughly ANSIfied programs.  */
  91.  
  92. int warn_write_strings;
  93.  
  94. /* Nonzero means warn about pointer casts that can drop a type qualifier
  95.    from the pointer target type.  */
  96.  
  97. int warn_cast_qual;
  98.  
  99. /* Nonzero means warn about sizeof(function) or addition/subtraction
  100.    of function pointers.  */
  101.  
  102. int warn_pointer_arith;
  103.  
  104. /* Nonzero means warn for all old-style non-prototype function decls.  */
  105.  
  106. int warn_strict_prototypes;
  107.  
  108. /* Non-zero means warn in function declared in derived class has the
  109.    same name as a virtual in the base class, but fails to match the
  110.    type signature of any virtual function in the base class.  */
  111. int warn_overloaded_virtual;
  112.  
  113. /* Non-zero means warn when converting between different enumeral types.  */
  114. int warn_enum_clash;
  115.  
  116. /* Nonzero means `$' can be in an identifier.
  117.    See cccp.c for reasons why this breaks some obscure ANSI C programs.  */
  118.  
  119. #ifndef DOLLARS_IN_IDENTIFIERS
  120. #define DOLLARS_IN_IDENTIFIERS 0
  121. #endif
  122. int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
  123.  
  124. /* Nonzero for -no-strict-prototype switch: do not consider empty
  125.    argument prototype to mean function takes no arguments.  */
  126.  
  127. int strict_prototype = 1;
  128. int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus = 1;
  129.  
  130. /* Nonzero means that labels can be used as first-class objects */
  131.  
  132. int flag_labels_ok;
  133.  
  134. /* Non-zero means to collect statistics which might be expensive
  135.    and to print them when we are done.  */
  136. int flag_detailed_statistics;
  137.  
  138. /* C++ specific flags.  */   
  139. /* Nonzero for -fall-virtual: make every member function (except
  140.    constructors) lay down in the virtual function table.  Calls
  141.    can then either go through the virtual function table or not,
  142.    depending.  */
  143.  
  144. int flag_all_virtual;
  145.  
  146. /* Zero means that `this' is a *const.  This gives nice behavior in the
  147.    2.0 world.  Nonzero gives 1.2-compatible behavior.  */
  148.  
  149. int flag_this_is_variable;
  150.  
  151. /* Nonzero means memoize our member lookups.  */
  152.  
  153. int flag_memoize_lookups; int flag_save_memoized_contexts;
  154.  
  155. /* Nonzero means to implement `dynamic' features a la SOS.  */
  156.  
  157. int flag_dynamic;
  158.  
  159. /* 2 means write out only specific virtual function tables
  160.    and give them (C) public visibility.
  161.    1 means write out virtual function tables and give them
  162.    (C) public visibility.
  163.    0 means write out virtual function tables and give them
  164.    (C) static visibility (default).
  165.    -1 means declare virtual function tables extern.  */
  166.  
  167. int write_virtuals;
  168.  
  169. /* Nonzero means we should attempt to elide constructors when possible.  */
  170.  
  171. int flag_elide_constructors;
  172.  
  173. /* Nonzero means if the type has methods, only output debugging
  174.    information if methods are actually written to the asm file.  */
  175.  
  176. int flag_minimal_debug;
  177.  
  178. /* Nonzero means recognize and handle exception handling constructs.
  179.    2 means handle exceptions the way Spring wants them handled.  */
  180.  
  181. int flag_handle_exceptions;
  182.  
  183. /* Nonzero means that member functions defined in class scope are
  184.    inline by default.  */
  185.  
  186. int flag_default_inline = 1;
  187.  
  188. /* Nonzero means that functions declared `inline' will be treated
  189.    as `static'.  Used in conjunction with -g.  */
  190. int flag_no_inline = 0;
  191.  
  192. /* Controls whether enums and ints freely convert.
  193.    1 means with complete freedom.
  194.    0 means enums can convert to ints, but not vice-versa.  */
  195. int flag_int_enum_equivalence;
  196.  
  197. /* Table of language-dependent -f options.
  198.    STRING is the option name.  VARIABLE is the address of the variable.
  199.    ON_VALUE is the value to store in VARIABLE
  200.     if `-fSTRING' is seen as an option.
  201.    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
  202.  
  203. static struct { char *string; int *variable; int on_value;} lang_f_options[] =
  204. {
  205.   {"signed-char", &flag_signed_char, 1},
  206.   {"unsigned-char", &flag_signed_char, 0},
  207.   {"short-enums", &flag_short_enums, 1},
  208.   {"cond-mismatch", &flag_cond_mismatch, 1},
  209.   {"asm", &flag_no_asm, 0},
  210.   {"labels-ok", &flag_labels_ok, 1},
  211.   {"stats", &flag_detailed_statistics, 1},
  212.   {"this-is-variable", &flag_this_is_variable, 1},
  213.   {"strict-prototype", &strict_prototypes_lang_cplusplus, 1},
  214.   {"warn-implicit", &warn_implicit, 1},
  215.   {"all-virtual", &flag_all_virtual, 1},
  216.   {"memoize-lookups", &flag_memoize_lookups, 1},
  217.   {"elide-constructors", &flag_elide_constructors, 1},
  218.   {"minimal-debug", &flag_minimal_debug, 1},
  219.   {"handle-exceptions", &flag_handle_exceptions, 1},
  220.   {"spring-exceptions", &flag_handle_exceptions, 2},
  221.   {"default-inline", &flag_default_inline, 1},
  222.   {"inline", &flag_no_inline, 0},
  223.   {"dollars-in-identifiers", &dollars_in_ident, 1},
  224.   {"enum-int-equiv", &flag_int_enum_equivalence, 1},
  225. };
  226.  
  227. /* Decode the string P as a language-specific option.
  228.    Return 1 if it is recognized (and handle it);
  229.    return 0 if not recognized.  */
  230.  
  231. int   
  232. lang_decode_option (p)
  233.      char *p;
  234. {
  235.   if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
  236.     flag_traditional = 1, dollars_in_ident = 1, flag_writable_strings = 1,
  237.     flag_this_is_variable = 1;
  238.   /* The +e options are for cfront compatability.  */
  239.   else if (p[0] == '+' && p[1] == 'e')
  240.     {
  241.       int old_write_virtuals = write_virtuals;
  242.       if (p[2] == '1')
  243.     write_virtuals = 1;
  244.       else if (p[2] == '0')
  245.     write_virtuals = -1;
  246.       else if (p[2] == '2')
  247.     write_virtuals = 2;
  248.       else error ("invalid +e option");
  249.       if (old_write_virtuals != 0
  250.       && write_virtuals != old_write_virtuals)
  251.     error ("conflicting +e options given");
  252.     }
  253.   else if (p[0] == '-' && p[1] == 'f')
  254.     {
  255.       /* Some kind of -f option.
  256.      P's value is the option sans `-f'.
  257.      Search for it in the table of options.  */
  258.       int found = 0, j;
  259.  
  260.       p += 2;
  261.       /* Try special -f options.  */
  262.  
  263.       if (!strcmp (p, "save-memoized"))
  264.     {
  265.       flag_memoize_lookups = 1;
  266.       flag_save_memoized_contexts = 1;
  267.       found = 1;
  268.     }
  269.       else if (!strcmp (p, "SOS"))
  270.     {
  271.       flag_all_virtual = 2;
  272.       found = 1;
  273.     }
  274.       else for (j = 0;
  275.         !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]);
  276.         j++)
  277.     {
  278.       if (!strcmp (p, lang_f_options[j].string))
  279.         {
  280.           *lang_f_options[j].variable = lang_f_options[j].on_value;
  281.           /* A goto here would be cleaner,
  282.          but breaks the vax pcc.  */
  283.           found = 1;
  284.         }
  285.       if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  286.           && ! strcmp (p+3, lang_f_options[j].string))
  287.         {
  288.           *lang_f_options[j].variable = ! lang_f_options[j].on_value;
  289.           found = 1;
  290.         }
  291.     }
  292.       return found;
  293.     }
  294.   else if (p[0] == '-' && p[1] == 'W')
  295.     {
  296.       /* The -W options control the warning behavior of the compiler.  */
  297.       p += 2;
  298.  
  299.       if (!strcmp (p, "implicit"))
  300.     warn_implicit = 1;
  301.       else if (!strcmp (p, "return-type"))
  302.     warn_return_type = 1;
  303.       else if (!strcmp (p, "write-strings"))
  304.     warn_write_strings = 1;
  305.       else if (!strcmp (p, "cast-qual"))
  306.     warn_cast_qual = 1;
  307.       else if (!strcmp (p, "pointer-arith"))
  308.     warn_pointer_arith = 1;
  309.       else if (!strcmp (p, "strict-prototypes"))
  310.     warn_strict_prototypes = 1;
  311.       else if (!strcmp (p, "comment"))
  312.     ;            /* cpp handles this one.  */
  313.       else if (!strcmp (p, "comments"))
  314.     ;            /* cpp handles this one.  */
  315.       else if (!strcmp (p, "trigraphs"))
  316.     ;            /* cpp handles this one.  */
  317.       else if (!strcmp (p, "all"))
  318.     {
  319.       extra_warnings = 1;
  320.       warn_implicit = 1;
  321.       warn_return_type = 1;
  322.       warn_unused = 1;
  323.       warn_switch = 1;
  324. #if 0
  325.       warn_enum_clash = 1;
  326. #endif
  327.     }
  328.  
  329.       else if (!strcmp (p, "overloaded-virtual"))
  330.     warn_overloaded_virtual = 1;
  331.       else if (!strcmp (p, "enum-clash"))
  332.     warn_enum_clash = 1;
  333.       else return 0;
  334.     }
  335.   else if (!strcmp (p, "-ansi"))
  336.     flag_no_asm = 1, dollars_in_ident = 0;
  337.   else
  338.     return 0;
  339.  
  340.   return 1;
  341. }
  342.  
  343. /* Incorporate `const' and `volatile' qualifiers for member functions.
  344.    FUNCTION is a TYPE_DECL or a FUNCTION_DECL.
  345.    QUALS is a list of qualifiers.  */
  346. tree
  347. grok_method_quals (ctype, function, quals)
  348.      tree ctype, function, quals;
  349. {
  350.   tree fntype = TREE_TYPE (function);
  351.   tree raises = TYPE_RAISES_EXCEPTIONS (fntype);
  352.  
  353.   assert (quals != NULL_TREE);
  354.   do
  355.     {
  356.       extern tree ridpointers[];
  357.  
  358.       if (TREE_VALUE (quals) == ridpointers[(int)RID_CONST])
  359.     {
  360.       if (TREE_READONLY (ctype))
  361.         error ("duplicate `%s' %s",
  362.            IDENTIFIER_POINTER (TREE_VALUE (quals)),
  363.            (TREE_CODE (function) == FUNCTION_DECL
  364.             ? "for member function" : "in type declaration"));
  365.       ctype = build_type_variant (ctype, 1, TREE_VOLATILE (ctype));
  366.       build_pointer_type (ctype);
  367.     }
  368.       else if (TREE_VALUE (quals) == ridpointers[(int)RID_VOLATILE])
  369.     {
  370.       if (TREE_VOLATILE (ctype))
  371.         error ("duplicate `%s' %s",
  372.            IDENTIFIER_POINTER (TREE_VALUE (quals)),
  373.            (TREE_CODE (function) == FUNCTION_DECL
  374.             ? "for member function" : "in type declaration"));
  375.       ctype = build_type_variant (ctype, TREE_READONLY (ctype), 1);
  376.       build_pointer_type (ctype);
  377.     }
  378.       else
  379.     abort ();
  380.       quals = TREE_CHAIN (quals);
  381.     }
  382.   while (quals);
  383.   fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype),
  384.                     (TREE_CODE (fntype) == METHOD_TYPE
  385.                      ? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
  386.                      : TYPE_ARG_TYPES (fntype)));
  387.   if (raises)
  388.     fntype = build_exception_variant (ctype, fntype, raises);
  389.  
  390.   TREE_TYPE (function) = fntype;
  391.   return ctype;
  392. }
  393.  
  394.  
  395. /* Classes overload their constituent function names automatically.
  396.    When a function name is declared in a record structure,
  397.    its name is changed to it overloaded name.  Since names for
  398.    constructors and destructors can conflict, we place a leading
  399.    '$' for destructors.
  400.  
  401.    CNAME is the name of the class we are grokking for.
  402.  
  403.    FUNCTION is a FUNCTION_DECL.  It was created by `grokdeclarator'.
  404.  
  405.    FLAGS contains bits saying what's special about today's
  406.    arguments.  1 == DESTRUCTOR.  2 == OPERATOR.
  407.  
  408.    If FUNCTION is a destructor, then we must add the `auto-delete' field
  409.    as a second parameter.  There is some hair associated with the fact
  410.    that we must "declare" this variable in the manner consistent with the
  411.    way the rest of the arguements were declared.
  412.  
  413.    If FUNCTION is a constructor, and we are doing SOS hacks for dynamic
  414.    classes, then the second hidden argument is the virtual function table
  415.    pointer with which to initialize the object.
  416.  
  417.    QUALS are the qualifiers for the this pointer.  */
  418.  
  419. void
  420. grokclassfn (ctype, cname, function, flags, complain, quals)
  421.      tree ctype, cname, function;
  422.      enum overload_flags flags;
  423.      tree quals;
  424. {
  425.   tree fn_name = DECL_NAME (function);
  426.   tree arg_types;
  427.   tree parm;
  428.   char *name;
  429.  
  430.   if (fn_name == NULL_TREE)
  431.     {
  432.       error ("name missing for member function");
  433.       fn_name = get_identifier ("<anonymous>");
  434.       DECL_NAME (function) = DECL_ORIGINAL_NAME (function) = fn_name;
  435.     }
  436.  
  437.   if (quals)
  438.     ctype = grok_method_quals (ctype, function, quals);
  439.  
  440.   arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
  441.   if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
  442.     {
  443.       /* Must add the class instance variable up front.  */
  444.       /* Right now we just make this a pointer.  But later
  445.      we may wish to make it special.  */
  446.       tree type = TREE_VALUE (arg_types);
  447.  
  448.       if (flags == DTOR_FLAG)
  449.     type = TYPE_MAIN_VARIANT (type);
  450.       else if (DECL_CONSTRUCTOR_P (function))
  451.     {
  452.       if (TYPE_DYNAMIC (ctype))
  453.         {
  454.           parm = build_decl (PARM_DECL, get_identifier (AUTO_VTABLE_NAME), TYPE_POINTER_TO (ptr_type_node));
  455.           TREE_USED (parm) = 1;
  456.           TREE_READONLY (parm) = 1;
  457.           DECL_ARG_TYPE (parm) = TYPE_POINTER_TO (ptr_type_node);
  458.           TREE_CHAIN (parm) = last_function_parms;
  459.           last_function_parms = parm;
  460.         }
  461.  
  462.       if (TYPE_USES_VIRTUAL_BASECLASSES (ctype))
  463.         {
  464.           DECL_CONSTRUCTOR_FOR_VBASE_P (function) = 1;
  465.           /* In this case we need "in-charge" flag saying whether
  466.          this constructor is responsible for initialization
  467.          of virtual baseclasses or not.  */
  468.           parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
  469.           DECL_ARG_TYPE (parm) = integer_type_node;
  470.           TREE_REGDECL (parm) = 1;
  471.           TREE_CHAIN (parm) = last_function_parms;
  472.           last_function_parms = parm;
  473.         }
  474.     }
  475.  
  476.       parm = build_decl (PARM_DECL, this_identifier, type);
  477.       DECL_ARG_TYPE (parm) = type;
  478.       /* We can make this a register, so long as we don't
  479.      accidently complain if someone tries to take its address.  */
  480.       TREE_REGDECL (parm) = 1;
  481.       if (flags != DTOR_FLAG
  482.       && (!flag_this_is_variable || TREE_READONLY (type)))
  483.     TREE_READONLY (parm) = 1;
  484.       TREE_CHAIN (parm) = last_function_parms;
  485.       last_function_parms = parm;
  486.     }
  487.  
  488.   if (flags == DTOR_FLAG)
  489.     {
  490.       tree const_integer_type = build_type_variant (integer_type_node, 1, 0);
  491.       arg_types = hash_tree_chain (const_integer_type, void_list_node);
  492.       name = (char *)alloca (sizeof (DESTRUCTOR_DECL_FORMAT)
  493.                  + IDENTIFIER_LENGTH (cname) + 2);
  494.       sprintf (name, DESTRUCTOR_DECL_FORMAT, IDENTIFIER_POINTER (cname));
  495.       DECL_NAME (function) = get_identifier (name);
  496.       DECL_ASSEMBLER_NAME (function) = IDENTIFIER_POINTER (DECL_NAME (function));
  497.       parm = build_decl (PARM_DECL, in_charge_identifier, const_integer_type);
  498.       TREE_USED (parm) = 1;
  499.       TREE_READONLY (parm) = 1;
  500.       DECL_ARG_TYPE (parm) = const_integer_type;
  501.       /* This is the same chain as DECL_ARGUMENTS (fndecl).  */
  502.       TREE_CHAIN (last_function_parms) = parm;
  503.  
  504.       TREE_TYPE (function) = build_cplus_method_type (ctype, void_type_node, arg_types);
  505.       TYPE_HAS_DESTRUCTOR (ctype) = 1;
  506.     }
  507.   else if (flags == WRAPPER_FLAG || flags == ANTI_WRAPPER_FLAG)
  508.     {
  509.       name = (char *)alloca (sizeof (WRAPPER_DECL_FORMAT)
  510.                  + sizeof (ANTI_WRAPPER_DECL_FORMAT)
  511.                  + IDENTIFIER_LENGTH (cname) + 2);
  512.       sprintf (name,
  513.            flags == WRAPPER_FLAG ? WRAPPER_DECL_FORMAT : ANTI_WRAPPER_DECL_FORMAT,
  514.            IDENTIFIER_POINTER (cname));
  515.       DECL_NAME (function) = build_decl_overload (name, arg_types, 1);
  516.       DECL_ASSEMBLER_NAME (function) = IDENTIFIER_POINTER (DECL_NAME (function));
  517.       sprintf (name, flags == WRAPPER_FLAG ? WRAPPER_NAME_FORMAT : ANTI_WRAPPER_NAME_FORMAT,
  518.            IDENTIFIER_POINTER (cname));
  519.       DECL_ORIGINAL_NAME (function) = fn_name = get_identifier (name);
  520.     }
  521.   else if (flags == WRAPPER_PRED_FLAG)
  522.     {
  523.       name = (char *)alloca (sizeof (WRAPPER_PRED_DECL_FORMAT)
  524.                  + sizeof (WRAPPER_PRED_NAME_FORMAT)
  525.                  + IDENTIFIER_LENGTH (cname) + 2);
  526.       sprintf (name, WRAPPER_PRED_DECL_FORMAT, IDENTIFIER_POINTER (cname));
  527.       DECL_NAME (function) = build_decl_overload (name, arg_types, 1);
  528.       DECL_ASSEMBLER_NAME (function) = IDENTIFIER_POINTER (DECL_NAME (function));
  529.       sprintf (name, WRAPPER_PRED_NAME_FORMAT, IDENTIFIER_POINTER (cname));
  530.       DECL_ORIGINAL_NAME (function) = fn_name = get_identifier (name);
  531.     }
  532.   else
  533.     {
  534.       tree these_arg_types;
  535.  
  536.       if (TYPE_DYNAMIC (ctype) && DECL_CONSTRUCTOR_P (function))
  537.     {
  538.       arg_types = hash_tree_chain (build_pointer_type (ptr_type_node),
  539.                        TREE_CHAIN (arg_types));
  540.       TREE_TYPE (function)
  541.         = build_cplus_method_type (ctype, TREE_TYPE (TREE_TYPE (function)), arg_types);
  542.       arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
  543.     }
  544.  
  545.       if (DECL_CONSTRUCTOR_FOR_VBASE_P (function))
  546.     {
  547.       arg_types = hash_tree_chain (integer_type_node, TREE_CHAIN (arg_types));
  548.       TREE_TYPE (function)
  549.         = build_cplus_method_type (ctype, TREE_TYPE (TREE_TYPE (function)), arg_types);
  550.       arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
  551.     }
  552.  
  553.       these_arg_types = arg_types;
  554.  
  555.       if (TREE_CODE (TREE_TYPE (function)) == FUNCTION_TYPE)
  556.     /* Only true for static member functions.  */
  557.     these_arg_types = hash_tree_chain (TYPE_POINTER_TO (ctype), arg_types);
  558.  
  559.       DECL_NAME (function) = build_decl_overload (IDENTIFIER_POINTER (fn_name),
  560.                           these_arg_types,
  561.                           1 + DECL_CONSTRUCTOR_P (function));
  562.       DECL_ASSEMBLER_NAME (function) = IDENTIFIER_POINTER (DECL_NAME (function));
  563.       if (flags == TYPENAME_FLAG)
  564.     TREE_TYPE (DECL_NAME (function)) = TREE_TYPE (fn_name);
  565.     }
  566.  
  567.   DECL_ARGUMENTS (function) = last_function_parms;
  568.  
  569.   /* now, the sanity check: report error if this function is not
  570.      really a member of the class it is supposed to belong to.  */
  571.   if (complain)
  572.     {
  573.       tree field;
  574.       int need_quotes = 0;
  575.       char *err_name;
  576.       tree method_vec = CLASSTYPE_METHOD_VEC (ctype);
  577.       tree *methods = 0;
  578.       tree *end = 0;
  579.  
  580.       if (method_vec != 0)
  581.     {
  582.       methods = &TREE_VEC_ELT (method_vec, 0);
  583.       end = TREE_VEC_END (method_vec);
  584.  
  585.       if (*methods == 0)
  586.         methods++;
  587.  
  588.       while (methods != end)
  589.         {
  590.           if (fn_name == DECL_ORIGINAL_NAME (*methods))
  591.         {
  592.           field = *methods;
  593.           while (field)
  594.             {
  595.               if (DECL_NAME (function) == DECL_NAME (field))
  596.             return;
  597.               field = TREE_CHAIN (field);
  598.             }
  599.           break;    /* loser */
  600.         }
  601.           methods++;
  602.         }
  603.     }
  604.  
  605.       if (OPERATOR_NAME_P (fn_name))
  606.     {
  607.       err_name = (char *)alloca (1024);
  608.       sprintf (err_name, "`operator %s'", operator_name_string (fn_name));
  609.     }
  610.       else if (OPERATOR_TYPENAME_P (fn_name))
  611.     if (complain && TYPE_HAS_CONVERSION (ctype))
  612.       err_name = "such type conversion operator";
  613.     else
  614.       err_name = "type conversion operator";
  615.       else if (flags == WRAPPER_FLAG)
  616.     err_name = "wrapper";
  617.       else if (flags == WRAPPER_PRED_FLAG)
  618.     err_name = "wrapper predicate";
  619.       else
  620.     {
  621.       err_name = IDENTIFIER_POINTER (fn_name);
  622.       need_quotes = 1;
  623.     }
  624.  
  625.       if (methods != end)
  626.     if (need_quotes)
  627.       error ("argument list for `%s' does not match any in class", err_name);
  628.     else
  629.       error ("argument list for %s does not match any in class", err_name);
  630.       else
  631.     {
  632.       methods = 0;
  633.       if (need_quotes)
  634.         error ("no `%s' member function declared in class", err_name);
  635.       else
  636.         error ("no %s declared in class", err_name);
  637.     }
  638.  
  639.       /* If we did not find the method in the class, add it to
  640.      avoid spurious errors.  */
  641.       add_method (ctype, methods, function);
  642.     }
  643. }
  644.  
  645. /* Process the specs, declarator (NULL if omitted) and width (NULL if omitted)
  646.    of a structure component, returning a FIELD_DECL node.
  647.    QUALS is a list of type qualifiers for this decl (such as for declaring
  648.    const member functions).
  649.  
  650.    This is done during the parsing of the struct declaration.
  651.    The FIELD_DECL nodes are chained together and the lot of them
  652.    are ultimately passed to `build_struct' to make the RECORD_TYPE node.
  653.  
  654.    C++:
  655.  
  656.    If class A defines that certain functions in class B are friends, then
  657.    the way I have set things up, it is B who is interested in permission
  658.    granted by A.  However, it is in A's context that these declarations
  659.    are parsed.  By returning a void_type_node, class A does not attempt
  660.    to incorporate the declarations of the friends within its structure.
  661.  
  662.    DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING
  663.    CHANGES TO CODE IN `start_method'.  */
  664.  
  665. tree
  666. grokfield (declarator, declspecs, raises, init, asmspec_tree)
  667.      tree declarator, declspecs, raises, init;
  668.      tree asmspec_tree;
  669. {
  670.   register tree value = grokdeclarator (declarator, declspecs, FIELD, init != 0, raises);
  671.   char *asmspec = 0;
  672.  
  673.   if (! value) return NULL_TREE; /* friends went bad.  */
  674.  
  675.   /* Pass friendly classes back.  */
  676.   if (TREE_CODE (value) == VOID_TYPE)
  677.     return void_type_node;
  678.  
  679.   if (DECL_NAME (value) != NULL_TREE
  680.       && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
  681.       && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
  682.     error_with_decl (value, "member `%s' conflicts with virtual function table field name");
  683.  
  684.   /* Stash away type declarations.  */
  685.   if (TREE_CODE (value) == TYPE_DECL)
  686.     {
  687.       TREE_NONLOCAL (value) = 1;
  688.       CLASSTYPE_LOCAL_TYPEDECLS (current_class_type) = 1;
  689.       pushdecl_class_level (value);
  690.       return value;
  691.     }
  692.  
  693.   if (DECL_IN_AGGR_P (value))
  694.     {
  695.       error_with_decl (value, "`%s' is already defined in aggregate scope");
  696.       return void_type_node;
  697.     }
  698.  
  699.   if (asmspec_tree)
  700.     asmspec = TREE_STRING_POINTER (asmspec_tree);
  701.  
  702.   if (init != 0)
  703.     {
  704.       if (TREE_CODE (value) == FUNCTION_DECL)
  705.     {
  706.       grok_function_init (value, init);
  707.       init = NULL_TREE;
  708.     }
  709.       else if (pedantic
  710.       && ! TREE_STATIC (value)
  711.       && ! TREE_READONLY (value))
  712.     {
  713.       error ("fields cannot have initializers");
  714.       init = error_mark_node;
  715.     }
  716.       else
  717.     {
  718.       /* We allow initializers to become parameters to base initializers.  */
  719.       if (TREE_CODE (init) == CONST_DECL)
  720.         init = DECL_INITIAL (init);
  721.       else if (TREE_READONLY (init) && TREE_CODE (init) == VAR_DECL)
  722.         init = decl_constant_value (init);
  723.       else if (TREE_CODE (init) == CONSTRUCTOR)
  724.         init = digest_init (TREE_TYPE (value), init, 0);
  725.       assert (TREE_PERMANENT (init));
  726.       if (init == error_mark_node)
  727.         /* We must make this look different than `error_mark_node'
  728.            because `decl_const_value' would mis-interpret it
  729.            as only meaning that this VAR_DECL is defined.  */
  730.         init = build1 (NOP_EXPR, TREE_TYPE (value), init);
  731.       else if (! TREE_LITERAL (init))
  732.         {
  733.           /* We can allow references to things that are effectively
  734.          static, since references are initialized with the address.  */
  735.           if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE
  736.           || (TREE_EXTERNAL (init) == 0
  737.               && TREE_STATIC (init) == 0))
  738.         {
  739.           error ("field initializer is not constant");
  740.           init = error_mark_node;
  741.         }
  742.         }
  743.     }
  744.     }
  745.  
  746.   if (TREE_CODE (value) == VAR_DECL)
  747.     {
  748.       /* We cannot call pushdecl here, because that would
  749.      fill in the value of our TREE_CHAIN.  Instead, we
  750.      modify finish_decl to do the right thing, namely, to
  751.      put this decl out straight away.  */
  752.       if (TREE_STATIC (value))
  753.     {
  754.       if (asmspec == 0)
  755.         {
  756.           char *buf
  757.         = (char *)alloca (IDENTIFIER_LENGTH (current_class_name)
  758.                   + IDENTIFIER_LENGTH (DECL_NAME (value))
  759.                   + sizeof (STATIC_NAME_FORMAT));
  760.           tree name;
  761.  
  762.           sprintf (buf, STATIC_NAME_FORMAT,
  763.                IDENTIFIER_POINTER (current_class_name),
  764.                IDENTIFIER_POINTER (DECL_NAME (value)));
  765.           name = get_identifier (buf);
  766.           TREE_PUBLIC (value) = 1;
  767.           DECL_INITIAL (value) = error_mark_node;
  768.           asmspec = IDENTIFIER_POINTER (name);
  769.           DECL_ASSEMBLER_NAME (value) = asmspec;
  770.           asmspec_tree = build_string (IDENTIFIER_LENGTH (name), asmspec);
  771.         }
  772.       pending_statics = perm_tree_cons (NULL_TREE, value, pending_statics);
  773.     }
  774.       DECL_INITIAL (value) = init;
  775.       DECL_IN_AGGR_P (value) = 1;
  776.       finish_decl (value, init, asmspec_tree);
  777.       pushdecl_class_level (value);
  778.       return value;
  779.     }
  780.   if (TREE_CODE (value) == FIELD_DECL)
  781.     {
  782.       DECL_ASSEMBLER_NAME (value) = asmspec;
  783.       if (DECL_INITIAL (value) == error_mark_node)
  784.     init = error_mark_node;
  785.       finish_decl (value, init, asmspec_tree);
  786.       DECL_INITIAL (value) = init;
  787.       DECL_IN_AGGR_P (value) = 1;
  788.       return value;
  789.     }
  790.   if (TREE_CODE (value) == FUNCTION_DECL)
  791.     {
  792.       /* grokdeclarator defers setting this.  */
  793.       TREE_PUBLIC (value) = 1;
  794.       if (TREE_CHAIN (value) != NULL_TREE)
  795.     {
  796.       /* Need a fresh node here so that we don't get circularity
  797.          when we link these together.  */
  798.       value = copy_node (value);
  799.       /* When does this happen?  */
  800.       assert (init == NULL_TREE);
  801.     }
  802.       finish_decl (value, init, asmspec_tree);
  803.  
  804.       /* Pass friends back this way.  */
  805.       if (DECL_FRIEND_P (value))
  806.     return void_type_node;
  807.  
  808.       DECL_IN_AGGR_P (value) = 1;
  809.       return value;
  810.     }
  811.   abort ();
  812. }
  813.  
  814. /* Like `grokfield', but for bitfields.
  815.    WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node.  */
  816.  
  817. tree
  818. grokbitfield (declarator, declspecs, width)
  819.      tree declarator, declspecs, width;
  820. {
  821.   register tree value = grokdeclarator (declarator, declspecs, FIELD, 0, NULL_TREE, NULL_TREE);
  822.  
  823.   if (! value) return NULL_TREE; /* friends went bad.  */
  824.  
  825.   /* Pass friendly classes back.  */
  826.   if (TREE_CODE (value) == VOID_TYPE)
  827.     return void_type_node;
  828.  
  829.   if (DECL_IN_AGGR_P (value))
  830.     {
  831.       error_with_decl (value, "`%s' is already defined in aggregate scope");
  832.       return void_type_node;
  833.     }
  834.  
  835.   if (TREE_STATIC (value))
  836.     {
  837.       error_with_decl (value, "static member `%s' cannot be a bitfield");
  838.       return NULL_TREE;
  839.     }
  840.   if (TREE_CODE (value) == FIELD_DECL)
  841.     {
  842.       finish_decl (value, NULL_TREE, NULL_TREE);
  843.       /* detect invalid field size.  */
  844.       if (TREE_CODE (width) == CONST_DECL)
  845.     width = DECL_INITIAL (width);
  846.       else if (TREE_READONLY (width) && TREE_CODE (width) == VAR_DECL)
  847.     width = decl_constant_value (width);
  848.  
  849.       if (TREE_CODE (width) != INTEGER_CST)
  850.     {
  851.       error_with_decl (value, "structure field `%s' width not an integer constant");
  852.       DECL_INITIAL (value) = NULL;
  853.     }
  854.       else
  855.     {
  856.       DECL_INITIAL (value) = width;
  857.       TREE_PACKED (value) = 1;
  858.     }
  859.       DECL_IN_AGGR_P (value) = 1;
  860.       return value;
  861.     }
  862.   abort ();
  863. }
  864.  
  865. /* Like GROKFIELD, except that the declarator has been
  866.    buried in DECLSPECS.  Find the declarator, and
  867.    return something that looks like it came from
  868.    GROKFIELD.  */
  869. tree
  870. groktypefield (declspecs, parmlist)
  871.      tree declspecs;
  872.      tree parmlist;
  873. {
  874.   tree spec = declspecs;
  875.   tree prev = NULL_TREE;
  876.  
  877.   tree type_id = NULL_TREE;
  878.   tree quals = NULL_TREE;
  879.   tree lengths = NULL_TREE;
  880.   tree decl = NULL_TREE;
  881.  
  882.   while (spec)
  883.     {
  884.       register tree id = TREE_VALUE (spec);
  885.  
  886.       if (TREE_CODE (spec) != TREE_LIST)
  887.     /* Certain parse errors slip through.  For example,
  888.        `int class ();' is not caught by the parser. Try
  889.        weakly to recover here.  */
  890.     return NULL_TREE;
  891.  
  892.       if (TREE_CODE (id) == TYPE_DECL
  893.       || (TREE_CODE (id) == IDENTIFIER_NODE && TREE_TYPE (id)))
  894.     {
  895.       /* We have a constructor/destructor or
  896.          conversion operator.  Use it.  */
  897.       if (prev)
  898.         TREE_CHAIN (prev) = TREE_CHAIN (spec);
  899.       else
  900.         {
  901.           declspecs = TREE_CHAIN (spec);
  902.         }
  903.       type_id = id;
  904.       goto found;
  905.     }
  906.       prev = spec;
  907.       spec = TREE_CHAIN (spec);
  908.     }
  909.  
  910.   /* Nope, we have a conversion operator to a scalar type.  */
  911.   spec = declspecs;
  912.   while (spec)
  913.     {
  914.       tree id = TREE_VALUE (spec);
  915.  
  916.       if (TREE_CODE (id) == IDENTIFIER_NODE)
  917.     {
  918.       if (id == ridpointers[(int)RID_INT]
  919.           || id == ridpointers[(int)RID_DOUBLE]
  920.           || id == ridpointers[(int)RID_FLOAT])
  921.         {
  922.           if (type_id)
  923.         error ("extra `%s' ignored",
  924.                IDENTIFIER_POINTER (id));
  925.           else
  926.         type_id = id;
  927.         }
  928.       else if (id == ridpointers[(int)RID_LONG]
  929.            || id == ridpointers[(int)RID_SHORT]
  930.            || id == ridpointers[(int)RID_CHAR])
  931.         {
  932.           lengths = tree_cons (NULL_TREE, id, lengths);
  933.         }
  934.       else if (id == ridpointers[(int)RID_VOID])
  935.         {
  936.           if (type_id)
  937.         error ("spurious `void' type ignored");
  938.           else
  939.         error ("conversion to `void' type invalid");
  940.         }
  941.       else if (id == ridpointers[(int)RID_AUTO]
  942.            || id == ridpointers[(int)RID_REGISTER]
  943.            || id == ridpointers[(int)RID_TYPEDEF]
  944.            || id == ridpointers[(int)RID_CONST]
  945.            || id == ridpointers[(int)RID_VOLATILE])
  946.         {
  947.           error ("type specifier `%s' used invalidly",
  948.              IDENTIFIER_POINTER (id));
  949.         }
  950.       else if (id == ridpointers[(int)RID_FRIEND]
  951.            || id == ridpointers[(int)RID_VIRTUAL]
  952.            || id == ridpointers[(int)RID_INLINE]
  953.            || id == ridpointers[(int)RID_UNSIGNED]
  954.            || id == ridpointers[(int)RID_SIGNED]
  955.            || id == ridpointers[(int)RID_STATIC]
  956.            || id == ridpointers[(int)RID_EXTERN])
  957.         {
  958.           quals = tree_cons (NULL_TREE, id, quals);
  959.         }
  960.       else
  961.         {
  962.           /* Happens when we have a global typedef
  963.          and a class-local member function with
  964.          the same name.  */
  965.           type_id = id;
  966.           goto found;
  967.         }
  968.     }
  969.       else if (TREE_CODE (id) == RECORD_TYPE)
  970.     error ("identifier for aggregate type conversion omitted");
  971.       else
  972.     assert (0);
  973.       spec = TREE_CHAIN (spec);
  974.     }
  975.  
  976.   if (type_id)
  977.     {
  978.       declspecs = chainon (lengths, quals);
  979.     }
  980.   else if (lengths)
  981.     {
  982.       if (TREE_CHAIN (lengths))
  983.     error ("multiple length specifiers");
  984.       type_id = ridpointers[(int)RID_INT];
  985.       declspecs = chainon (lengths, quals);
  986.     }
  987.   else if (quals)
  988.     {
  989.       error ("no type given, defaulting to `operator int ...'");
  990.       type_id = ridpointers[(int)RID_INT];
  991.       declspecs = quals;
  992.     }
  993.   else return NULL_TREE;
  994.  found:
  995.   decl = grokdeclarator (build_parse_node (CALL_EXPR, type_id, parmlist, NULL_TREE),
  996.              declspecs, FIELD, 0, NULL_TREE);
  997.   if (decl == NULL_TREE)
  998.     return NULL_TREE;
  999.  
  1000.   if (TREE_CODE (decl) == FUNCTION_DECL && TREE_CHAIN (decl) != NULL_TREE)
  1001.     {
  1002.       /* Need a fresh node here so that we don't get circularity
  1003.      when we link these together.  */
  1004.       decl = copy_node (decl);
  1005.     }
  1006.  
  1007.   if (decl == void_type_node
  1008.       || (TREE_CODE (decl) == FUNCTION_DECL
  1009.       && TREE_CODE (TREE_TYPE (decl)) != METHOD_TYPE))
  1010.     /* bunch of friends.  */
  1011.     return decl;
  1012.  
  1013.   if (DECL_IN_AGGR_P (decl))
  1014.     {
  1015.       error_with_decl (decl, "`%s' already defined in aggregate scope");
  1016.       return void_type_node;
  1017.     }
  1018.  
  1019.   finish_decl (decl, NULL_TREE, NULL_TREE);
  1020.  
  1021.   /* If this declaration is common to another declaration
  1022.      complain about such redundancy, and return NULL_TREE
  1023.      so that we don't build a circular list.  */
  1024.   if (TREE_CHAIN (decl))
  1025.     {
  1026.       error_with_decl (decl, "function `%s' declared twice in aggregate");
  1027.       return NULL_TREE;
  1028.     }
  1029.   DECL_IN_AGGR_P (decl) = 1;
  1030.   return decl;
  1031. }
  1032.  
  1033. /* The precedence rules of this grammar (or any other deterministic LALR
  1034.    grammar, for that matter), place the CALL_EXPR somewhere where we
  1035.    may not want it.  The solution is to grab the first CALL_EXPR we see,
  1036.    pretend that that is the one that belongs to the parameter list of
  1037.    the type conversion function, and leave everything else alone.
  1038.    We pull it out in place.
  1039.  
  1040.    CALL_REQUIRED is non-zero if we should complain if a CALL_EXPR
  1041.    does not appear in DECL.  */
  1042. tree
  1043. grokoptypename (decl, call_required)
  1044.      tree decl;
  1045.      int call_required;
  1046. {
  1047.   tree tmp, last;
  1048.  
  1049.   assert (TREE_CODE (decl) == TYPE_EXPR);
  1050.  
  1051.   tmp = TREE_OPERAND (decl, 0);
  1052.   last = NULL_TREE;
  1053.  
  1054.   while (tmp)
  1055.     {
  1056.       switch (TREE_CODE (tmp))
  1057.     {
  1058.     case CALL_EXPR:
  1059.       {
  1060.         tree parms = TREE_OPERAND (tmp, 1);
  1061.  
  1062.         if (last)
  1063.           TREE_OPERAND (last, 0) = TREE_OPERAND (tmp, 0);
  1064.         else
  1065.           TREE_OPERAND (decl, 0) = TREE_OPERAND (tmp, 0);
  1066.         if (parms
  1067.         && TREE_CODE (TREE_VALUE (parms)) == TREE_LIST)
  1068.           TREE_VALUE (parms)
  1069.         = grokdeclarator (TREE_VALUE (TREE_VALUE (parms)),
  1070.                   TREE_PURPOSE (TREE_VALUE (parms)),
  1071.                   TYPENAME, 0, NULL_TREE);
  1072.         if (parms)
  1073.           if (parms != void_list_node)
  1074.         {
  1075.           error ("operator <typename> requires empty parameter list");
  1076.           TREE_OPERAND (tmp, 1) = void_list_node;
  1077.         }
  1078.           else
  1079.         /* If user specifies `void' explicitly, avoid having
  1080.            two voids, since we put one invisible one on.  */
  1081.         TREE_CHAIN (parms) = NULL_TREE;
  1082.  
  1083.         last = grokdeclarator (TREE_OPERAND (decl, 0),
  1084.                    TREE_TYPE (decl),
  1085.                    TYPENAME, 0, NULL_TREE);
  1086.         TREE_OPERAND (tmp, 0) = build_typename_overload (last);
  1087.         TREE_TYPE (TREE_OPERAND (tmp, 0)) = last;
  1088.         return tmp;
  1089.       }
  1090.  
  1091.     case INDIRECT_REF:
  1092.     case ADDR_EXPR:
  1093.     case ARRAY_REF:
  1094.       break;
  1095.  
  1096.     case SCOPE_REF:
  1097.       /* This is legal when declaring a conversion to
  1098.          something of type pointer-to-member.  */
  1099.       if (TREE_CODE (TREE_OPERAND (tmp, 1)) == INDIRECT_REF)
  1100.         {
  1101.           tmp = TREE_OPERAND (tmp, 1);
  1102.         }
  1103.       else
  1104.         {
  1105. #if 0
  1106.           /* We may need to do this if grokdeclarator cannot handle this.  */
  1107.           error ("type `member of class %s' invalid return type",
  1108.              TYPE_NAME_STRING (TREE_OPERAND (tmp, 0)));
  1109.           TREE_OPERAND (tmp, 1) = build_parse_node (INDIRECT_REF, TREE_OPERAND (tmp, 1));
  1110. #endif
  1111.           tmp = TREE_OPERAND (tmp, 1);
  1112.         }
  1113.       break;
  1114.  
  1115.     default:
  1116.       assert (0);
  1117.     }
  1118.       last = tmp;
  1119.       tmp = TREE_OPERAND (tmp, 0);
  1120.     }
  1121.  
  1122.   if (call_required)
  1123.     error ("operator <typename> construct requires parameter list");
  1124.  
  1125.   last = grokdeclarator (TREE_OPERAND (decl, 0),
  1126.              TREE_TYPE (decl),
  1127.              TYPENAME, 0, NULL_TREE);
  1128.   tmp = build_parse_node (CALL_EXPR, build_typename_overload (last),
  1129.               void_list_node, NULL_TREE);
  1130.   TREE_TYPE (TREE_OPERAND (tmp, 0)) = last;
  1131.   return tmp;
  1132. }
  1133.  
  1134. /* Given an encoding for an operator name (see parse.y, the rules
  1135.    for making an `operator_name' in the variable DECLARATOR,
  1136.    return the name of the operator prefix as an IDENTIFIER_NODE.
  1137.  
  1138.    CTYPE is the class type to which this operator belongs.
  1139.    Needed in case it is a static member function.
  1140.  
  1141.    TYPE, if nonnull, is the function type for this declarator.
  1142.    This information helps to resolve potential ambiguities.
  1143.  
  1144.    If REPORT_AMBIGUOUS is non-zero, an error message
  1145.    is reported, and a default arity of the operator is
  1146.    returned.  Otherwise, return the operator under an OP_EXPR,
  1147.    for later evaluation when type information will enable
  1148.    proper instantiation.
  1149.  
  1150.    IS_DECL is 1 if this is a decl (as opposed to an expression).
  1151.    IS_DECL is 2 if this is a static function decl.
  1152.    Otherwise IS_DECL is 0.  */
  1153. tree
  1154. grokopexpr (declp, ctype, type, report_ambiguous, is_decl)
  1155.      tree *declp;
  1156.      tree ctype, type;
  1157.      int report_ambiguous;
  1158. {
  1159.   tree declarator = *declp;
  1160.   tree name, parmtypes;
  1161.   int seen_classtype_parm
  1162.     = (type != NULL_TREE && TREE_CODE (type) == METHOD_TYPE)
  1163.       || is_decl == 2;
  1164.  
  1165.   if (type != NULL_TREE)
  1166.     {
  1167.       if (ctype == 0 && TREE_CODE (TREE_OPERAND (declarator, 0)) == NEW_EXPR)
  1168.     {
  1169.       if (TYPE_ARG_TYPES (type)
  1170.           && TREE_CHAIN (TYPE_ARG_TYPES (type))
  1171.           && TREE_CHAIN (TYPE_ARG_TYPES (type)) != void_list_node)
  1172.         return get_identifier ("__user_new");
  1173.       return get_identifier ("__builtin_new");
  1174.     }
  1175.       else if (ctype == 0 && TREE_CODE (TREE_OPERAND (declarator, 0)) == DELETE_EXPR)
  1176.     return get_identifier ("__builtin_delete");
  1177.       else
  1178.     {
  1179.       /* Now we know the number of parameters,
  1180.          so build the real operator fnname.  */
  1181.       parmtypes = TYPE_ARG_TYPES (type);
  1182.       if (is_decl > 1 && TREE_CODE (type) == METHOD_TYPE)
  1183.         parmtypes = TREE_CHAIN (parmtypes);
  1184.       name = build_operator_fnname (declp, parmtypes, is_decl > 1);
  1185.       declarator = *declp;
  1186.     }
  1187.     }
  1188.   else
  1189.     {
  1190.       if (TREE_PURPOSE (declarator) == NULL_TREE)
  1191.     switch (TREE_CODE (TREE_VALUE (declarator)))
  1192.       {
  1193.       case PLUS_EXPR:
  1194.       case CONVERT_EXPR:
  1195.       case ADDR_EXPR:
  1196.       case BIT_AND_EXPR:
  1197.       case INDIRECT_REF:
  1198.       case MULT_EXPR:
  1199.       case NEGATE_EXPR:
  1200.       case MINUS_EXPR:
  1201.         if (report_ambiguous)
  1202.           {
  1203.         error ("operator '%s' ambiguous, (default binary)",
  1204.                opname_tab[(int)TREE_CODE (TREE_VALUE (declarator))]);
  1205.         name = build_operator_fnname (declp, NULL_TREE, 2);
  1206.         declarator = *declp;
  1207.           }
  1208.         else
  1209.           {
  1210.         /* do something intellegent.  */
  1211.         TREE_TYPE (declarator) = unknown_type_node;
  1212.         return declarator;
  1213.           }
  1214.         break;
  1215.       default:
  1216.         name = build_operator_fnname (declp, NULL_TREE, -1);
  1217.         declarator = *declp;
  1218.         break;
  1219.       }
  1220.       else if (TREE_CODE (TREE_PURPOSE (declarator)) == MODIFY_EXPR)
  1221.     {
  1222.       name = build_operator_fnname (declp, NULL_TREE, -1);
  1223.       declarator = *declp;
  1224.     }
  1225.       else abort ();
  1226.     }
  1227.   /* Now warn if the parameter list does not contain any args
  1228.      which are of aggregate type.  */
  1229.   if (is_decl && type != NULL_TREE && ! seen_classtype_parm)
  1230.     for (parmtypes = TYPE_ARG_TYPES (type);
  1231.      parmtypes;
  1232.      parmtypes = TREE_CHAIN (parmtypes))
  1233.       if (IS_AGGR_TYPE (TREE_VALUE (parmtypes))
  1234.       || (TREE_CODE (TREE_VALUE (parmtypes)) == REFERENCE_TYPE
  1235.           && IS_AGGR_TYPE (TREE_TYPE (TREE_VALUE (parmtypes)))))
  1236.     {
  1237.       seen_classtype_parm = 1;
  1238.       break;
  1239.     }
  1240.  
  1241.   if (is_decl && seen_classtype_parm == 0)
  1242.     if (TREE_CODE (declarator) == OP_IDENTIFIER
  1243.     && (TREE_CODE (TREE_OPERAND (declarator, 0)) == NEW_EXPR
  1244.         || TREE_CODE (TREE_OPERAND (declarator, 0)) == DELETE_EXPR))
  1245.       /* Global operators new and delete are not overloaded.  */
  1246.       TREE_OVERLOADED (name) = 0;
  1247.     else
  1248.       error ("operator has no %suser-defined argument type",
  1249.          type == NULL_TREE ? "(default) " : "");
  1250.  
  1251.   return name;
  1252. }
  1253.  
  1254. /* When a function is declared with an initialializer,
  1255.    do the right thing.  Currently, there are two possibilities:
  1256.  
  1257.    class B
  1258.    {
  1259.     public:
  1260.      // initialization possibility #1.
  1261.      virtual void f () = 0;
  1262.      int g ();
  1263.    };
  1264.    
  1265.    class D1 : B
  1266.    {
  1267.     public:
  1268.      int d1;
  1269.      // error, no f ();
  1270.    };
  1271.    
  1272.    class D2 : B
  1273.    {
  1274.     public:
  1275.      int d2;
  1276.      void f ();
  1277.    };
  1278.    
  1279.    class D3 : B
  1280.    {
  1281.     public:
  1282.      int d3;
  1283.      // initialization possibility #2
  1284.      void f () = B::f;
  1285.    };
  1286.  
  1287. */
  1288.  
  1289. static void
  1290. grok_function_init (decl, init)
  1291.      tree decl;
  1292.      tree init;
  1293. {
  1294.   /* An initializer for a function tells how this function should
  1295.      be inherited.  */
  1296.   tree type = TREE_TYPE (decl);
  1297.   extern tree abort_fndecl;
  1298.  
  1299.   if (TREE_CODE (type) == FUNCTION_TYPE)
  1300.     error_with_decl (decl, "initializer specified for non-member function `%s'");
  1301.   else if (! DECL_VIRTUAL_P (decl))
  1302.     error_with_decl (decl, "initializer specified for non-virtual method `%s'");
  1303.   else if (integer_zerop (init))
  1304.     {
  1305.       /* Mark this function as being "defined".  */
  1306.       DECL_INITIAL (decl) = error_mark_node;
  1307.       /* Give this node rtl from `abort'.  */
  1308.       DECL_RTL (decl) = DECL_RTL (abort_fndecl);
  1309.       DECL_ABSTRACT_VIRTUAL_P (decl) = 1;
  1310.     }
  1311.   else if (TREE_CODE (init) == OFFSET_REF
  1312.        && TREE_OPERAND (init, 0) == NULL_TREE
  1313.        && TREE_CODE (TREE_TYPE (init)) == METHOD_TYPE)
  1314.     {
  1315.       tree basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (init));
  1316.       tree basefn = TREE_OPERAND (init, 1);
  1317.       if (TREE_CODE (basefn) != FUNCTION_DECL)
  1318.     error_with_decl (decl, "non-method initializer invalid for method `%s'");
  1319.       else if (DECL_OFFSET (TYPE_NAME (basefn)) != 0)
  1320.     sorry ("base member function from other than first base class");
  1321.       else
  1322.     {
  1323.       basetype = get_base_type (basetype, TYPE_METHOD_BASETYPE (type), 1);
  1324.       if (basetype == error_mark_node)
  1325.         ;
  1326.       else if (basetype == 0)
  1327.         error_not_base_type (TYPE_METHOD_BASETYPE (TREE_TYPE (init)),
  1328.                  TYPE_METHOD_BASETYPE (type));
  1329.       else
  1330.         {
  1331.           /* Mark this function as being defined,
  1332.          and give it new rtl.  */
  1333.           DECL_INITIAL (decl) = error_mark_node;
  1334.           DECL_RTL (decl) = DECL_RTL (basefn);
  1335.         }
  1336.     }
  1337.     }
  1338.   else
  1339.     error_with_decl (decl, "invalid initializer for virtual method `%s'");
  1340. }
  1341.  
  1342. /* Cache the value of this class's main virtual function table pointer
  1343.    in a register variable.  This will save one indirection if a
  1344.    more than one virtual function call is made this function.  */
  1345. void
  1346. setup_vtbl_ptr ()
  1347. {
  1348.   if (! flag_this_is_variable
  1349.       && optimize
  1350.       && current_class_type
  1351.       && CLASSTYPE_VSIZE (current_class_type)
  1352.       && ! DECL_STATIC_FUNCTION_P (current_function_decl))
  1353.     {
  1354.       tree vfield = build_vfield_ref (C_C_D, current_class_type);
  1355.       current_vtable_decl = CLASSTYPE_VTBL_PTR (current_class_type);
  1356.       DECL_RTL (current_vtable_decl) = 0;
  1357.       DECL_INITIAL (current_vtable_decl) = error_mark_node;
  1358.       finish_decl (current_vtable_decl, vfield, 0);
  1359.       current_vtable_decl = build_indirect_ref (current_vtable_decl, 0);
  1360.     }
  1361.   else
  1362.     current_vtable_decl = NULL_TREE;
  1363. }
  1364.  
  1365. /* Record the existence of an addressable inline function.  */
  1366. void
  1367. mark_inline_for_output (decl)
  1368.      tree decl;
  1369. {
  1370.   pending_addressable_inlines = perm_tree_cons (NULL_TREE, decl,
  1371.                         pending_addressable_inlines);
  1372. }
  1373.  
  1374. void
  1375. clear_temp_name ()
  1376. {
  1377.   temp_name_counter = 0;
  1378. }
  1379.  
  1380. /* Hand off a unique name which can be used for variable we don't really
  1381.    want to know about anyway, for example, the anonymous variables which
  1382.    are needed to make references work.  Declare this thing so we can use it.
  1383.    The variable created will be of type TYPE.
  1384.  
  1385.    STATICP is nonzero if this variable should be static.  */
  1386.  
  1387. tree
  1388. get_temp_name (type, staticp)
  1389.      tree type;
  1390.      int staticp;
  1391. {
  1392.   char buf[sizeof (AUTO_TEMP_FORMAT) + 12];
  1393.   tree decl;
  1394.   int temp = 0;
  1395.   int toplev = global_bindings_p ();
  1396.   if (toplev || staticp)
  1397.     {
  1398.       temp = allocation_temporary_p ();
  1399.       if (temp)
  1400.     end_temporary_allocation ();
  1401.       sprintf (buf, AUTO_TEMP_FORMAT, global_temp_name_counter++);
  1402.       decl = pushdecl_top_level (build_decl (VAR_DECL, get_identifier (buf), type));
  1403.     }
  1404.   else
  1405.     {
  1406.       sprintf (buf, AUTO_TEMP_FORMAT, temp_name_counter++);
  1407.       decl = pushdecl (build_decl (VAR_DECL, get_identifier (buf), type));
  1408.     }
  1409.   TREE_USED (decl) = 1;
  1410.   TREE_STATIC (decl) = staticp;
  1411.  
  1412.   /* If this is a local variable, then lay out its rtl now.
  1413.      Otherwise, callers of this function are responsible for dealing
  1414.      with this variable's rtl.  */
  1415.   if (! toplev)
  1416.     {
  1417.       expand_decl (decl);
  1418.       expand_decl_init (decl);
  1419.     }
  1420.   else if (temp)
  1421.     resume_temporary_allocation ();
  1422.  
  1423.   return decl;
  1424. }
  1425.  
  1426. /* Get a variable which we can use for multiple assignments.
  1427.    It is not entered into current_binding_level, because
  1428.    that breaks things when it comes time to do final cleanups
  1429.    (which take place "outside" the binding contour of the function).
  1430.  
  1431.    Because it is not entered into the binding contour, `expand_end_bindings'
  1432.    does not see this variable automatically.  Users of this function
  1433.    must either pass this variable to expand_end_bindings or do
  1434.    themselves what expand_end_bindings was meant to do (like keeping
  1435.    the variable live if -noreg was specified).  */
  1436. tree
  1437. get_temp_regvar (type, init)
  1438.      tree type, init;
  1439. {
  1440.   static char buf[sizeof (AUTO_TEMP_FORMAT) + 8] = { '_' };
  1441.   tree decl;
  1442.  
  1443.   sprintf (buf+1, AUTO_TEMP_FORMAT, temp_name_counter++);
  1444.   decl = pushdecl (build_decl (VAR_DECL, get_identifier (buf), type));
  1445.   TREE_USED (decl) = 1;
  1446.   TREE_REGDECL (decl) = 1;
  1447.  
  1448.   if (init)
  1449.     store_init_value (decl, init);
  1450.  
  1451.   /* We can expand these without fear, since they cannot need
  1452.      constructors or destructors.  */
  1453.   expand_decl (decl);
  1454.   expand_decl_init (decl);
  1455.   return decl;
  1456. }
  1457.  
  1458. /* Make the macro TEMP_NAME_P available to units which do not
  1459.    include c-tree.h.  */
  1460. int
  1461. temp_name_p (decl)
  1462.      tree decl;
  1463. {
  1464.   return TEMP_NAME_P (decl);
  1465. }
  1466.  
  1467. /* Finish off the processing of a UNION_TYPE structure.
  1468.    If there are static members, then all members are
  1469.    static, and must be laid out together.  If the
  1470.    union is an anonymous union, we arrage for that
  1471.    as well.  PUBLICP is nonzero if this union is
  1472.    not declared static.  */
  1473. void
  1474. finish_anon_union (anon_union_decl)
  1475.      tree anon_union_decl;
  1476. {
  1477.   tree type = TREE_TYPE (anon_union_decl);
  1478.   tree field, decl;
  1479.   tree elems = NULL_TREE;
  1480.   int public_p = TREE_PUBLIC (anon_union_decl);
  1481.   int static_p = TREE_STATIC (anon_union_decl);
  1482.   int external_p = TREE_EXTERNAL (anon_union_decl);
  1483.  
  1484.   if ((field = TYPE_FIELDS (type)) == NULL_TREE)
  1485.     return;
  1486.  
  1487.   if (public_p && (static_p || external_p))
  1488.     error ("optimizer cannot handle global anonymous unions");
  1489.  
  1490.   while (field)
  1491.     {
  1492.       decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
  1493.       /* tell `pushdecl' that this is not tentative.  */
  1494.       DECL_INITIAL (decl) = error_mark_node;
  1495.       TREE_PUBLIC (decl) = public_p;
  1496.       TREE_STATIC (decl) = static_p;
  1497.       TREE_EXTERNAL (decl) = external_p;
  1498.       decl = pushdecl (decl);
  1499.       DECL_INITIAL (decl) = NULL_TREE;
  1500.       elems = tree_cons (DECL_ASSEMBLER_NAME (field), decl, elems);
  1501.       TREE_TYPE (elems) = type;
  1502.       field = TREE_CHAIN (field);
  1503.     }
  1504.   if (static_p)
  1505.     make_decl_rtl (decl, 0, global_bindings_p ());
  1506.   expand_anon_union_decl (decl, NULL_TREE, elems);
  1507. }
  1508.  
  1509. /* Finish and output a table which is generated by the compiler.
  1510.    NAME is the name to give the table.
  1511.    TYPE is the type of the table entry.
  1512.    INIT is all the elements in the table.
  1513.    PUBLICP is non-zero if this table should be given external visibility.  */
  1514. tree
  1515. finish_table (name, type, init, publicp)
  1516.      tree name, type, init;
  1517. {
  1518.   tree itype, atype, decl;
  1519.  
  1520.   itype = build_index_type (build_int_2 (list_length (init), 0));
  1521.   atype = build_cplus_array_type (type, itype);
  1522.   layout_type (atype);
  1523.   decl = build_decl (VAR_DECL, name, atype);
  1524.   decl = pushdecl (decl);
  1525.   TREE_STATIC (decl) = 1;
  1526.   TREE_PUBLIC (decl) = publicp;
  1527.   init = build (CONSTRUCTOR, atype, NULL_TREE, init);
  1528.   TREE_LITERAL (init) = 1;
  1529.   TREE_STATIC (init) = 1;
  1530.   DECL_INITIAL (decl) = init;
  1531.   finish_decl (decl, init,
  1532.            build_string (IDENTIFIER_LENGTH (DECL_NAME (decl)),
  1533.                  IDENTIFIER_POINTER (DECL_NAME (decl))));
  1534.   return decl;
  1535. }
  1536.  
  1537. /* Auxilliary functions to make type signatures for
  1538.    `operator new' and `operator delete' correspond to
  1539.    what compiler will be expecting.  */
  1540.  
  1541. extern tree sizetype;
  1542.  
  1543. tree
  1544. coerce_new_type (ctype, type)
  1545.      tree ctype;
  1546.      tree type;
  1547. {
  1548.   int e1 = 0, e2 = 0;
  1549.  
  1550.   if (TREE_CODE (type) == METHOD_TYPE)
  1551.     type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
  1552.   if (TREE_TYPE (type) != ptr_type_node)
  1553.     e1 = 1, error ("`operator new' must return type `void *'");
  1554.  
  1555.   /* Technically the type must be `size_t', but we may not know
  1556.      what that is.  */
  1557.   if (TYPE_ARG_TYPES (type) == NULL_TREE)
  1558.     e1 = 1, error ("`operator new' takes type `size_t' parameter");
  1559.   else if (TREE_CODE (TREE_VALUE (TYPE_ARG_TYPES (type))) != INTEGER_TYPE
  1560.        || TYPE_PRECISION (TREE_VALUE (TYPE_ARG_TYPES (type))) != TYPE_PRECISION (sizetype))
  1561.     e2 = 1, error ("`operator new' takes type `size_t' as first parameter");
  1562.   if (e2)
  1563.     type = build_function_type (ptr_type_node, tree_cons (NULL_TREE, sizetype, TREE_CHAIN (TYPE_ARG_TYPES (type))));
  1564.   else if (e1)
  1565.     type = build_function_type (ptr_type_node, TYPE_ARG_TYPES (type));
  1566.   return type;
  1567. }
  1568.  
  1569. tree
  1570. coerce_delete_type (ctype, type)
  1571.      tree ctype;
  1572.      tree type;
  1573. {
  1574.   int e1 = 0, e2 = 0, e3 = 0;
  1575.  
  1576.   if (TREE_CODE (type) == METHOD_TYPE)
  1577.     type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
  1578.   if (TREE_TYPE (type) != void_type_node)
  1579.     e1 = 1, error ("`operator delete' must return type `void'");
  1580.   if (TYPE_ARG_TYPES (type) == NULL_TREE
  1581.       || TREE_VALUE (TYPE_ARG_TYPES (type)) != ptr_type_node)
  1582.     e2 = 1, error ("`operator delete' takes type `void *' as first parameter");
  1583.  
  1584.   if (TYPE_ARG_TYPES (type)
  1585.       && TREE_CHAIN (TYPE_ARG_TYPES (type))
  1586.       && TREE_CHAIN (TYPE_ARG_TYPES (type)) != void_list_node)
  1587.     {
  1588.       /* Again, technically this argument must be `size_t', but again
  1589.      we may not know what that is.  */
  1590.       tree t2 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (type)));
  1591.       if (TREE_CODE (t2) != INTEGER_TYPE
  1592.       || TYPE_PRECISION (t2) != TYPE_PRECISION (sizetype))
  1593.     e3 = 1, error ("second argument to `operator delete' must be of type `size_t'");
  1594.       else if (TREE_CHAIN (TREE_CHAIN (TYPE_ARG_TYPES (type))) != void_list_node)
  1595.     {
  1596.       e3 = 1;
  1597.       if (TREE_CHAIN (TREE_CHAIN (TYPE_ARG_TYPES (type))))
  1598.         error ("too many arguments in declaration of `operator delete'");
  1599.       else
  1600.         error ("`...' invalid in specification of `operator delete'");
  1601.     }
  1602.     }
  1603.   if (e3)
  1604.     type = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node, build_tree_list (NULL_TREE, sizetype)));
  1605.   else if (e2)
  1606.     type = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node, TREE_CHAIN (TYPE_ARG_TYPES (type))));
  1607.   else if (e1)
  1608.     type = build_function_type (void_type_node, TYPE_ARG_TYPES (type));
  1609.   return type;
  1610. }
  1611.  
  1612. extern int parse_time, varconst_time;
  1613.  
  1614. #define TIMEVAR(VAR, BODY)    \
  1615. do { int otime = gettime (); BODY; VAR += gettime () - otime; } while (0)
  1616.  
  1617. /* This routine is called from the last rule in yyparse ().
  1618.    Its job is to create all the code needed to initialize and
  1619.    destroy the global aggregates.  We do the destruction
  1620.    first, since that way we only need to reverse the decls once.  */
  1621.  
  1622. void
  1623. finish_file ()
  1624. {
  1625.   extern struct rtx_def *const0_rtx;
  1626.   extern int lineno;
  1627.   extern struct _iob *asm_out_file;
  1628.   int start_time, this_time;
  1629.   char *init_function_name;
  1630.  
  1631.   char *buf;
  1632.   char *p;
  1633.   tree fnname;
  1634.   tree vars = static_aggregates;
  1635.   int needs_cleaning = 0, needs_messing_up = 0;
  1636.  
  1637.   if (main_input_filename == 0)
  1638.     main_input_filename = input_filename;
  1639.   if (!first_global_object_name)
  1640.     first_global_object_name = main_input_filename;
  1641.  
  1642.   buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT)
  1643.              + strlen (first_global_object_name));
  1644.  
  1645. #ifndef MERGED
  1646.   if (flag_detailed_statistics)
  1647.     dump_tree_statistics ();
  1648. #endif
  1649.  
  1650.   /* Bad parse errors.  Just forget about it.  */
  1651.   if (! global_bindings_p ())
  1652.     return;
  1653.  
  1654. #ifndef MERGED
  1655.   /* This is the first run of an unexec'd program, so save this till 
  1656.      we come back again. -- bryan@kewill.uucp */
  1657.   {
  1658.     extern int just_done_unexec;
  1659.     if (just_done_unexec)
  1660.       return;
  1661.   }
  1662. #endif
  1663.  
  1664.   start_time = gettime ();
  1665.  
  1666.   /* Push into C language context, because that's all
  1667.      we'll need here.  */
  1668.   push_lang_context (lang_name_c);
  1669.  
  1670.   /* Set up the name of the file-level functions we may need.  */
  1671.   /* Use a global object (which is already required to be unique over
  1672.      the program) rather than the file name (which imposes extra
  1673.      constraints).  -- Raeburn@MIT.EDU, 10 Jan 1990.  */
  1674.   sprintf (buf, FILE_FUNCTION_FORMAT, first_global_object_name);
  1675.  
  1676.   /* Don't need to pull wierd characters out of global names.  */
  1677.   if (first_global_object_name == main_input_filename)
  1678.     {
  1679.       for (p = buf+11; *p; p++)
  1680.     if (! ((*p >= '0' && *p <= '9')
  1681. #ifndef ASM_IDENTIFY_GCC    /* this is required if `.' is invalid -- k. raeburn */
  1682.            || *p == '.'
  1683. #endif
  1684. #ifndef NO_DOLLAR_IN_LABEL    /* this for `$'; unlikely, but... -- kr */
  1685.            || *p == '$'
  1686. #endif
  1687.            || (*p >= 'A' && *p <= 'Z')
  1688.            || (*p >= 'a' && *p <= 'z')))
  1689.       *p = '_';
  1690.     }
  1691.  
  1692.   /* See if we really need the hassle.  */
  1693.   while (vars && needs_cleaning == 0)
  1694.     {
  1695.       tree decl = TREE_VALUE (vars);
  1696.       tree type = TREE_TYPE (decl);
  1697.       if (TYPE_NEEDS_DESTRUCTOR (type))
  1698.     {
  1699.       needs_cleaning = 1;
  1700.       needs_messing_up = 1;
  1701.       break;
  1702.     }
  1703.       else
  1704.     needs_messing_up |= TYPE_NEEDS_CONSTRUCTING (type);
  1705.       vars = TREE_CHAIN (vars);
  1706.     }
  1707.   if (needs_cleaning == 0)
  1708.     goto mess_up;
  1709.  
  1710.   /* Otherwise, GDB can get confused, because in only knows
  1711.      about source for LINENO-1 lines.  */
  1712.   lineno -= 1;
  1713.  
  1714. #if defined(sun)
  1715.   /* Point Sun linker at this function.  */
  1716.   fprintf (asm_out_file, ".stabs \"_fini\",10,0,0,0\n.stabs \"");
  1717.   assemble_name (asm_out_file, buf);
  1718.   fprintf (asm_out_file, "\",4,0,0,0\n");
  1719. #endif
  1720.  
  1721.   fnname = get_identifier (buf);
  1722.   start_function (void_list_node, build_parse_node (CALL_EXPR, fnname, void_list_node, NULL_TREE), 0, 0);
  1723.   DECL_PRINT_NAME (current_function_decl) = "file cleanup";
  1724.   fnname = DECL_NAME (current_function_decl);
  1725.   store_parm_decls ();
  1726.  
  1727.   pushlevel (0);
  1728.   clear_last_expr ();
  1729.   push_momentary ();
  1730.   expand_start_bindings (0);
  1731.  
  1732.   /* These must be done in backward order to destroy,
  1733.      in which they happen to be!  */
  1734.   while (vars)
  1735.     {
  1736.       tree decl = TREE_VALUE (vars);
  1737.       tree type = TREE_TYPE (decl);
  1738.       tree temp = TREE_PURPOSE (vars);
  1739.  
  1740.       if (TYPE_NEEDS_DESTRUCTOR (type))
  1741.     {
  1742.       if (TREE_STATIC (vars))
  1743.         expand_start_cond (build_binary_op (NE_EXPR, temp, integer_zero_node), 0);
  1744.       if (TREE_CODE (type) == ARRAY_TYPE)
  1745.         temp = decl;
  1746.       else
  1747.         {
  1748.           mark_addressable (decl);
  1749.           temp = build (ADDR_EXPR, TYPE_POINTER_TO (type), decl);
  1750.         }
  1751.       temp = build_delete (TREE_TYPE (temp), temp,
  1752.                    integer_zero_node, LOOKUP_NORMAL, 0);
  1753.       expand_expr_stmt (temp);
  1754.  
  1755.       if (TYPE_LANG_SPECIFIC (type)
  1756.           && TYPE_USES_VIRTUAL_BASECLASSES (type))
  1757.         expand_expr_stmt (build_vbase_delete (type, decl));
  1758.  
  1759.       if (TREE_STATIC (vars))
  1760.         expand_end_cond ();
  1761.     }
  1762.       vars = TREE_CHAIN (vars);
  1763.     }
  1764.  
  1765.   expand_end_bindings (getdecls (), 1, 0);
  1766.   poplevel (1, 0, 1);
  1767.   pop_momentary ();
  1768.  
  1769.   finish_function (lineno, 0);
  1770.  
  1771. #if defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER)
  1772.   /* Now tell GNU LD that this is part of the static destructor set.  */
  1773.   {
  1774.     extern struct _iob *asm_out_file;
  1775.     fprintf (asm_out_file, ".stabs \"___DTOR_LIST__\",22,0,0,");
  1776.     assemble_name (asm_out_file, IDENTIFIER_POINTER (fnname));
  1777.     fputc ('\n', asm_out_file);
  1778.   }
  1779. #endif
  1780.  
  1781.   /* if it needed cleaning, then it will need messing up: drop through  */
  1782.  
  1783.  mess_up:
  1784.   /* Must do this while we think we are at the top level.  */
  1785.   vars = nreverse (static_aggregates);
  1786.   if (vars != NULL_TREE)
  1787.     {
  1788.       buf[FILE_FUNCTION_PREFIX_LEN] = 'I';
  1789.  
  1790. #if defined(sun)
  1791.       /* Point Sun linker at this function.  */
  1792.       fprintf (asm_out_file, ".stabs \"_init\",10,0,0,0\n.stabs \"");
  1793.       assemble_name (asm_out_file, buf);
  1794.       fprintf (asm_out_file, "\",4,0,0,0\n");
  1795. #endif
  1796.  
  1797.       fnname = get_identifier (buf);
  1798.       start_function (void_list_node, build_parse_node (CALL_EXPR, fnname, void_list_node, NULL_TREE), 0, 0);
  1799.       DECL_PRINT_NAME (current_function_decl) = "file initialization";
  1800.       fnname = DECL_NAME (current_function_decl);
  1801.       store_parm_decls ();
  1802.  
  1803.       pushlevel (0);
  1804.       clear_last_expr ();
  1805.       push_momentary ();
  1806.       expand_start_bindings (0);
  1807.  
  1808. #ifdef SOS
  1809.       if (flag_all_virtual == 2)
  1810.     {
  1811.       tree decl;
  1812.       char c = buf[FILE_FUNCTION_PREFIX_LEN];
  1813.       buf[FILE_FUNCTION_PREFIX_LEN] = 'Z';
  1814.  
  1815.       decl = pushdecl (build_lang_decl (FUNCTION_DECL, get_identifier (buf), default_function_type));
  1816.       finish_decl (decl, NULL_TREE, NULL_TREE);
  1817.       expand_expr_stmt (build_function_call (decl, NULL_TREE));
  1818.       buf[FILE_FUNCTION_PREFIX_LEN] = c;
  1819.     }
  1820. #endif
  1821.  
  1822.       while (vars)
  1823.     {
  1824.       tree decl = TREE_VALUE (vars);
  1825.       tree init = TREE_PURPOSE (vars);
  1826.  
  1827.       /* If this was a static attribute within some function's scope,
  1828.          then don't initialize it here.  Also, don't bother
  1829.          with initializers that contain errors.  */
  1830.       if (TREE_STATIC (vars)
  1831.           || (init && TREE_CODE (init) == TREE_LIST
  1832.           && value_member (error_mark_node, init)))
  1833.         {
  1834.           vars = TREE_CHAIN (vars);
  1835.           continue;
  1836.         }
  1837.  
  1838.       if (TREE_CODE (decl) == VAR_DECL)
  1839.         {
  1840.           /* Set these global variables so that GDB at least puts
  1841.          us near the declaration which required the initialization.  */
  1842.           input_filename = DECL_SOURCE_FILE (decl);
  1843.           lineno = DECL_SOURCE_LINE (decl);
  1844.           emit_note (input_filename, lineno);
  1845.  
  1846.           if (init)
  1847.         {
  1848.           if (TREE_CODE (init) == VAR_DECL)
  1849.             {
  1850.               /* This behavior results when there are
  1851.              multiple declarations of an aggregate,
  1852.              the last of which defines it.  */
  1853.               if (DECL_RTL (init) == DECL_RTL (decl))
  1854.             {
  1855.               assert (DECL_INITIAL (decl) == error_mark_node
  1856.                   || (TREE_CODE (DECL_INITIAL (decl)) == CONSTRUCTOR
  1857.                       && CONSTRUCTOR_ELTS (DECL_INITIAL (decl)) == NULL_TREE));
  1858.               init = DECL_INITIAL (init);
  1859.               if (TREE_CODE (init) == CONSTRUCTOR
  1860.                   && CONSTRUCTOR_ELTS (init) == NULL_TREE)
  1861.                 init = NULL_TREE;
  1862.             }
  1863. #if 0
  1864.               else if (TREE_TYPE (decl) == TREE_TYPE (init))
  1865.             {
  1866. #if 1
  1867.               assert (0);
  1868. #else
  1869.               /* point to real decl's rtl anyway.  */
  1870.               DECL_RTL (init) = DECL_RTL (decl);
  1871.               assert (DECL_INITIAL (decl) == error_mark_node);
  1872.               init = DECL_INITIAL (init);
  1873. #endif                /* 1 */
  1874.             }
  1875. #endif                /* 0 */
  1876.             }
  1877.         }
  1878.           if (IS_AGGR_TYPE (TREE_TYPE (decl))
  1879.           || init == 0
  1880.           || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
  1881.         expand_aggr_init (decl, init, 0);
  1882.           else if (TREE_CODE (init) == TREE_VEC)
  1883.         expand_expr (expand_vec_init (decl, TREE_VEC_ELT (init, 0),
  1884.                           TREE_VEC_ELT (init, 1),
  1885.                           TREE_VEC_ELT (init, 2), 0),
  1886.                  const0_rtx, VOIDmode, 0);
  1887.           else
  1888.         expand_assignment (decl, init, 0, 0);
  1889.         }
  1890.       else if (TREE_CODE (decl) == SAVE_EXPR)
  1891.         {
  1892.           if (! PARM_DECL_EXPR (decl))
  1893.         {
  1894.           /* a `new' expression at top level.  */
  1895.           expand_expr (decl, const0_rtx, VOIDmode, 0);
  1896.           expand_aggr_init (build_indirect_ref (decl, 0), init, 0);
  1897.         }
  1898.         }
  1899.       else if (decl == error_mark_node)
  1900.         ;
  1901.       else abort ();
  1902.       vars = TREE_CHAIN (vars);
  1903.     }
  1904.  
  1905.       expand_end_bindings (getdecls (), 1, 0);
  1906.       poplevel (1, 0, 1);
  1907.       pop_momentary ();
  1908.  
  1909.       finish_function (lineno, 0);
  1910. #if defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER)
  1911.       /* Now tell GNU LD that this is part of the static constructor set.  */
  1912.       {
  1913.     extern struct _iob *asm_out_file;
  1914.     fprintf (asm_out_file, ".stabs \"___CTOR_LIST__\",22,0,0,");
  1915.     assemble_name (asm_out_file, IDENTIFIER_POINTER (fnname));
  1916.     fputc ('\n', asm_out_file);
  1917.       }
  1918. #endif
  1919.     }
  1920.  
  1921. #ifdef SOS
  1922.   if (flag_all_virtual == 2)
  1923.     {
  1924.       tree __sosDynError = default_conversion (lookup_name (get_identifier ("sosDynError")));
  1925.  
  1926.       tree null_string = build1 (ADDR_EXPR, string_type_node, combine_strings (build_string (0, "")));
  1927.       tree tags = gettags ();
  1928.       tree decls = getdecls ();
  1929.       tree entry;
  1930.       int i;
  1931.  
  1932.       entry = NULL_TREE;
  1933.       for (i = 0; i < 3; i++)
  1934.     entry = tree_cons (NULL_TREE, integer_zero_node, entry);
  1935.       zlink = build_tree_list (NULL_TREE, build (CONSTRUCTOR, zlink_type, NULL_TREE, entry));
  1936.       TREE_LITERAL (TREE_VALUE (zlink)) = 1;
  1937.       TREE_STATIC (TREE_VALUE (zlink)) = 1;
  1938.  
  1939.       entry = NULL_TREE;
  1940.       for (i = 0; i < 5; i++)
  1941.     entry = tree_cons (NULL_TREE, integer_zero_node, entry);
  1942.       zret = build_tree_list (NULL_TREE, build (CONSTRUCTOR, zret_type, NULL_TREE, entry));
  1943.       TREE_LITERAL (TREE_VALUE (zret)) = 1;
  1944.       TREE_STATIC (TREE_VALUE (zret)) = 1;
  1945.  
  1946.       /* Symbols with external visibility (except globally visible
  1947.      dynamic member functions) into the `zlink' table.  */
  1948.       while (decls)
  1949.     {
  1950.       if (TREE_PUBLIC (decls)
  1951.           && TREE_ASM_WRITTEN (decls)
  1952.           && (TREE_CODE (decls) != FUNCTION_DECL
  1953.           || TREE_CODE (TREE_TYPE (decls)) != METHOD_TYPE
  1954.           || TYPE_DYNAMIC (TYPE_METHOD_BASETYPE (TREE_TYPE (decls))) == 0))
  1955.         {
  1956.           entry = build (CONSTRUCTOR, zlink_type, NULL_TREE,
  1957.                  tree_cons (NULL_TREE,
  1958.                     build1 (ADDR_EXPR, string_type_node,
  1959.                         combine_strings (build_string (IDENTIFIER_LENGTH (DECL_NAME (decls)),
  1960.                                            IDENTIFIER_POINTER (DECL_NAME (decls))))),
  1961.                     tree_cons (NULL_TREE, integer_one_node,
  1962.                            build_tree_list (NULL_TREE, build_unary_op (ADDR_EXPR, decls, 0)))));
  1963.           TREE_LITERAL (entry) = 1;
  1964.           TREE_STATIC (entry) = 1;
  1965.           zlink = tree_cons (NULL_TREE, entry, zlink);
  1966.         }
  1967.       decls = TREE_CHAIN (decls);
  1968.     }
  1969.  
  1970.       buf[FILE_FUNCTION_PREFIX_LEN] = 'Z';
  1971.   
  1972.       fnname = get_identifier (buf);
  1973.       start_function (void_list_node, build_parse_node (CALL_EXPR, fnname, void_list_node, NULL_TREE), 0, 0);
  1974.       fnname = DECL_NAME (current_function_decl);
  1975.       store_parm_decls ();
  1976.  
  1977.       pushlevel (0);
  1978.       clear_last_expr ();
  1979.       push_momentary ();
  1980.       expand_start_bindings (0);
  1981.  
  1982.       {
  1983.     tree decl, type;
  1984.     /* Lay out a table static to this function
  1985.        with information about all text and data that
  1986.        this file provides.  */
  1987.     tree zlink_table = finish_table (get_identifier ("__ZLINK_tbl"), zlink_type, zlink, 0);
  1988.     decl = pushdecl (build_decl (VAR_DECL, get_identifier ("_ZLINK_once"), integer_type_node));
  1989.     TREE_STATIC (decl) = 1;
  1990.     finish_decl (decl, NULL_TREE, NULL_TREE);
  1991.     expand_start_cond (truthvalue_conversion (decl), 0);
  1992.     expand_null_return ();
  1993.     expand_end_cond ();
  1994.     finish_stmt ();
  1995.     expand_expr_stmt (build_modify_expr (decl, NOP_EXPR, integer_one_node));
  1996.     type = build_function_type (void_type_node, NULL_TREE);
  1997.     decl = pushdecl (build_lang_decl (FUNCTION_DECL, get_identifier ("_Ztable_from_cfront"), type));
  1998.     TREE_EXTERNAL (decl) = 1;
  1999.     finish_decl (decl, NULL_TREE, NULL_TREE);
  2000.     expand_expr_stmt (build_function_call (decl, build_tree_list (NULL_TREE, zlink_table)));
  2001.     expand_null_return ();
  2002.       }
  2003.       expand_end_bindings (0, 1, 0);
  2004.       poplevel (1, 0, 1);
  2005.       pop_momentary ();
  2006.       finish_function (lineno, 0);
  2007.  
  2008.       buf[FILE_FUNCTION_PREFIX_LEN] = 'Y';
  2009.       fnname = get_identifier (buf);
  2010.       start_function (build_tree_list (NULL_TREE, get_identifier ("int")),
  2011.               build_parse_node (INDIRECT_REF, build_parse_node (CALL_EXPR, fnname, void_list_node, NULL_TREE)), 0, 0);
  2012.       fnname = DECL_NAME (current_function_decl);
  2013.       store_parm_decls ();
  2014.  
  2015.       pushlevel (0);
  2016.       clear_last_expr ();
  2017.       push_momentary ();
  2018.       expand_start_bindings (0);
  2019.  
  2020.       {
  2021. #define SOS_VERSION 2
  2022.     tree sosVersionNumber = build_int_2 (SOS_VERSION, 0);
  2023.     tree zret_table;
  2024.  
  2025.     /* For each type defined, if is a dynamic type, write out
  2026.        an entry linking its member functions with their names.  */
  2027.  
  2028.     while (tags)
  2029.       {
  2030.         tree type = TREE_VALUE (tags);
  2031.         if (TYPE_DYNAMIC (type))
  2032.           {
  2033.         /* SOS currently only implements single inheritance,
  2034.            so we just pick up one string, if this class
  2035.            has a base class.  */
  2036.         tree base_name = CLASSTYPE_N_BASECLASSES (type) > 0 && TYPE_DYNAMIC (CLASSTYPE_BASECLASS (type, 1))
  2037.           ? build1 (ADDR_EXPR, string_type_node, CLASSTYPE_TYPENAME_AS_STRING (CLASSTYPE_BASECLASS (type, 1)))
  2038.             : null_string;
  2039.         tree dyn_table, dyn_entry = NULL_TREE, fns = CLASS_ASSOC_VIRTUALS (type);
  2040.         while (fns)
  2041.           {
  2042.             if (TREE_ASM_WRITTEN (TREE_OPERAND (TREE_VALUE (fns), 0)))
  2043.               dyn_entry = tree_cons (NULL_TREE, TREE_VALUE (fns), dyn_entry);
  2044.             else
  2045.               dyn_entry = tree_cons (NULL_TREE, __sosDynError, dyn_entry);
  2046.             fns = TREE_CHAIN (fns);
  2047.           }
  2048.         dyn_entry = nreverse (dyn_entry);
  2049.         dyn_entry = tree_cons (NULL_TREE, build1 (NOP_EXPR, TYPE_POINTER_TO (default_function_type), sosVersionNumber),
  2050.                        tree_cons (NULL_TREE, integer_zero_node,
  2051.                           tree_cons (NULL_TREE, integer_zero_node,
  2052.                                  dyn_entry)));
  2053.         dyn_table = finish_table (DECL_NAME (TYPE_NAME (type)), TYPE_POINTER_TO (default_function_type), dyn_entry, 0);
  2054.         entry = build (CONSTRUCTOR, zret_type, NULL_TREE,
  2055.                    tree_cons (NULL_TREE, build1 (ADDR_EXPR, string_type_node, CLASSTYPE_TYPENAME_AS_STRING (type)),
  2056.                       tree_cons (NULL_TREE, default_conversion (dyn_table),
  2057.                              tree_cons (NULL_TREE, build_int_2 (CLASSTYPE_VSIZE (type), 0),
  2058.                                 tree_cons (NULL_TREE, base_name,
  2059.                                        build_tree_list (NULL_TREE, integer_zero_node))))));
  2060.         TREE_LITERAL (entry) = 1;
  2061.         TREE_STATIC (entry) = 1;
  2062.         zret = tree_cons (NULL_TREE, entry, zret);
  2063.           }
  2064.         tags = TREE_CHAIN (tags);
  2065.       }
  2066.     zret_table = finish_table (get_identifier ("__Zret"), zret_type, zret, 0);
  2067.     c_expand_return (convert (build_pointer_type (integer_type_node), default_conversion (zret_table)));
  2068.       }
  2069.       expand_end_bindings (0, 1, 0);
  2070.       poplevel (1, 0, 1);
  2071.       pop_momentary ();
  2072.       finish_function (lineno, 0);
  2073.  
  2074. #if defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER)
  2075.       {
  2076.     extern struct _iob *asm_out_file;
  2077.     fprintf (asm_out_file, ".stabs \"___ZTOR_LIST__\",22,0,0,");
  2078.     assemble_name (asm_out_file, IDENTIFIER_POINTER (fnname));
  2079.     fputc ('\n', asm_out_file);
  2080.       }
  2081. #endif
  2082.     }
  2083. #endif
  2084.  
  2085.   /* Done with C language context needs.  */
  2086.   pop_lang_context ();
  2087.  
  2088.   /* Now write out any static class variables (which may have since
  2089.      learned how to be initialized).  */
  2090.   while (pending_statics)
  2091.     {
  2092.       tree decl = TREE_VALUE (pending_statics);
  2093.       if (TREE_USED (decl) == 1
  2094.       || TREE_READONLY (decl) == 0
  2095.       || DECL_INITIAL (decl) == 0)
  2096.     rest_of_decl_compilation (decl, DECL_ASSEMBLER_NAME (decl), 1, 1);
  2097.       pending_statics = TREE_CHAIN (pending_statics);
  2098.     }
  2099.  
  2100.   this_time = gettime ();
  2101.   parse_time -= this_time - start_time;
  2102.   varconst_time += this_time - start_time;
  2103.  
  2104.   /* Now write out inline functions which had their addresses taken
  2105.      and which were not declared virtual and which were not declared
  2106.      `extern inline'.  */
  2107.   while (pending_addressable_inlines)
  2108.     {
  2109.       tree decl = TREE_VALUE (pending_addressable_inlines);
  2110.       if (! TREE_ASM_WRITTEN (decl)
  2111.       && ! TREE_EXTERNAL (decl)
  2112.       && DECL_SAVED_INSNS (decl))
  2113.     output_inline_function (decl);
  2114.       pending_addressable_inlines = TREE_CHAIN (pending_addressable_inlines);
  2115.     }
  2116.  
  2117.   start_time = gettime ();
  2118.  
  2119.   /* Now delete from the chain of variables all virtual function tables.
  2120.      We output them all ourselves, because each will be treated specially.  */
  2121.   {
  2122.     tree prev;
  2123.     /* Make last thing in global scope not be a virtual function table.  */
  2124.     prev = build_decl (VAR_DECL, get_identifier (" @%$#@!"), integer_type_node);
  2125.     TREE_EXTERNAL (prev) = 1;
  2126.     pushdecl (prev);
  2127.     /* Make this dummy variable look used.  */
  2128.     TREE_ASM_WRITTEN (prev) = 1;
  2129.     DECL_INITIAL (prev) = error_mark_node;
  2130.  
  2131.     for (prev = 0, vars = getdecls ();
  2132.      vars;
  2133.      vars = TREE_CHAIN (vars))
  2134.       {
  2135.     if (TREE_CODE (vars) == TYPE_DECL
  2136.         && TYPE_LANG_SPECIFIC (TREE_TYPE (vars))
  2137.         && CLASSTYPE_VSIZE (TREE_TYPE (vars)))
  2138.       {
  2139.         tree decl = CLASS_ASSOC_VTABLE (TREE_TYPE (vars));
  2140.  
  2141.         /* If we are controlled by `+e2', obey.  */
  2142.         if (write_virtuals == 2)
  2143.           {
  2144.         tree assoc = value_member (DECL_NAME (vars), pending_vtables);
  2145.         if (assoc)
  2146.           TREE_PURPOSE (assoc) = void_type_node;
  2147.         else
  2148.           decl = NULL_TREE;
  2149.           }
  2150.         /* If this type has inline virtual functions, then
  2151.            write those functions out now.  */
  2152.         if (decl && ! TREE_EXTERNAL (decl) && TREE_USED (decl))
  2153.           {
  2154.         tree entries;
  2155.  
  2156.         for (entries = TREE_CHAIN (CONSTRUCTOR_ELTS (DECL_INITIAL (decl)));
  2157.              entries; entries = TREE_CHAIN (entries))
  2158.           {
  2159.             tree fnaddr = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries));
  2160.             tree fn = TREE_OPERAND (fnaddr, 0);
  2161.             if (! TREE_ASM_WRITTEN (fn)
  2162.             && DECL_PENDING_INLINE_INFO (fn)
  2163.             && TREE_ADDRESSABLE (fn))
  2164.               output_inline_function (fn);
  2165.           }
  2166.           }
  2167.       }
  2168.     if (TREE_CODE (vars) == VAR_DECL && DECL_VIRTUAL_P (vars))
  2169.       {
  2170.         if ((write_virtuals == 2
  2171.          && value_member (DECL_NAME (TYPE_NAME (DECL_VPARENT (vars))),
  2172.                   pending_vtables))
  2173.         || write_virtuals == 1
  2174.         || (write_virtuals == 0 && TREE_USED (vars)))
  2175.           {
  2176.         extern tree the_null_vtable_entry;
  2177.  
  2178.         /* Stuff this virtual function table's size into
  2179.            `pfn' slot of `the_null_vtable_entry'.  */
  2180.         tree nelts = array_type_nelts (TREE_TYPE (vars));
  2181.         tree *ppfn = &FNADDR_FROM_VTABLE_ENTRY (the_null_vtable_entry);
  2182.         *ppfn = nelts;
  2183.         assert (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (TREE_VALUE (CONSTRUCTOR_ELTS (DECL_INITIAL (vars))))))) == nelts);
  2184.         /* Write it out.  */
  2185.         rest_of_decl_compilation (vars, 0, 1, 1);
  2186.           }
  2187.         /* We know that PREV must be non-zero here.  */
  2188.         TREE_CHAIN (prev) = TREE_CHAIN (vars);
  2189.       }
  2190.     else
  2191.       prev = vars;
  2192.       }
  2193.     if (write_virtuals == 2)
  2194.       {
  2195.     /* Now complain about an virtual function tables promised
  2196.        but not delivered.  */
  2197.     while (pending_vtables)
  2198.       {
  2199.         if (TREE_PURPOSE (pending_vtables) == NULL_TREE)
  2200.           error ("virtual function table for `%s' not defined",
  2201.              IDENTIFIER_POINTER (TREE_VALUE (pending_vtables)));
  2202.         pending_vtables = TREE_CHAIN (pending_vtables);
  2203.       }
  2204.       }
  2205.   }
  2206.   permanent_allocation ();
  2207.   this_time = gettime ();
  2208.   parse_time -= this_time - start_time;
  2209.   varconst_time += this_time - start_time;
  2210.  
  2211.   if (flag_detailed_statistics)
  2212.     dump_time_statistics ();
  2213. }
  2214.