From a7cfb40a169d40c593cf13c7a5d400d012c7efab Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 22 Dec 2014 18:16:55 -0500 Subject: [PATCH] Bug 1114696 - Add MOZ_STRONG_REF and MOZ_WEAK_REF annotations; r=froydnj --- mfbt/Attributes.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h index f1af5a810a7..f504d62ed35 100644 --- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -512,6 +512,14 @@ * conversions. * MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT: Applies to functions. Makes it a compile * time error to pass arithmetic expressions on variables to the function. + * MOZ_STRONG_REF: Applies to declarations of pointer types. This attribute + * tells the compiler that the raw pointer is a strong reference, and that + * property is somehow enforced by the code. This can make the compiler + * ignore these pointers when validating the usage of pointers otherwise. + * MOZ_WEAK_REF: Applies to declarations of pointer types. This attribute + * tells the compiler that the raw pointer is a weak reference, and that + * property is somehow enforced by the code. This can make the compiler + * ignore these pointers when validating the usage of pointers otherwise. */ #ifdef MOZ_CLANG_PLUGIN # define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override"))) @@ -527,6 +535,8 @@ # 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_STRONG_REF __attribute__((annotate("moz_strong_ref"))) +# define MOZ_WEAK_REF __attribute__((annotate("moz_weak_ref"))) /* * It turns out that clang doesn't like void func() __attribute__ {} without a * warning, so use pragmas to disable the warning. This code won't work on GCC @@ -546,6 +556,8 @@ # define MOZ_IMPLICIT /* nothing */ # define MOZ_NO_ARITHMETIC_EXPR_IN_ARGUMENT /* nothing */ # define MOZ_HEAP_ALLOCATOR /* nothing */ +# define MOZ_STRONG_REF /* nothing */ +# define MOZ_WEAK_REF /* nothing */ #endif /* MOZ_CLANG_PLUGIN */ /*