<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libcc1/libcp1plugin.cc, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>Update copyright years.</title>
<updated>2025-01-02T10:59:57+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2025-01-02T10:59:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=6441eb6dc020faae0672ea724dfdb38c6a9bf6a1'/>
<id>6441eb6dc020faae0672ea724dfdb38c6a9bf6a1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>c++/modules: Check linkage for exported declarations</title>
<updated>2024-12-20T01:57:24+00:00</updated>
<author>
<name>Nathaniel Shead</name>
<email>nathanieloshead@gmail.com</email>
</author>
<published>2024-09-06T13:53:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=fde64d1180408128a2f33e5326a3a7876926e2a3'/>
<id>fde64d1180408128a2f33e5326a3a7876926e2a3</id>
<content type='text'>
By [module.interface] p3, if an exported declaration is not within a
header unit, it shall not declare a name with internal linkage.

Unfortunately we cannot just do this within set_originating_module,
since at the locations its called the linkage for declarations are not
always fully determined yet.  We could move the calls but this causes
the checking assertion to fail as the originating module declaration may
have moved, and in general for some kinds of declarations it's not
always obvious where it should be moved to.

This patch instead introduces a new function to check that the linkage
of a declaration within a module is correct, to be called for all
declarations once their linkage is fully determined.

As a drive-by fix this patch also improves the source location of
namespace aliases to point at the identifier rather than the terminating
semicolon.

gcc/cp/ChangeLog:

	* cp-tree.h (check_module_decl_linkage): Declare.
	* decl2.cc (finish_static_data_member_decl): Check linkage.
	* module.cc (set_originating_module): Adjust comment.
	(check_module_decl_linkage): New function.
	* name-lookup.cc (do_namespace_alias): Build alias with
	specified location, check linkage.
	(pushtag): Check linkage.
	(push_namespace): Slightly clarify error message.
	* name-lookup.h (do_namespace_alias): Add location parameter.
	* parser.cc (cp_parser_namespace_alias_definition): Pass
	identifier location to do_namespace_alias.
	(cp_parser_alias_declaration): Check linkage.
	(cp_parser_init_declarator): Check linkage.
	(cp_parser_function_definition_after_declarator): Check linkage.
	(cp_parser_save_member_function_body): Check linkage.
	* pt.cc (finish_concept_definition): Mark as public, check
	linkage.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_add_namespace_alias): Call
	do_namespace_alias with input_location.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/export-3.C: Adjust error message.
	* g++.dg/modules/export-6.C: New test.

Signed-off-by: Nathaniel Shead &lt;nathanieloshead@gmail.com&gt;
Reviewed-by: Jason Merrill &lt;jason@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By [module.interface] p3, if an exported declaration is not within a
header unit, it shall not declare a name with internal linkage.

Unfortunately we cannot just do this within set_originating_module,
since at the locations its called the linkage for declarations are not
always fully determined yet.  We could move the calls but this causes
the checking assertion to fail as the originating module declaration may
have moved, and in general for some kinds of declarations it's not
always obvious where it should be moved to.

This patch instead introduces a new function to check that the linkage
of a declaration within a module is correct, to be called for all
declarations once their linkage is fully determined.

As a drive-by fix this patch also improves the source location of
namespace aliases to point at the identifier rather than the terminating
semicolon.

gcc/cp/ChangeLog:

	* cp-tree.h (check_module_decl_linkage): Declare.
	* decl2.cc (finish_static_data_member_decl): Check linkage.
	* module.cc (set_originating_module): Adjust comment.
	(check_module_decl_linkage): New function.
	* name-lookup.cc (do_namespace_alias): Build alias with
	specified location, check linkage.
	(pushtag): Check linkage.
	(push_namespace): Slightly clarify error message.
	* name-lookup.h (do_namespace_alias): Add location parameter.
	* parser.cc (cp_parser_namespace_alias_definition): Pass
	identifier location to do_namespace_alias.
	(cp_parser_alias_declaration): Check linkage.
	(cp_parser_init_declarator): Check linkage.
	(cp_parser_function_definition_after_declarator): Check linkage.
	(cp_parser_save_member_function_body): Check linkage.
	* pt.cc (finish_concept_definition): Mark as public, check
	linkage.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_add_namespace_alias): Call
	do_namespace_alias with input_location.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/export-3.C: Adjust error message.
	* g++.dg/modules/export-6.C: New test.

Signed-off-by: Nathaniel Shead &lt;nathanieloshead@gmail.com&gt;
Reviewed-by: Jason Merrill &lt;jason@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libcc1: fix &lt;vector&gt; include</title>
<updated>2024-03-16T08:50:00+00:00</updated>
<author>
<name>Francois-Xavier Coudert</name>
<email>fxcoudert@gcc.gnu.org</email>
</author>
<published>2024-03-16T08:50:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=5213047b1d50af63dfabb5e5649821a6cb157e33'/>
<id>5213047b1d50af63dfabb5e5649821a6cb157e33</id>
<content type='text'>
Use INCLUDE_VECTOR before including system.h, instead of directly
including &lt;vector&gt;, to avoid running into poisoned identifiers.

Signed-off-by: Dimitry Andric &lt;dimitry@andric.com&gt;

libcc1/ChangeLog:

	PR middle-end/111632
	* libcc1plugin.cc: Fix include.
	* libcp1plugin.cc: Fix include.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use INCLUDE_VECTOR before including system.h, instead of directly
including &lt;vector&gt;, to avoid running into poisoned identifiers.

Signed-off-by: Dimitry Andric &lt;dimitry@andric.com&gt;

libcc1/ChangeLog:

	PR middle-end/111632
	* libcc1plugin.cc: Fix include.
	* libcp1plugin.cc: Fix include.
</pre>
</div>
</content>
</entry>
<entry>
<title>c++: make build_throw SFINAE-friendly [PR98388]</title>
<updated>2024-02-09T21:37:37+00:00</updated>
<author>
<name>Marek Polacek</name>
<email>polacek@redhat.com</email>
</author>
<published>2024-02-06T20:35:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=3a3e0f1b46a3ad71ebeedc419393e3a36f1ce6db'/>
<id>3a3e0f1b46a3ad71ebeedc419393e3a36f1ce6db</id>
<content type='text'>
Here the problem is that we give hard errors while substituting
template parameters during overload resolution of is_throwable
which has an invalid throw in decltype.

The backtrace shows that fn_type_unification -&gt; instantiate_template
-&gt; tsubst* passes complain=0 as expected, but build_throw doesn't
have a complain parameter.  So let's add one.  Also remove a redundant
local variable which I should have removed in my P2266 patch.

There's still one problem for which I opened &lt;https://gcc.gnu.org/PR113853&gt;.
We need to patch up treat_lvalue_as_rvalue_p and remove the dg-bogus.

Thanks to Patrick for notifying me of this PR.  This doesn't fully fix
113789; there I think I'll have to figure our why a candidate wasn't
discarded from the overload set.

	PR c++/98388

gcc/cp/ChangeLog:

	* coroutines.cc (coro_rewrite_function_body): Pass tf_warning_or_error
	to build_throw.
	(morph_fn_to_coro): Likewise.
	* cp-tree.h (build_throw): Adjust.
	* except.cc (expand_end_catch_block): Pass tf_warning_or_error to
	build_throw.
	(build_throw): Add a tsubst_flags_t parameter.  Use it.  Remove
	redundant variable.  Guard an inform call.
	* parser.cc (cp_parser_throw_expression): Pass tf_warning_or_error
	to build_throw.
	* pt.cc (tsubst_expr) &lt;case THROW_EXPR&gt;: Pass complain to build_throw.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_build_unary_expr): Pass tf_error to
	build_throw.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/sfinae69.C: New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Here the problem is that we give hard errors while substituting
template parameters during overload resolution of is_throwable
which has an invalid throw in decltype.

The backtrace shows that fn_type_unification -&gt; instantiate_template
-&gt; tsubst* passes complain=0 as expected, but build_throw doesn't
have a complain parameter.  So let's add one.  Also remove a redundant
local variable which I should have removed in my P2266 patch.

There's still one problem for which I opened &lt;https://gcc.gnu.org/PR113853&gt;.
We need to patch up treat_lvalue_as_rvalue_p and remove the dg-bogus.

Thanks to Patrick for notifying me of this PR.  This doesn't fully fix
113789; there I think I'll have to figure our why a candidate wasn't
discarded from the overload set.

	PR c++/98388

gcc/cp/ChangeLog:

	* coroutines.cc (coro_rewrite_function_body): Pass tf_warning_or_error
	to build_throw.
	(morph_fn_to_coro): Likewise.
	* cp-tree.h (build_throw): Adjust.
	* except.cc (expand_end_catch_block): Pass tf_warning_or_error to
	build_throw.
	(build_throw): Add a tsubst_flags_t parameter.  Use it.  Remove
	redundant variable.  Guard an inform call.
	* parser.cc (cp_parser_throw_expression): Pass tf_warning_or_error
	to build_throw.
	* pt.cc (tsubst_expr) &lt;case THROW_EXPR&gt;: Pass complain to build_throw.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_build_unary_expr): Pass tf_error to
	build_throw.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/sfinae69.C: New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>c++: P0847R7 (deducing this) - prerequisite changes. [PR102609]</title>
<updated>2024-01-09T20:59:04+00:00</updated>
<author>
<name>waffl3x</name>
<email>waffl3x@protonmail.com</email>
</author>
<published>2024-01-07T00:00:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f9fbf93dc82525a0f54a2293b7ec92d65776bf19'/>
<id>f9fbf93dc82525a0f54a2293b7ec92d65776bf19</id>
<content type='text'>
Adds the xobj_flag member to lang_decl_fn and a corresponding member access
macro and predicate to support the addition of explicit object member
functions. Additionally, since explicit object member functions are also
non-static member functions, we need to change uses of
DECL_NONSTATIC_MEMBER_FUNCTION_P to clarify whether they intend to include
or exclude them.

	PR c++/102609

gcc/cp/ChangeLog:

	* cp-tree.h (struct lang_decl_fn): New data member.
	(DECL_NONSTATIC_MEMBER_FUNCTION_P): Poison.
	(DECL_IOBJ_MEMBER_FUNCTION_P): Define.
	(DECL_FUNCTION_XOBJ_FLAG): Define.
	(DECL_XOBJ_MEMBER_FUNCTION_P): Define.
	(DECL_OBJECT_MEMBER_FUNCTION_P): Define.
	(DECL_FUNCTION_MEMBER_P): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.
	(DECL_CONST_MEMFUNC_P): Likewise.
	(DECL_VOLATILE_MEMFUNC_P): Likewise.
	(DECL_NONSTATIC_MEMBER_P): Likewise.
	* module.cc (trees_out::lang_decl_bools): Handle xobj_flag.
	(trees_in::lang_decl_bools): Handle xobj_flag.
	* call.cc (build_this_conversion)
	(add_function_candidate)
	(add_template_candidate_real)
	(add_candidates)
	(maybe_warn_class_memaccess)
	(cand_parms_match)
	(joust)
	(do_warn_dangling_reference)
	* class.cc (finalize_literal_type_property)
	(finish_struct)
	(resolve_address_of_overloaded_function)
	* constexpr.cc (is_valid_constexpr_fn)
	(cxx_bind_parameters_in_call)
	* contracts.cc (build_contract_condition_function)
	* cp-objcp-common.cc (cp_decl_dwarf_attribute)
	* cxx-pretty-print.cc (cxx_pretty_printer::postfix_expression)
	(cxx_pretty_printer::declaration_specifiers)
	(cxx_pretty_printer::direct_declarator)
	* decl.cc (cp_finish_decl)
	(grok_special_member_properties)
	(start_preparsed_function)
	(record_key_method_defined)
	* decl2.cc (cp_handle_deprecated_or_unavailable)
	* init.cc (find_uninit_fields_r)
	(build_offset_ref)
	* lambda.cc (lambda_expr_this_capture)
	(maybe_generic_this_capture)
	(nonlambda_method_basetype)
	* mangle.cc (write_nested_name)
	* method.cc (early_check_defaulted_comparison)
	(skip_artificial_parms_for)
	(num_artificial_parms_for)
	* pt.cc (is_specialization_of_friend)
	(determine_specialization)
	(copy_default_args_to_explicit_spec)
	(check_explicit_specialization)
	(tsubst_contract_attribute)
	(check_non_deducible_conversions)
	(more_specialized_fn)
	(maybe_instantiate_noexcept)
	(register_parameter_specializations)
	(value_dependent_expression_p)
	* search.cc (shared_member_p)
	(lookup_member)
	(field_access_p)
	* semantics.cc (finish_omp_declare_simd_methods)
	* tree.cc (lvalue_kind)
	* typeck.cc (invalid_nonstatic_memfn_p): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_pragma_push_user_expression): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.

Signed-off-by: Waffl3x &lt;waffl3x@protonmail.com&gt;
Co-authored-by: Jason Merrill &lt;jason@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds the xobj_flag member to lang_decl_fn and a corresponding member access
macro and predicate to support the addition of explicit object member
functions. Additionally, since explicit object member functions are also
non-static member functions, we need to change uses of
DECL_NONSTATIC_MEMBER_FUNCTION_P to clarify whether they intend to include
or exclude them.

	PR c++/102609

gcc/cp/ChangeLog:

	* cp-tree.h (struct lang_decl_fn): New data member.
	(DECL_NONSTATIC_MEMBER_FUNCTION_P): Poison.
	(DECL_IOBJ_MEMBER_FUNCTION_P): Define.
	(DECL_FUNCTION_XOBJ_FLAG): Define.
	(DECL_XOBJ_MEMBER_FUNCTION_P): Define.
	(DECL_OBJECT_MEMBER_FUNCTION_P): Define.
	(DECL_FUNCTION_MEMBER_P): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.
	(DECL_CONST_MEMFUNC_P): Likewise.
	(DECL_VOLATILE_MEMFUNC_P): Likewise.
	(DECL_NONSTATIC_MEMBER_P): Likewise.
	* module.cc (trees_out::lang_decl_bools): Handle xobj_flag.
	(trees_in::lang_decl_bools): Handle xobj_flag.
	* call.cc (build_this_conversion)
	(add_function_candidate)
	(add_template_candidate_real)
	(add_candidates)
	(maybe_warn_class_memaccess)
	(cand_parms_match)
	(joust)
	(do_warn_dangling_reference)
	* class.cc (finalize_literal_type_property)
	(finish_struct)
	(resolve_address_of_overloaded_function)
	* constexpr.cc (is_valid_constexpr_fn)
	(cxx_bind_parameters_in_call)
	* contracts.cc (build_contract_condition_function)
	* cp-objcp-common.cc (cp_decl_dwarf_attribute)
	* cxx-pretty-print.cc (cxx_pretty_printer::postfix_expression)
	(cxx_pretty_printer::declaration_specifiers)
	(cxx_pretty_printer::direct_declarator)
	* decl.cc (cp_finish_decl)
	(grok_special_member_properties)
	(start_preparsed_function)
	(record_key_method_defined)
	* decl2.cc (cp_handle_deprecated_or_unavailable)
	* init.cc (find_uninit_fields_r)
	(build_offset_ref)
	* lambda.cc (lambda_expr_this_capture)
	(maybe_generic_this_capture)
	(nonlambda_method_basetype)
	* mangle.cc (write_nested_name)
	* method.cc (early_check_defaulted_comparison)
	(skip_artificial_parms_for)
	(num_artificial_parms_for)
	* pt.cc (is_specialization_of_friend)
	(determine_specialization)
	(copy_default_args_to_explicit_spec)
	(check_explicit_specialization)
	(tsubst_contract_attribute)
	(check_non_deducible_conversions)
	(more_specialized_fn)
	(maybe_instantiate_noexcept)
	(register_parameter_specializations)
	(value_dependent_expression_p)
	* search.cc (shared_member_p)
	(lookup_member)
	(field_access_p)
	* semantics.cc (finish_omp_declare_simd_methods)
	* tree.cc (lvalue_kind)
	* typeck.cc (invalid_nonstatic_memfn_p): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.

libcc1/ChangeLog:

	* libcp1plugin.cc (plugin_pragma_push_user_expression): Don't use
	DECL_NONSTATIC_MEMBER_FUNCTION_P.

Signed-off-by: Waffl3x &lt;waffl3x@protonmail.com&gt;
Co-authored-by: Jason Merrill &lt;jason@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright years.</title>
<updated>2024-01-03T11:19:35+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2024-01-03T11:19:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=a945c346f57ba40fc80c14ac59be0d43624e559d'/>
<id>a945c346f57ba40fc80c14ac59be0d43624e559d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>c: use _P() defines from tree.h</title>
<updated>2023-05-18T19:50:46+00:00</updated>
<author>
<name>Bernhard Reutner-Fischer</name>
<email>aldot@gcc.gnu.org</email>
</author>
<published>2023-05-13T22:54:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=9157b213f560fc7539a429075a3f1b6826e45523'/>
<id>9157b213f560fc7539a429075a3f1b6826e45523</id>
<content type='text'>
gcc/c-family/ChangeLog:

	* c-ada-spec.cc (has_static_fields): Use _P() defines from tree.h.
	(dump_ada_declaration): Ditto.
	(dump_ada_structure): Ditto.
	* c-common.cc (unsafe_conversion_p): Ditto.
	(shorten_compare): Ditto.
	(pointer_int_sum): Ditto.
	(c_common_truthvalue_conversion): Ditto.
	(scalar_to_vector): Ditto.
	* c-common.h (gnu_vector_type_p): Ditto.
	* c-omp.cc (c_omp_depend_t_p): Ditto.
	(c_omp_split_clauses): Ditto.
	* c-ubsan.cc (ubsan_instrument_division): Ditto.
	* c-warn.cc (conversion_warning): Ditto.
	(warnings_for_convert_and_check): Ditto.

gcc/c/ChangeLog:

	* c-convert.cc (c_convert): Ditto.
	* c-decl.cc (merge_decls): Ditto.
	* c-parser.cc (c_parser_omp_clause_reduction): Ditto.
	(c_parser_omp_declare_reduction): Ditto.
	* c-typeck.cc (build_component_ref): Ditto.
	(convert_argument): Ditto.
	(pointer_diff): Ditto.
	(build_unary_op): Ditto.
	(build_c_cast): Ditto.
	(build_modify_expr): Ditto.
	(store_init_value): Ditto.
	(constexpr_init_fits_real_type): Ditto.
	(check_constexpr_init): Ditto.
	(c_finish_return): Ditto.
	(handle_omp_array_sections_1): Ditto.
	(c_finish_omp_clauses): Ditto.
	* gimple-parser.cc (c_finish_gimple_return): Ditto.

libcc1/ChangeLog:

	* libcc1plugin.cc (plugin_float_type): Ditto.
	* libcp1plugin.cc (plugin_reactivate_decl): Ditto.
	(plugin_get_float_type): Ditto.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc/c-family/ChangeLog:

	* c-ada-spec.cc (has_static_fields): Use _P() defines from tree.h.
	(dump_ada_declaration): Ditto.
	(dump_ada_structure): Ditto.
	* c-common.cc (unsafe_conversion_p): Ditto.
	(shorten_compare): Ditto.
	(pointer_int_sum): Ditto.
	(c_common_truthvalue_conversion): Ditto.
	(scalar_to_vector): Ditto.
	* c-common.h (gnu_vector_type_p): Ditto.
	* c-omp.cc (c_omp_depend_t_p): Ditto.
	(c_omp_split_clauses): Ditto.
	* c-ubsan.cc (ubsan_instrument_division): Ditto.
	* c-warn.cc (conversion_warning): Ditto.
	(warnings_for_convert_and_check): Ditto.

gcc/c/ChangeLog:

	* c-convert.cc (c_convert): Ditto.
	* c-decl.cc (merge_decls): Ditto.
	* c-parser.cc (c_parser_omp_clause_reduction): Ditto.
	(c_parser_omp_declare_reduction): Ditto.
	* c-typeck.cc (build_component_ref): Ditto.
	(convert_argument): Ditto.
	(pointer_diff): Ditto.
	(build_unary_op): Ditto.
	(build_c_cast): Ditto.
	(build_modify_expr): Ditto.
	(store_init_value): Ditto.
	(constexpr_init_fits_real_type): Ditto.
	(check_constexpr_init): Ditto.
	(c_finish_return): Ditto.
	(handle_omp_array_sections_1): Ditto.
	(c_finish_omp_clauses): Ditto.
	* gimple-parser.cc (c_finish_gimple_return): Ditto.

libcc1/ChangeLog:

	* libcc1plugin.cc (plugin_float_type): Ditto.
	* libcp1plugin.cc (plugin_reactivate_decl): Ditto.
	(plugin_get_float_type): Ditto.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright years.</title>
<updated>2023-01-16T10:52:17+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2023-01-16T10:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=83ffe9cde7fe0b4deb0d1b54175fd9b19c38179c'/>
<id>83ffe9cde7fe0b4deb0d1b54175fd9b19c38179c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>c++: per-scope, per-signature lambda discriminators</title>
<updated>2022-11-01T21:44:36+00:00</updated>
<author>
<name>Nathan Sidwell</name>
<email>nathan@acm.org</email>
</author>
<published>2022-10-31T10:11:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=2b0e81d5cc2f7e1d773f6c502bd65b097f392675'/>
<id>2b0e81d5cc2f7e1d773f6c502bd65b097f392675</id>
<content type='text'>
This implements ABI-compliant lambda discriminators.  Not only do we
have per-scope counters, but we also distinguish by lambda signature.
Only lambdas with the same signature will need non-zero
discriminators.  As the discriminator is signature-dependent, we have
to process the lambda function's declaration before we can determine
it.  For templated and generic lambdas the signature is that of the
uninstantiated lambda -- not separate for each instantiation.

With this change, gcc and clang now produce the same lambda manglings
for all these testcases.

	gcc/cp/
	* cp-tree.h (LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR): New.
	(struct tree_lambda_expr): Add discriminator_sig bitfield.
	(recrd_lambda_scope_sig_discriminator): Declare.
	* lambda.cc (struct lambda_sig_count): New.
	(lambda_discriminator): Add signature vector.
	(start_lambda_scope): Adjust.
	(compare_lambda_template_head, compare_lambda_sig): New.
	(record_lambda_scope_sig_discriminator): New.
	* mangle.cc (write_closure_type): Use the scope-sig discriminator for
	ABI &gt;= 18.  Emit abi mangling warning if needed.
	* module.cc (trees_out::core_vals): Stream the new discriminator.
	(trees_in::core_vals): Likewise.
	* parser.cc (cp_parser_lambda_declarator_opt): Call
	record_lambda_scope_sig_discriminator.
	* pt.cc (tsubst_lambda_expr): Likewise.
	libcc1/
	* libcp1plugin.cc (plugin_start_lambda_closure_class_type):
	Initialize the per-scope, per-signature discriminator.
	gcc/testsuite/
	* g++.dg/abi/lambda-sig1-18.C: New.
	* g++.dg/abi/lambda-sig1-18vs17.C: New.
	* g++.dg/cpp1y/lambda-mangle-1-18.C: New.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements ABI-compliant lambda discriminators.  Not only do we
have per-scope counters, but we also distinguish by lambda signature.
Only lambdas with the same signature will need non-zero
discriminators.  As the discriminator is signature-dependent, we have
to process the lambda function's declaration before we can determine
it.  For templated and generic lambdas the signature is that of the
uninstantiated lambda -- not separate for each instantiation.

With this change, gcc and clang now produce the same lambda manglings
for all these testcases.

	gcc/cp/
	* cp-tree.h (LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR): New.
	(struct tree_lambda_expr): Add discriminator_sig bitfield.
	(recrd_lambda_scope_sig_discriminator): Declare.
	* lambda.cc (struct lambda_sig_count): New.
	(lambda_discriminator): Add signature vector.
	(start_lambda_scope): Adjust.
	(compare_lambda_template_head, compare_lambda_sig): New.
	(record_lambda_scope_sig_discriminator): New.
	* mangle.cc (write_closure_type): Use the scope-sig discriminator for
	ABI &gt;= 18.  Emit abi mangling warning if needed.
	* module.cc (trees_out::core_vals): Stream the new discriminator.
	(trees_in::core_vals): Likewise.
	* parser.cc (cp_parser_lambda_declarator_opt): Call
	record_lambda_scope_sig_discriminator.
	* pt.cc (tsubst_lambda_expr): Likewise.
	libcc1/
	* libcp1plugin.cc (plugin_start_lambda_closure_class_type):
	Initialize the per-scope, per-signature discriminator.
	gcc/testsuite/
	* g++.dg/abi/lambda-sig1-18.C: New.
	* g++.dg/abi/lambda-sig1-18vs17.C: New.
	* g++.dg/cpp1y/lambda-mangle-1-18.C: New.
</pre>
</div>
</content>
</entry>
<entry>
<title>c++: Reorganize per-scope lambda discriminators</title>
<updated>2022-11-01T10:04:48+00:00</updated>
<author>
<name>Nathan Sidwell</name>
<email>nathan@acm.org</email>
</author>
<published>2022-10-31T10:11:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=0122faae30fe1ad1dfa8c69f3d3f0428b996b600'/>
<id>0122faae30fe1ad1dfa8c69f3d3f0428b996b600</id>
<content type='text'>
We currently use a per-extra-scope counter to discriminate multiple
lambdas in a particular such scope.  This is not ABI compliant.  This
patch merely refactors the existing code to make it easier to drop in
a conformant mangling -- there's no functional change here.  I rename
the LAMBDA_EXPR_DISCIMINATOR to LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR,
foreshadowing that there'll be a new discriminator.  To provide ABI
warnings we'll need to calculate both, and that requires some
repacking of the lambda_expr's fields.  Finally, although we end up
calling the discriminator setter and the scope recorder (nearly)
always consecutively, it's clearer to handle it as two separate
operations.  That also allows us to remove the instantiation
special-case for a null extra-scope.

	gcc/cp/
	* cp-tree.h (LAMBDA_EXPR_DISCRIMINATOR): Rename to ...
	(LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR): ... here.
	(struct tree_lambda_expr): Make default_capture_mode &amp;
	discriminator_scope bitfields.
	(record_null_lambda_scope) Delete.
	(record_lambda_scope_discriminator): Declare.
	* lambda.cc (struct lambda_discriminator): New struct.
	(lambda_scope, lambda_scope_stack): Adjust types.
	(lambda_count): Delete.
	(struct tree_int): Delete.
	(start_lambda_scope, finish_lambda_scope): Adjust.
	(record_lambda_scope): Only record the scope.
	(record_lambda_scope_discriminator): New.
	* mangle.cc (write_closure_type_name): Adjust.
	* module.cc (trees_out::core_vals): Likewise,
	(trees_in::core_vals): Likewise.
	* parser.cc (cp_parser_lambda_expression): Call
	record_lambda_scope_discriminator.
	* pt.cc (tsubst_lambda_expr): Adjust record_lambda_scope caling.  Call
	record_lambda_scope_discriminator. Commonize control flow on tsubsting
	the operator function.
	libcc1/
	* libcp1plugin.cc (plugin_start_closure): Adjust.
	gcc/testsuite/
	* g++.dg/abi/lambda-sig1-17.C: New.
	* g++.dg/abi/lambda-sig1.h: New.
	* g++.dg/cpp1y/lambda-mangle-1.C: Extracted to ...
	* g++.dg/cpp1y/lambda-mangle-1.h: ... here.
	* g++.dg/cpp1y/lambda-mangle-1-11.C: New
	* g++.dg/cpp1y/lambda-mangle-1-17.C
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We currently use a per-extra-scope counter to discriminate multiple
lambdas in a particular such scope.  This is not ABI compliant.  This
patch merely refactors the existing code to make it easier to drop in
a conformant mangling -- there's no functional change here.  I rename
the LAMBDA_EXPR_DISCIMINATOR to LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR,
foreshadowing that there'll be a new discriminator.  To provide ABI
warnings we'll need to calculate both, and that requires some
repacking of the lambda_expr's fields.  Finally, although we end up
calling the discriminator setter and the scope recorder (nearly)
always consecutively, it's clearer to handle it as two separate
operations.  That also allows us to remove the instantiation
special-case for a null extra-scope.

	gcc/cp/
	* cp-tree.h (LAMBDA_EXPR_DISCRIMINATOR): Rename to ...
	(LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR): ... here.
	(struct tree_lambda_expr): Make default_capture_mode &amp;
	discriminator_scope bitfields.
	(record_null_lambda_scope) Delete.
	(record_lambda_scope_discriminator): Declare.
	* lambda.cc (struct lambda_discriminator): New struct.
	(lambda_scope, lambda_scope_stack): Adjust types.
	(lambda_count): Delete.
	(struct tree_int): Delete.
	(start_lambda_scope, finish_lambda_scope): Adjust.
	(record_lambda_scope): Only record the scope.
	(record_lambda_scope_discriminator): New.
	* mangle.cc (write_closure_type_name): Adjust.
	* module.cc (trees_out::core_vals): Likewise,
	(trees_in::core_vals): Likewise.
	* parser.cc (cp_parser_lambda_expression): Call
	record_lambda_scope_discriminator.
	* pt.cc (tsubst_lambda_expr): Adjust record_lambda_scope caling.  Call
	record_lambda_scope_discriminator. Commonize control flow on tsubsting
	the operator function.
	libcc1/
	* libcp1plugin.cc (plugin_start_closure): Adjust.
	gcc/testsuite/
	* g++.dg/abi/lambda-sig1-17.C: New.
	* g++.dg/abi/lambda-sig1.h: New.
	* g++.dg/cpp1y/lambda-mangle-1.C: Extracted to ...
	* g++.dg/cpp1y/lambda-mangle-1.h: ... here.
	* g++.dg/cpp1y/lambda-mangle-1-11.C: New
	* g++.dg/cpp1y/lambda-mangle-1-17.C
</pre>
</div>
</content>
</entry>
</feed>
