Bug 1267550 (part 1) - Rename MOZ_MUST_USE as MOZ_MUST_USE_TYPE. r=ehsan.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 27 Apr 2016 08:22:10 +1000
changeset 295383 4fe5cc4663a37c77239fd9f3344d4816fa7c9ce6
parent 295382 71610f1f6b7c3cfd838d4df143f374a20bc7018e
child 295384 3d67e45f994a3ae1ae43479c32c2ed63bbf1a7c8
push id30223
push userkwierso@gmail.com
push dateFri, 29 Apr 2016 21:57:49 +0000
treeherdermozilla-central@2b7c421063ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1267550
milestone49.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 1267550 (part 1) - Rename MOZ_MUST_USE as MOZ_MUST_USE_TYPE. r=ehsan. This will allow MOZ_MUST_USE to be used for a different and more common case. MozReview-Commit-ID: 4dQsdWjJfc6
build/clang-plugin/clang-plugin.cpp
build/clang-plugin/tests/TestMultipleAnnotations.cpp
build/clang-plugin/tests/TestMustUse.cpp
image/DrawResult.h
mfbt/AlreadyAddRefed.h
mfbt/Attributes.h
--- a/build/clang-plugin/clang-plugin.cpp
+++ b/build/clang-plugin/clang-plugin.cpp
@@ -331,17 +331,17 @@ static CustomTypeAnnotation GlobalClass 
     CustomTypeAnnotation("moz_global_class", "global");
 static CustomTypeAnnotation NonHeapClass =
     CustomTypeAnnotation("moz_nonheap_class", "non-heap");
 static CustomTypeAnnotation HeapClass =
     CustomTypeAnnotation("moz_heap_class", "heap");
 static CustomTypeAnnotation NonTemporaryClass =
     CustomTypeAnnotation("moz_non_temporary_class", "non-temporary");
 static CustomTypeAnnotation MustUse =
-    CustomTypeAnnotation("moz_must_use", "must-use");
+    CustomTypeAnnotation("moz_must_use_type", "must-use");
 
 class MemMoveAnnotation final : public CustomTypeAnnotation {
 public:
   MemMoveAnnotation()
       : CustomTypeAnnotation("moz_non_memmovable", "non-memmove()able") {}
 
   virtual ~MemMoveAnnotation() {}
 
--- a/build/clang-plugin/tests/TestMultipleAnnotations.cpp
+++ b/build/clang-plugin/tests/TestMultipleAnnotations.cpp
@@ -1,12 +1,12 @@
-#define MOZ_MUST_USE __attribute__((annotate("moz_must_use")))
+#define MOZ_MUST_USE_TYPE __attribute__((annotate("moz_must_use_type")))
 #define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
 
-class MOZ_MUST_USE MOZ_STACK_CLASS TestClass {};
+class MOZ_MUST_USE_TYPE MOZ_STACK_CLASS TestClass {};
 
 TestClass foo; // expected-error {{variable of type 'TestClass' only valid on the stack}} expected-note {{value incorrectly allocated in a global variable}}
 
 TestClass f()
 {
   TestClass bar;
   return bar;
 }
--- a/build/clang-plugin/tests/TestMustUse.cpp
+++ b/build/clang-plugin/tests/TestMustUse.cpp
@@ -1,12 +1,12 @@
-#define MOZ_MUST_USE __attribute__((annotate("moz_must_use")))
+#define MOZ_MUST_USE_TYPE __attribute__((annotate("moz_must_use_type")))
 
 struct Temporary { ~Temporary(); };
-class MOZ_MUST_USE MustUse {};
+class MOZ_MUST_USE_TYPE MustUse {};
 class MayUse {};
 
 MustUse producesMustUse();
 MustUse *producesMustUsePointer();
 MustUse &producesMustUseRef();
 
 MustUse producesMustUse(const Temporary& t);
 MustUse *producesMustUsePointer(const Temporary& t);
--- a/image/DrawResult.h
+++ b/image/DrawResult.h
@@ -40,17 +40,17 @@ namespace image {
  * TEMPORARY_ERROR: We failed to draw due to a temporary error. Drawing may
  * succeed at a later time.
  *
  * BAD_IMAGE: We failed to draw because the image has an error. This is a
  * permanent condition.
  *
  * BAD_ARGS: We failed to draw because bad arguments were passed to draw().
  */
-enum class MOZ_MUST_USE DrawResult : uint8_t
+enum class MOZ_MUST_USE_TYPE DrawResult : uint8_t
 {
   SUCCESS,
   INCOMPLETE,
   WRONG_SIZE,
   NOT_READY,
   TEMPORARY_ERROR,
   BAD_IMAGE,
   BAD_ARGS
--- a/mfbt/AlreadyAddRefed.h
+++ b/mfbt/AlreadyAddRefed.h
@@ -24,17 +24,17 @@ struct unused_t;
  * you to assign in a pointer _without_ |AddRef|ing it.  You might want to use
  * this as a return type from a function that returns an already |AddRef|ed
  * pointer.
  *
  * TODO Move already_AddRefed to namespace mozilla.  This has not yet been done
  * because of the sheer number of usages of already_AddRefed.
  */
 template<class T>
-struct MOZ_MUST_USE MOZ_NON_AUTOABLE already_AddRefed
+struct MOZ_MUST_USE_TYPE MOZ_NON_AUTOABLE already_AddRefed
 {
   /*
    * We want to allow returning nullptr from functions returning
    * already_AddRefed<T>, for simplicity.  But we also don't want to allow
    * returning raw T*, instead preferring creation of already_AddRefed<T> from
    * a reference counting smart pointer.
    *
    * We address the latter requirement by making the (T*) constructor explicit.
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -503,35 +503,35 @@
  *
  *   Use of this annotation is discouraged when a strong reference or one of the above
  *   two annotations can be used instead.
  * MOZ_NO_ADDREF_RELEASE_ON_RETURN: Applies to function declarations.  Makes it
  *   a compile time error to call AddRef or Release on the return value of a
  *   function.  This is intended to be used with operator->() of our smart
  *   pointer classes to ensure that the refcount of an object wrapped in a
  *   smart pointer is not manipulated directly.
- * MOZ_MUST_USE: Applies to type declarations.  Makes it a compile time error to not
- *   use the return value of a function which has this type.  This is intended to be
- *   used with types which it is an error to not use.
+ * MOZ_MUST_USE_TYPE: Applies to type declarations.  Makes it a compile time
+ *   error to not use the return value of a function which has this type.  This
+ *   is intended to be used with types which it is an error to not use.
  * MOZ_NEEDS_NO_VTABLE_TYPE: Applies to template class declarations.  Makes it
  *   a compile time error to instantiate this template with a type parameter which
  *   has a VTable.
  * MOZ_NON_MEMMOVABLE: Applies to class declarations for types that are not safe
  *   to be moved in memory using memmove().
  * MOZ_NEEDS_MEMMOVABLE_TYPE: Applies to template class declarations where the
  *   template arguments are required to be safe to move in memory using
  *   memmove().  Passing MOZ_NON_MEMMOVABLE types to these templates is a
  *   compile time error.
  * MOZ_NEEDS_MEMMOVABLE_MEMBERS: Applies to class declarations where each member
  *   must be safe to move in memory using memmove().  MOZ_NON_MEMMOVABLE types
  *   used in members of these classes are compile time errors.
  * MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS: Applies to template class
  *   declarations where an instance of the template should be considered, for
  *   static analysis purposes, to inherit any type annotations (such as
- *   MOZ_MUST_USE and MOZ_STACK_CLASS) from its template arguments.
+ *   MOZ_MUST_USE_TYPE and MOZ_STACK_CLASS) from its template arguments.
  * MOZ_NON_AUTOABLE: Applies to class declarations. Makes it a compile time error to
  *   use `auto` in place of this type in variable declarations.  This is intended to
  *   be used with types which are intended to be implicitly constructed into other
  *   other types before being assigned to variables.
  */
 #ifdef MOZ_CLANG_PLUGIN
 #  define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
 #  define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
@@ -547,17 +547,17 @@
             MOZ_TRIVIAL_CTOR_DTOR
 #  endif
 #  define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
 #  define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT __attribute__((annotate("moz_no_arith_expr_in_arg")))
 #  define MOZ_OWNING_REF __attribute__((annotate("moz_strong_ref")))
 #  define MOZ_NON_OWNING_REF __attribute__((annotate("moz_weak_ref")))
 #  define MOZ_UNSAFE_REF(reason) __attribute__((annotate("moz_weak_ref")))
 #  define MOZ_NO_ADDREF_RELEASE_ON_RETURN __attribute__((annotate("moz_no_addref_release_on_return")))
-#  define MOZ_MUST_USE __attribute__((annotate("moz_must_use")))
+#  define MOZ_MUST_USE_TYPE __attribute__((annotate("moz_must_use_type")))
 #  define MOZ_NEEDS_NO_VTABLE_TYPE __attribute__((annotate("moz_needs_no_vtable_type")))
 #  define MOZ_NON_MEMMOVABLE __attribute__((annotate("moz_non_memmovable")))
 #  define MOZ_NEEDS_MEMMOVABLE_TYPE __attribute__((annotate("moz_needs_memmovable_type")))
 #  define MOZ_NEEDS_MEMMOVABLE_MEMBERS __attribute__((annotate("moz_needs_memmovable_members")))
 #  define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \
     __attribute__((annotate("moz_inherit_type_annotations_from_template_args")))
 #  define MOZ_NON_AUTOABLE __attribute__((annotate("moz_non_autoable")))
 /*
@@ -580,17 +580,17 @@
 #  define MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS /* nothing */
 #  define MOZ_IMPLICIT /* nothing */
 #  define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT /* nothing */
 #  define MOZ_HEAP_ALLOCATOR /* nothing */
 #  define MOZ_OWNING_REF /* nothing */
 #  define MOZ_NON_OWNING_REF /* nothing */
 #  define MOZ_UNSAFE_REF(reason) /* nothing */
 #  define MOZ_NO_ADDREF_RELEASE_ON_RETURN /* nothing */
-#  define MOZ_MUST_USE /* nothing */
+#  define MOZ_MUST_USE_TYPE /* nothing */
 #  define MOZ_NEEDS_NO_VTABLE_TYPE /* nothing */
 #  define MOZ_NON_MEMMOVABLE /* nothing */
 #  define MOZ_NEEDS_MEMMOVABLE_TYPE /* nothing */
 #  define MOZ_NEEDS_MEMMOVABLE_MEMBERS /* nothing */
 #  define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS /* nothing */
 #  define MOZ_NON_AUTOABLE /* nothing */
 #endif /* MOZ_CLANG_PLUGIN */