gcc/libphobos/libdruntime
Iain Buclaw 8e84a14291 d: Update language attribute support, and implement gcc.attributes
D attribute support has been updated to have a baseline parity with the
LLVM D compiler's own `ldc.attributes'.

The handler that extracts GCC attributes from a list of UDAs has been
improved to take care of some mistakes that could have been warnings.
UDAs attached to field variables are also now processed for any GCC
attributes attached to them.

The following new attributes have been added to the D front-end:

 - @attribute("alloc_size")
 - @attribute("used")
 - @attribute("optimize")
 - @attribute("restrict")
 - @attribute("cold")
 - @attribute("noplt")
 - @attribute("target_clones")
 - @attribute("no_icf")
 - @attribute("noipa")
 - @attribute("symver")

With convenience aliases in a new `gcc.attributes' module to match
the same naming convention as `ldc.attributes':

 - @allocSize()
 - @assumeUsed
 - @fastmath
 - @naked
 - @restrict
 - @cold
 - @noplt
 - @optStrategy()
 - @polly
 - @section()
 - @target()
 - @weak

The old gcc.attribute module has been deprecated, along with the removal
of the following attribute handlers:

 - @attribute("alias"): Has been superseded by `pragma(mangle)'.
 - @attribute("forceinline"): Renamed to always_inline.

gcc/d/ChangeLog:

	* d-attribs.cc: Include fold-const.h and opts.h.
	(attr_noreturn_exclusions): Add alloc_size.
	(attr_const_pure_exclusions): Likewise.
	(attr_inline_exclusions): Add target_clones.
	(attr_noinline_exclusions): Rename forceinline to always_inline.
	(attr_target_exclusions): New array.
	(attr_target_clones_exclusions): New array.
	(attr_alloc_exclusions): New array.
	(attr_cold_hot_exclusions): New array.
	(d_langhook_common_attribute_table): Add new D attribute handlers.
	(build_attributes): Update to look for gcc.attributes.  Issue warning
	if not given a struct literal.  Handle void initialized arguments.
	(handle_always_inline_attribute): Remove function.
	(d_handle_noinline_attribute): Don't extract TYPE_LANG_FRONTEND.
	(d_handle_forceinline_attribute): Rename to...
	(d_handle_always_inline_attribute): ...this.  Remove special handling.
	(d_handle_flatten_attribute): Don't extract TYPE_LANG_FRONTEND.
	(d_handle_target_attribute): Likewise.  Warn about empty arguments.
	(d_handle_target_clones_attribute): New function.
	(optimize_args): New static variable.
	(parse_optimize_options): New function.
	(d_handle_optimize_attribute): New function.
	(d_handle_noclone_attribute): Don't extract TYPE_LANG_FRONTEND.
	(d_handle_alias_attribute): Remove function.
	(d_handle_noicf_attribute): New function.
	(d_handle_noipa_attribute): New function.
	(d_handle_section_attribute): Call the handle_generic_attribute target
	hook after performing target independent processing.
	(d_handle_symver_attribute): New function.
	(d_handle_noplt_attribute): New function.
	(positional_argument): New function.
	(d_handle_alloc_size_attribute): New function.
	(d_handle_cold_attribute): New function.
	(d_handle_restrict_attribute): New function.
	(d_handle_used_attribute): New function.
	* decl.cc (gcc_attribute_p): Update to look for gcc.attributes.
	(get_symbol_decl): Update decl source location of old prototypes to
	the new declaration being merged.
	* types.cc (layout_aggregate_members): Apply user defined attributes
	on fields.

libphobos/ChangeLog:

	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add
	  gcc/attributes.d.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/gcc/attribute.d: Deprecate module, publicly import
	gcc.attributes.
	* libdruntime/gcc/deh.d: Update imports.
	* libdruntime/gcc/attributes.d: New file.

gcc/testsuite/ChangeLog:

	* gdc.dg/gdc108.d: Update test.
	* gdc.dg/gdc142.d: Likewise.
	* gdc.dg/pr90136a.d: Likewise.
	* gdc.dg/pr90136b.d: Likewise.
	* gdc.dg/pr90136c.d: Likewise.
	* gdc.dg/pr95173.d: Likewise.
	* gdc.dg/attr_allocsize1.d: New test.
	* gdc.dg/attr_allocsize2.d: New test.
	* gdc.dg/attr_alwaysinline1.d: New test.
	* gdc.dg/attr_cold1.d: New test.
	* gdc.dg/attr_exclusions1.d: New test.
	* gdc.dg/attr_exclusions2.d: New test.
	* gdc.dg/attr_flatten1.d: New test.
	* gdc.dg/attr_module.d: New test.
	* gdc.dg/attr_noclone1.d: New test.
	* gdc.dg/attr_noicf1.d: New test.
	* gdc.dg/attr_noinline1.d: New test.
	* gdc.dg/attr_noipa1.d: New test.
	* gdc.dg/attr_noplt1.d: New test.
	* gdc.dg/attr_optimize1.d: New test.
	* gdc.dg/attr_optimize2.d: New test.
	* gdc.dg/attr_optimize3.d: New test.
	* gdc.dg/attr_optimize4.d: New test.
	* gdc.dg/attr_restrict1.d: New test.
	* gdc.dg/attr_section1.d: New test.
	* gdc.dg/attr_symver1.d: New test.
	* gdc.dg/attr_target1.d: New test.
	* gdc.dg/attr_targetclones1.d: New test.
	* gdc.dg/attr_used1.d: New test.
	* gdc.dg/attr_used2.d: New test.
	* gdc.dg/attr_weak1.d: New test.
	* gdc.dg/imports/attributes.d: New test.
2021-04-08 15:30:47 +02:00
..
config Update copyright years. 2021-01-04 10:26:59 +01:00
core d: Merge upstream dmd 3b808e838, druntime 483bc129, phobos f89dc217a 2021-04-04 01:26:20 +02:00
gc d: Merge upstream dmd 3b808e838, druntime 483bc129, phobos f89dc217a 2021-04-04 01:26:20 +02:00
gcc d: Update language attribute support, and implement gcc.attributes 2021-04-08 15:30:47 +02:00
rt d: Merge upstream dmd 46133f761, druntime 0fd4364c 2021-02-04 23:04:48 +01:00
LICENSE
MERGE d: Merge upstream dmd 5cc71ff83, druntime 1134b710 2021-04-06 19:43:30 +02:00
Makefile.am d: Update language attribute support, and implement gcc.attributes 2021-04-08 15:30:47 +02:00
Makefile.in d: Update language attribute support, and implement gcc.attributes 2021-04-08 15:30:47 +02:00
__entrypoint.di Update copyright years. 2021-01-04 10:26:59 +01:00
__main.di Update copyright years. 2021-01-04 10:26:59 +01:00
object.d d: Merge upstream dmd 5cc71ff83, druntime 1134b710 2021-04-06 19:43:30 +02:00