Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 8745665 Details for
Bug 1267550
[patch]
(part 1) - Rename MOZ_MUST_USE as MOZ_MUST_USE_TYPE
MOZ_MUST_USE_TYPE (text/plain), 9.08 KB, created by
Nicholas Nethercote [inactive]
(
hide
)
Description:
(part 1) - Rename MOZ_MUST_USE as MOZ_MUST_USE_TYPE
Filename:
MIME Type:
Creator:
Nicholas Nethercote [inactive]
Size:
9.08 KB
patch
obsolete
># HG changeset patch ># User Nicholas Nethercote <nnethercote@mozilla.com> ># Date 1461709330 -36000 ># Wed Apr 27 08:22:10 2016 +1000 ># Node ID 8ffad27d38cd84667f2a861f0c23ba3259c9d1e0 ># Parent 9991c6510b86ef39d21009faa37c51a3f37e623d >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. > >diff --git a/build/clang-plugin/clang-plugin.cpp b/build/clang-plugin/clang-plugin.cpp >--- 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() {} > >diff --git a/build/clang-plugin/tests/TestMultipleAnnotations.cpp b/build/clang-plugin/tests/TestMultipleAnnotations.cpp >--- 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; > } >diff --git a/build/clang-plugin/tests/TestMustUse.cpp b/build/clang-plugin/tests/TestMustUse.cpp >--- 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); >diff --git a/image/DrawResult.h b/image/DrawResult.h >--- 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 >diff --git a/mfbt/AlreadyAddRefed.h b/mfbt/AlreadyAddRefed.h >--- 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. >diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h >--- 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 */ >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
ehsan.akhgari
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 1267550
:
8745197
| 8745665 |
8745843