зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1187073 - Use MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS to validate the usage of AlignedStorage2. r=ehsan
--HG-- extra : rebase_source : 43caddb03d8bf630edd6f8f60f5dff0e8890e7b8
This commit is contained in:
Родитель
fd765fa5fa
Коммит
e0cec02548
|
@ -9,6 +9,7 @@
|
|||
#ifndef mozilla_Alignment_h
|
||||
#define mozilla_Alignment_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -122,7 +123,7 @@ struct AlignedStorage
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct AlignedStorage2
|
||||
struct MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS AlignedStorage2
|
||||
{
|
||||
union U
|
||||
{
|
||||
|
|
|
@ -463,6 +463,10 @@
|
|||
* 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_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.
|
||||
*/
|
||||
#ifdef MOZ_CLANG_PLUGIN
|
||||
# define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
|
||||
|
@ -486,6 +490,8 @@
|
|||
# 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_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \
|
||||
__attribute__((annotate("moz_inherit_type_annotations_from_template_args")))
|
||||
/*
|
||||
* 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
|
||||
|
@ -513,6 +519,7 @@
|
|||
# define MOZ_NEEDS_NO_VTABLE_TYPE /* nothing */
|
||||
# define MOZ_NON_MEMMOVABLE /* nothing */
|
||||
# define MOZ_NEEDS_MEMMOVABLE_TYPE /* nothing */
|
||||
# define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS /* nothing */
|
||||
#endif /* MOZ_CLANG_PLUGIN */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
Загрузка…
Ссылка в новой задаче