Bug 1114696 - Add MOZ_STRONG_REF and MOZ_WEAK_REF annotations; r=froydnj

This commit is contained in:
Ehsan Akhgari 2014-12-22 18:16:55 -05:00
parent c6be95fe5c
commit a7cfb40a16

View File

@ -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 */
/*