Deleted Added
full compact
decl2.c (56385) decl2.c (60967)
1/* Process declarations and variables for C compiler.
2 Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by

--- 210 unchanged lines hidden (view full) ---

219
220int warn_long_long = 1;
221
222/* Nonzero means warn when all ctors or dtors are private, and the class
223 has no friends. */
224
225int warn_ctor_dtor_privacy = 1;
226
1/* Process declarations and variables for C compiler.
2 Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by

--- 210 unchanged lines hidden (view full) ---

219
220int warn_long_long = 1;
221
222/* Nonzero means warn when all ctors or dtors are private, and the class
223 has no friends. */
224
225int warn_ctor_dtor_privacy = 1;
226
227/* True if we want to implement vtables using "thunks".
228 The default is off. */
227/* 1 or 2 if we want to implement vtables using "thunks".
228 The default is off. Version 1 indicates "old" implementation;
229 Version 2 passes the __vlist argument in pvbase cases. */
229
230#ifndef DEFAULT_VTABLE_THUNKS
231#define DEFAULT_VTABLE_THUNKS 0
232#endif
233int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
234
230
231#ifndef DEFAULT_VTABLE_THUNKS
232#define DEFAULT_VTABLE_THUNKS 0
233#endif
234int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
235
236#if DEFAULT_VTABLE_THUNKS == 2
237int flag_vtable_thunks_compat = 1;
238#else
239int flag_vtable_thunks_compat = 0;
240#endif
241
235/* True if we want to deal with repository information. */
236
237int flag_use_repository;
238
239/* Nonzero if we want to issue diagnostics that the standard says are not
240 required. */
241
242int flag_optional_diags = 1;

--- 385 unchanged lines hidden (view full) ---

628 cp_deprecated ("-fthis-is-variable");
629 }
630 else if (!strcmp (p, "external-templates"))
631 {
632 flag_external_templates = 1;
633 found = 1;
634 cp_deprecated ("-fexternal-templates");
635 }
242/* True if we want to deal with repository information. */
243
244int flag_use_repository;
245
246/* Nonzero if we want to issue diagnostics that the standard says are not
247 required. */
248
249int flag_optional_diags = 1;

--- 385 unchanged lines hidden (view full) ---

635 cp_deprecated ("-fthis-is-variable");
636 }
637 else if (!strcmp (p, "external-templates"))
638 {
639 flag_external_templates = 1;
640 found = 1;
641 cp_deprecated ("-fexternal-templates");
642 }
643 else if (!strncmp (p, "vtable-thunks", 13))
644 {
645 if (p[13] == '=')
646 {
647 flag_vtable_thunks =
648 read_integral_parameter (p+14, p, 1);
649 }
650 else
651 {
652 /* If the machine file has a default setting, use that
653 for -fvtable-thunks. Otherwise, set it to version
654 2. */
655#if DEFAULT_VTABLE_THUNKS
656 flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
657#else
658 flag_vtable_thunks = 1;
659#endif
660 }
661 if (flag_vtable_thunks == 2)
662 /* v2 is a compatibility mode between v1 and v3. */
663 flag_vtable_thunks_compat = 1;
664 else if(flag_vtable_thunks == 3)
665 flag_vtable_thunks_compat = 0;
666 found = 1;
667 }
636 else if (!strcmp (p, "handle-signatures"))
637 {
638 flag_handle_signatures = 1;
639 found = 1;
640 cp_deprecated ("-fhandle-signatures");
641 }
642 else if (!strcmp (p, "new-abi"))
643 {
644 flag_new_abi = 1;
645 flag_do_squangling = 1;
646 flag_honor_std = 1;
668 else if (!strcmp (p, "handle-signatures"))
669 {
670 flag_handle_signatures = 1;
671 found = 1;
672 cp_deprecated ("-fhandle-signatures");
673 }
674 else if (!strcmp (p, "new-abi"))
675 {
676 flag_new_abi = 1;
677 flag_do_squangling = 1;
678 flag_honor_std = 1;
647 flag_vtable_thunks = 1;
679 flag_vtable_thunks = 2;
648 }
649 else if (!strcmp (p, "no-new-abi"))
650 {
651 flag_new_abi = 0;
652 flag_do_squangling = 0;
653 flag_honor_std = 0;
654 }
655 else if (!strncmp (p, "template-depth-", 15))

--- 256 unchanged lines hidden (view full) ---

912/* Constructors for types with virtual baseclasses need an "in-charge" flag
913 saying whether this constructor is responsible for initialization of
914 virtual baseclasses or not. All destructors also need this "in-charge"
915 flag, which additionally determines whether or not the destructor should
916 free the memory for the object.
917
918 This function adds the "in-charge" flag to member function FN if
919 appropriate. It is called from grokclassfn and tsubst.
680 }
681 else if (!strcmp (p, "no-new-abi"))
682 {
683 flag_new_abi = 0;
684 flag_do_squangling = 0;
685 flag_honor_std = 0;
686 }
687 else if (!strncmp (p, "template-depth-", 15))

--- 256 unchanged lines hidden (view full) ---

944/* Constructors for types with virtual baseclasses need an "in-charge" flag
945 saying whether this constructor is responsible for initialization of
946 virtual baseclasses or not. All destructors also need this "in-charge"
947 flag, which additionally determines whether or not the destructor should
948 free the memory for the object.
949
950 This function adds the "in-charge" flag to member function FN if
951 appropriate. It is called from grokclassfn and tsubst.
920 FN must be either a constructor or destructor. */
952 FN must be either a constructor or destructor.
921
953
954 For vtable thunks, types with polymorphic virtual bases need an
955 additional "vlist" argument which is an array of virtual tables.
956 In addition, if backwards-compatibility to v1 thunks is requested,
957 a wrapper constructor may be needed as well. */
958
922void
923maybe_retrofit_in_chrg (fn)
924 tree fn;
925{
926 tree basetype, arg_types, parms, parm, fntype;
959void
960maybe_retrofit_in_chrg (fn)
961 tree fn;
962{
963 tree basetype, arg_types, parms, parm, fntype;
964 tree wrapper;
927
965
966 if (CLASSTYPE_IS_TEMPLATE (DECL_CLASS_CONTEXT (fn)))
967 /* Never retrofit arguments on template methods. */
968 return;
969
928 if (DECL_CONSTRUCTOR_P (fn)
929 && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CLASS_CONTEXT (fn))
970 if (DECL_CONSTRUCTOR_P (fn)
971 && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CLASS_CONTEXT (fn))
930 && ! DECL_CONSTRUCTOR_FOR_VBASE_P (fn))
972 && DECL_CONSTRUCTOR_FOR_VBASE (fn) == 0)
931 /* OK */;
932 else if (! DECL_CONSTRUCTOR_P (fn)
933 && TREE_CHAIN (DECL_ARGUMENTS (fn)) == NULL_TREE)
934 /* OK */;
935 else
936 return;
937
938 if (DECL_CONSTRUCTOR_P (fn))
973 /* OK */;
974 else if (! DECL_CONSTRUCTOR_P (fn)
975 && TREE_CHAIN (DECL_ARGUMENTS (fn)) == NULL_TREE)
976 /* OK */;
977 else
978 return;
979
980 if (DECL_CONSTRUCTOR_P (fn))
939 DECL_CONSTRUCTOR_FOR_VBASE_P (fn) = 1;
981 {
982 if (TYPE_USES_PVBASES (DECL_CLASS_CONTEXT (fn)))
983 DECL_CONSTRUCTOR_FOR_VBASE (fn) = CONSTRUCTOR_FOR_PVBASE;
984 else
985 DECL_CONSTRUCTOR_FOR_VBASE (fn) = CONSTRUCTOR_FOR_VBASE;
986 }
987 else if (TYPE_USES_PVBASES (DECL_CLASS_CONTEXT (fn)))
988 DECL_CONSTRUCTOR_FOR_VBASE (fn) = DESTRUCTOR_FOR_PVBASE;
940
989
990 /* Retrieve the arguments, because it is potentially modified twice. */
991 arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
992 basetype = TREE_TYPE (TREE_VALUE (arg_types));
993 arg_types = TREE_CHAIN (arg_types);
994
995 if (DECL_CONSTRUCTOR_FOR_PVBASE_P (fn)
996 || DECL_DESTRUCTOR_FOR_PVBASE_P (fn))
997 {
998 /* Add the __vlist argument first. See __in_chrg below. */
999 tree id = vlist_identifier;
1000 if (DECL_DESTRUCTOR_FOR_PVBASE_P (fn))
1001 id = get_identifier (VLIST1_NAME);
1002 parm = build_decl (PARM_DECL, id, vlist_type_node);
1003 SET_DECL_ARTIFICIAL (parm);
1004 DECL_ARG_TYPE (parm) = vlist_type_node;
1005 parms = DECL_ARGUMENTS (fn);
1006 /* Add it after 'this'. */
1007 TREE_CHAIN (parm) = TREE_CHAIN (parms);
1008 TREE_CHAIN (parms) = parm;
1009
1010 arg_types = hash_tree_chain (vlist_type_node, arg_types);
1011 }
1012
941 /* First add it to DECL_ARGUMENTS... */
942 parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
943 /* Mark the artificial `__in_chrg' parameter as "artificial". */
944 SET_DECL_ARTIFICIAL (parm);
945 DECL_ARG_TYPE (parm) = integer_type_node;
946 TREE_READONLY (parm) = 1;
947 parms = DECL_ARGUMENTS (fn);
948 TREE_CHAIN (parm) = TREE_CHAIN (parms);
949 TREE_CHAIN (parms) = parm;
950
951 /* ...and then to TYPE_ARG_TYPES. */
1013 /* First add it to DECL_ARGUMENTS... */
1014 parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
1015 /* Mark the artificial `__in_chrg' parameter as "artificial". */
1016 SET_DECL_ARTIFICIAL (parm);
1017 DECL_ARG_TYPE (parm) = integer_type_node;
1018 TREE_READONLY (parm) = 1;
1019 parms = DECL_ARGUMENTS (fn);
1020 TREE_CHAIN (parm) = TREE_CHAIN (parms);
1021 TREE_CHAIN (parms) = parm;
1022
1023 /* ...and then to TYPE_ARG_TYPES. */
952 arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
953 basetype = TREE_TYPE (TREE_VALUE (arg_types));
954 arg_types = hash_tree_chain (integer_type_node, TREE_CHAIN (arg_types));
1024 arg_types = hash_tree_chain (integer_type_node, arg_types);
955 fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)),
956 arg_types);
957 if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)))
958 fntype = build_exception_variant (fntype,
959 TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)));
960 TREE_TYPE (fn) = fntype;
1025 fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)),
1026 arg_types);
1027 if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)))
1028 fntype = build_exception_variant (fntype,
1029 TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)));
1030 TREE_TYPE (fn) = fntype;
1031
1032 if (flag_vtable_thunks_compat
1033 && DECL_CONSTRUCTOR_FOR_PVBASE_P (fn))
1034 make_vlist_ctor_wrapper (fn);
961}
962
963/* Classes overload their constituent function names automatically.
964 When a function name is declared in a record structure,
965 its name is changed to it overloaded name. Since names for
966 constructors and destructors can conflict, we place a leading
967 '$' for destructors.
968

--- 68 unchanged lines hidden (view full) ---

1037 if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))
1038 {
1039 maybe_retrofit_in_chrg (function);
1040 arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
1041 }
1042
1043 if (flags == DTOR_FLAG)
1044 {
1035}
1036
1037/* Classes overload their constituent function names automatically.
1038 When a function name is declared in a record structure,
1039 its name is changed to it overloaded name. Since names for
1040 constructors and destructors can conflict, we place a leading
1041 '$' for destructors.
1042

--- 68 unchanged lines hidden (view full) ---

1111 if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))
1112 {
1113 maybe_retrofit_in_chrg (function);
1114 arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
1115 }
1116
1117 if (flags == DTOR_FLAG)
1118 {
1045 DECL_ASSEMBLER_NAME (function) = build_destructor_name (ctype);
1119 DECL_ASSEMBLER_NAME (function) =
1120 build_destructor_name (ctype, DECL_DESTRUCTOR_FOR_PVBASE_P (function));
1046 TYPE_HAS_DESTRUCTOR (ctype) = 1;
1047 }
1048 else
1049 set_mangled_name_for_decl (function);
1050}
1051
1052/* Work on the expr used by alignof (this is only called by the parser). */
1053

--- 4251 unchanged lines hidden ---
1121 TYPE_HAS_DESTRUCTOR (ctype) = 1;
1122 }
1123 else
1124 set_mangled_name_for_decl (function);
1125}
1126
1127/* Work on the expr used by alignof (this is only called by the parser). */
1128

--- 4251 unchanged lines hidden ---