8e84a14291
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. |
||
---|---|---|
.. | ||
config | ||
core | ||
gc | ||
gcc | ||
rt | ||
__entrypoint.di | ||
__main.di | ||
LICENSE | ||
Makefile.am | ||
Makefile.in | ||
MERGE | ||
object.d |