Bug 1569681: Part 3 - Update mfbt/Attributes.h with new MOZ_STATIC_LOCAL_CLASS macro; r=Ehsan
☠☠ backed out by cc011478e0d0 ☠ ☠
authorAaron Klotz <aklotz@mozilla.com>
Mon, 29 Jul 2019 19:38:37 +0000
changeset 485202 075b818a46fe76181c3f78a9817707230a53bf54
parent 485201 2c543b23980887779f8097ac0a0b4e45f603ea3d
child 485203 cc011478e0d0a618ea29d7fda2ef8e9427c14a86
push id91175
push useraklotz@mozilla.com
push dateMon, 29 Jul 2019 19:41:10 +0000
treeherderautoland@075b818a46fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1569681
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
mfbt/Attributes.h
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -571,16 +571,24 @@
  * MOZ_STATIC_CLASS: Applies to all classes. Any class with this annotation is
  *   expected to live in static memory, so it is a compile-time error to use
  *   it, or an array of such objects, as the type of a variable declaration, or
  *   as a temporary object, or as the type of a new expression (unless
  *   placement new is being used). If a member of another class uses this
  *   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
  *   a new expression (unless placement new is being used). If a member of
  *   another class uses this class, or if another class inherits from this
  *   class, then it is considered to be a stack class as well, although this
  *   attribute need not be provided in such cases.
  * MOZ_NONHEAP_CLASS: Applies to all classes. Any class with this annotation is
@@ -761,16 +769,19 @@
 #  if defined(MOZ_CLANG_PLUGIN) || defined(XGILL_PLUGIN)
 #    define MOZ_CAN_RUN_SCRIPT __attribute__((annotate("moz_can_run_script")))
 #    define MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION \
       __attribute__((annotate("moz_can_run_script")))
 #    define MOZ_CAN_RUN_SCRIPT_BOUNDARY \
       __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")))
 #    define MOZ_NON_TEMPORARY_CLASS \
       __attribute__((annotate("moz_non_temporary_class")))
 #    define MOZ_TEMPORARY_CLASS __attribute__((annotate("moz_temporary_class")))
 #    define MOZ_TRIVIAL_CTOR_DTOR \
       __attribute__((annotate("moz_trivial_ctor_dtor")))
@@ -831,16 +842,17 @@
 #      define MOZ_HEAP_ALLOCATOR __attribute__((annotate("moz_heap_allocator")))
 #    endif
 #  else
 #    define MOZ_CAN_RUN_SCRIPT                              /* nothing */
 #    define MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION               /* nothing */
 #    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 */
 #    define MOZ_NON_TEMPORARY_CLASS                         /* nothing */
 #    define MOZ_TEMPORARY_CLASS                             /* nothing */
 #    define MOZ_TRIVIAL_CTOR_DTOR                           /* nothing */
 #    define MOZ_ALLOW_TEMPORARY                             /* nothing */
 #    define MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS      /* nothing */