Bug 1569681: Part 3 - Update mfbt/Attributes.h with new MOZ_STATIC_LOCAL_CLASS macro; r=Ehsan

I did not add a separate macro for `MOZ_TRIVIAL_DTOR` as I could not really
think of a use case for it. Let me know if you prefer that I add it as a
distinct macro.

Differential Revision: https://phabricator.services.mozilla.com/D39719

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2019-07-29 20:10:39 +00:00
parent b08dc4e5de
commit dd7121c289

View File

@ -576,6 +576,14 @@
* class, or if another class inherits from this class, then it is considered
* to be a static class as well, although this attribute need not be provided
* in such cases.
* MOZ_STATIC_LOCAL_CLASS: Applies to all classes. Any class with this
* annotation is expected to be a static local variable, so it is
* a compile-time error to use it, or an array of such objects, or as a
* temporary object, or as the type of a new expression. If another class
* inherits from this class then it is considered to be a static local
* class as well, although this attribute need not be provided in such cases.
* It is also a compile-time error for any class with this annotation to have
* a non-trivial destructor.
* MOZ_STACK_CLASS: Applies to all classes. Any class with this annotation is
* expected to live on the stack, so it is a compile-time error to use it, or
* an array of such objects, as a global or static variable, or as the type of
@ -766,6 +774,9 @@
__attribute__((annotate("moz_can_run_script_boundary")))
# define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
# define MOZ_STATIC_CLASS __attribute__((annotate("moz_global_class")))
# define MOZ_STATIC_LOCAL_CLASS \
__attribute__((annotate("moz_static_local_class"))) \
__attribute__((annotate("moz_trivial_dtor")))
# define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
# define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
# define MOZ_HEAP_CLASS __attribute__((annotate("moz_heap_class")))
@ -836,6 +847,7 @@
# define MOZ_CAN_RUN_SCRIPT_BOUNDARY /* nothing */
# define MOZ_MUST_OVERRIDE /* nothing */
# define MOZ_STATIC_CLASS /* nothing */
# define MOZ_STATIC_LOCAL_CLASS /* nothing */
# define MOZ_STACK_CLASS /* nothing */
# define MOZ_NONHEAP_CLASS /* nothing */
# define MOZ_HEAP_CLASS /* nothing */