Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 516692
Collapse All | Expand All

(-)a/gcc/cp/decl.c (-1 / +8 lines)
Lines 2185-2190 duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) Link Here
2185
		      olddecl);
2185
		      olddecl);
2186
2186
2187
	  SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
2187
	  SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
2188
	  DECL_COMDAT (newdecl) = DECL_DECLARED_INLINE_P (newdecl);
2188
2189
2189
	  /* Don't propagate visibility from the template to the
2190
	  /* Don't propagate visibility from the template to the
2190
	     specialization here.  We'll do that in determine_visibility if
2191
	     specialization here.  We'll do that in determine_visibility if
Lines 4638-4643 start_decl (const cp_declarator *declarator, Link Here
4638
      if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
4639
      if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
4639
	{
4640
	{
4640
	  SET_DECL_TEMPLATE_SPECIALIZATION (decl);
4641
	  SET_DECL_TEMPLATE_SPECIALIZATION (decl);
4642
	  if (TREE_CODE (decl) == FUNCTION_DECL)
4643
	    DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl);
4641
4644
4642
	  /* [temp.expl.spec] An explicit specialization of a static data
4645
	  /* [temp.expl.spec] An explicit specialization of a static data
4643
	     member of a template is a definition if the declaration
4646
	     member of a template is a definition if the declaration
Lines 7602-7608 grokfndecl (tree ctype, Link Here
7602
7605
7603
  /* If the declaration was declared inline, mark it as such.  */
7606
  /* If the declaration was declared inline, mark it as such.  */
7604
  if (inlinep)
7607
  if (inlinep)
7605
    DECL_DECLARED_INLINE_P (decl) = 1;
7608
    {
7609
      DECL_DECLARED_INLINE_P (decl) = 1;
7610
      DECL_COMDAT (decl) = 1;
7611
    }
7606
  if (inlinep & 2)
7612
  if (inlinep & 2)
7607
    DECL_DECLARED_CONSTEXPR_P (decl) = true;
7613
    DECL_DECLARED_CONSTEXPR_P (decl) = true;
7608
7614
Lines 14147-14152 grokmethod (cp_decl_specifier_seq *declspecs, Link Here
14147
14153
14148
  check_template_shadow (fndecl);
14154
  check_template_shadow (fndecl);
14149
14155
14156
  DECL_COMDAT (fndecl) = 1;
14150
  DECL_DECLARED_INLINE_P (fndecl) = 1;
14157
  DECL_DECLARED_INLINE_P (fndecl) = 1;
14151
  DECL_NO_INLINE_WARNING_P (fndecl) = 1;
14158
  DECL_NO_INLINE_WARNING_P (fndecl) = 1;
14152
14159
(-)a/gcc/cp/decl2.c (-11 / +7 lines)
Lines 1896-1901 mark_needed (tree decl) Link Here
1896
	 definition.  */
1896
	 definition.  */
1897
      struct cgraph_node *node = cgraph_get_create_node (decl);
1897
      struct cgraph_node *node = cgraph_get_create_node (decl);
1898
      node->forced_by_abi = true;
1898
      node->forced_by_abi = true;
1899
1900
      /* #pragma interface and -frepo code can call mark_needed for
1901
          maybe-in-charge 'tors; mark the clones as well.  */
1902
      tree clone;
1903
      FOR_EACH_CLONE (clone, decl)
1904
	mark_needed (clone);
1899
    }
1905
    }
1900
  else if (TREE_CODE (decl) == VAR_DECL)
1906
  else if (TREE_CODE (decl) == VAR_DECL)
1901
    {
1907
    {
Lines 2683-2699 import_export_decl (tree decl) Link Here
2683
    {
2689
    {
2684
      /* The repository indicates that this entity should be defined
2690
      /* The repository indicates that this entity should be defined
2685
	 here.  Make sure the back end honors that request.  */
2691
	 here.  Make sure the back end honors that request.  */
2686
      if (VAR_P (decl))
2692
      mark_needed (decl);
2687
	mark_needed (decl);
2688
      else if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
2689
	       || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
2690
	{
2691
	  tree clone;
2692
	  FOR_EACH_CLONE (clone, decl)
2693
	    mark_needed (clone);
2694
	}
2695
      else
2696
	mark_needed (decl);
2697
      /* Output the definition as an ordinary strong definition.  */
2693
      /* Output the definition as an ordinary strong definition.  */
2698
      DECL_EXTERNAL (decl) = 0;
2694
      DECL_EXTERNAL (decl) = 0;
2699
      DECL_INTERFACE_KNOWN (decl) = 1;
2695
      DECL_INTERFACE_KNOWN (decl) = 1;
(-)a/gcc/cp/method.c (-2 / +3 lines)
Lines 1760-1767 implicitly_declare_fn (special_function_kind kind, tree type, Link Here
1760
  DECL_ARGUMENTS (fn) = this_parm;
1760
  DECL_ARGUMENTS (fn) = this_parm;
1761
1761
1762
  grokclassfn (type, fn, kind == sfk_destructor ? DTOR_FLAG : NO_SPECIAL);
1762
  grokclassfn (type, fn, kind == sfk_destructor ? DTOR_FLAG : NO_SPECIAL);
1763
  set_linkage_according_to_type (type, fn);
1764
  rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
1765
  DECL_IN_AGGR_P (fn) = 1;
1763
  DECL_IN_AGGR_P (fn) = 1;
1766
  DECL_ARTIFICIAL (fn) = 1;
1764
  DECL_ARTIFICIAL (fn) = 1;
1767
  DECL_DEFAULTED_FN (fn) = 1;
1765
  DECL_DEFAULTED_FN (fn) = 1;
Lines 1773-1778 implicitly_declare_fn (special_function_kind kind, tree type, Link Here
1773
  DECL_EXTERNAL (fn) = true;
1771
  DECL_EXTERNAL (fn) = true;
1774
  DECL_NOT_REALLY_EXTERN (fn) = 1;
1772
  DECL_NOT_REALLY_EXTERN (fn) = 1;
1775
  DECL_DECLARED_INLINE_P (fn) = 1;
1773
  DECL_DECLARED_INLINE_P (fn) = 1;
1774
  DECL_COMDAT (fn) = 1;
1775
  set_linkage_according_to_type (type, fn);
1776
  rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
1776
  gcc_assert (!TREE_USED (fn));
1777
  gcc_assert (!TREE_USED (fn));
1777
1778
1778
  /* Restore PROCESSING_TEMPLATE_DECL.  */
1779
  /* Restore PROCESSING_TEMPLATE_DECL.  */
(-)a/gcc/cp/pt.c (+11 lines)
Lines 2783-2788 check_explicit_specialization (tree declarator, Link Here
2783
	       It's just the name of an instantiation.  But, it's not
2783
	       It's just the name of an instantiation.  But, it's not
2784
	       a request for an instantiation, either.  */
2784
	       a request for an instantiation, either.  */
2785
	    SET_DECL_IMPLICIT_INSTANTIATION (decl);
2785
	    SET_DECL_IMPLICIT_INSTANTIATION (decl);
2786
	  else
2787
	    /* A specialization is not necessarily COMDAT.  */
2788
	    DECL_COMDAT (decl) = DECL_DECLARED_INLINE_P (decl);
2786
2789
2787
	  /* Register this specialization so that we can find it
2790
	  /* Register this specialization so that we can find it
2788
	     again.  */
2791
	     again.  */
Lines 5025-5030 template arguments to %qD do not match original template %qD", Link Here
5025
	DECL_TEMPLATE_INFO (decl) = info;
5028
	DECL_TEMPLATE_INFO (decl) = info;
5026
    }
5029
    }
5027
5030
5031
  if (flag_implicit_templates
5032
      && !is_friend
5033
      && TREE_CODE (decl) == FUNCTION_DECL)
5034
    /* Set DECL_COMDAT on template instantiations; if we force
5035
       them to be emitted by explicit instantiation or -frepo,
5036
       mark_needed will tell cgraph to do the right thing.  */
5037
    DECL_COMDAT (decl) = true;
5038
5028
  return DECL_TEMPLATE_RESULT (tmpl);
5039
  return DECL_TEMPLATE_RESULT (tmpl);
5029
}
5040
}
5030
5041
(-)a/gcc/cp/tree.c (-11 / +3 lines)
Lines 3716-3738 decl_linkage (tree decl) Link Here
3716
  if (TREE_CODE (decl) == CONST_DECL)
3716
  if (TREE_CODE (decl) == CONST_DECL)
3717
    return decl_linkage (TYPE_NAME (DECL_CONTEXT (decl)));
3717
    return decl_linkage (TYPE_NAME (DECL_CONTEXT (decl)));
3718
3718
3719
  /* Some things that are not TREE_PUBLIC have external linkage, too.
3720
     For example, on targets that don't have weak symbols, we make all
3721
     template instantiations have internal linkage (in the object
3722
     file), but the symbols should still be treated as having external
3723
     linkage from the point of view of the language.  */
3724
  if (VAR_OR_FUNCTION_DECL_P (decl)
3725
      && DECL_COMDAT (decl))
3726
    return lk_external;
3727
3728
  /* Things in local scope do not have linkage, if they don't have
3719
  /* Things in local scope do not have linkage, if they don't have
3729
     TREE_PUBLIC set.  */
3720
     TREE_PUBLIC set.  */
3730
  if (decl_function_context (decl))
3721
  if (decl_function_context (decl))
3731
    return lk_none;
3722
    return lk_none;
3732
3723
3733
  /* Members of the anonymous namespace also have TREE_PUBLIC unset, but
3724
  /* Members of the anonymous namespace also have TREE_PUBLIC unset, but
3734
     are considered to have external linkage for language purposes.  DECLs
3725
     are considered to have external linkage for language purposes, as do
3735
     really meant to have internal linkage have DECL_THIS_STATIC set.  */
3726
     template instantiations on targets without weak symbols.  DECLs really
3727
     meant to have internal linkage have DECL_THIS_STATIC set.  */
3736
  if (TREE_CODE (decl) == TYPE_DECL)
3728
  if (TREE_CODE (decl) == TYPE_DECL)
3737
    return lk_external;
3729
    return lk_external;
3738
  if (VAR_OR_FUNCTION_DECL_P (decl))
3730
  if (VAR_OR_FUNCTION_DECL_P (decl))

Return to bug 516692