Bug 1123907 - Part 2: Add MOZ_NEEDS_NO_VTABLE_TYPE to Attributes.h, and use it to verify the EntryType argument of nsTHashtable; r=ehsan

This commit is contained in:
Michael Layzell 2015-06-19 19:37:43 -04:00 коммит произвёл Ehsan Akhgari
Родитель 91c1e847d6
Коммит 69cc6fcb31
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -454,6 +454,9 @@
* 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_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.
*/
#ifdef MOZ_CLANG_PLUGIN
# define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
@ -474,6 +477,7 @@
# 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_NEEDS_NO_VTABLE_TYPE __attribute__((annotate("moz_needs_no_vtable_type")))
/*
* 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
@ -498,6 +502,7 @@
# define MOZ_UNSAFE_REF(reason) /* nothing */
# define MOZ_NO_ADDREF_RELEASE_ON_RETURN /* nothing */
# define MOZ_MUST_USE /* nothing */
# define MOZ_NEEDS_NO_VTABLE_TYPE /* nothing */
#endif /* MOZ_CLANG_PLUGIN */
#endif /* __cplusplus */

Просмотреть файл

@ -16,6 +16,7 @@
#include "mozilla/Move.h"
#include "mozilla/fallible.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Attributes.h"
#include <new>
@ -82,7 +83,7 @@ enum PLDHashOperator
};
template<class EntryType>
class nsTHashtable
class MOZ_NEEDS_NO_VTABLE_TYPE nsTHashtable
{
typedef mozilla::fallible_t fallible_t;