Most code is cold. This patch extends support for attribute ((cold)) to C++
Classes, Unions, and Structs (RECORD_TYPES and UNION_TYPES) to benefit from
encapsulation - reducing the verbosity of using the attribute where
deserved. The ((hot)) attribute is also extended for its semantic relation.
gcc/c-family/ChangeLog:
* c-attribs.cc (handle_hot_attribute): remove warning on
RECORD_TYPE and UNION_TYPE when in c_dialect_xx.
(handle_cold_attribute): Likewise.
gcc/cp/ChangeLog:
* class.cc (propagate_class_warmth_attribute): New function.
(check_bases_and_members): propagate hot and cold attributes
to all FUNCTION_DECL when the record is marked hot or cold.
* cp-tree.h (maybe_propagate_warmth_attributes): New function.
* decl2.cc (maybe_propagate_warmth_attributes): New function.
* method.cc (lazily_declare_fn): propagate hot and cold
attributes to lazily declared functions when the record is
marked hot or cold.
gcc/ChangeLog:
* doc/extend.texi: Document attributes hot, cold on C++ types.
gcc/testsuite/ChangeLog:
* g++.dg/ext/attr-hotness.C: New test.
Signed-off-by: Javier Martinez <javier.martinez.bugzilla@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>