mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987253 - Add MOZ_EXPLICIT_CONVERSION - r=Waldo
This commit is contained in:
parent
48114cd838
commit
34e9d4b886
@ -57,6 +57,9 @@
|
||||
# if __has_extension(cxx_constexpr)
|
||||
# define MOZ_HAVE_CXX11_CONSTEXPR
|
||||
# endif
|
||||
# if __has_extension(cxx_explicit_conversions)
|
||||
# define MOZ_HAVE_EXPLICIT_CONVERSION
|
||||
# endif
|
||||
# if __has_extension(cxx_deleted_functions)
|
||||
# define MOZ_HAVE_CXX11_DELETE
|
||||
# endif
|
||||
@ -79,6 +82,9 @@
|
||||
# if MOZ_GCC_VERSION_AT_LEAST(4, 6, 0)
|
||||
# define MOZ_HAVE_CXX11_CONSTEXPR
|
||||
# endif
|
||||
# if MOZ_GCC_VERSION_AT_LEAST(4, 5, 0)
|
||||
# define MOZ_HAVE_EXPLICIT_CONVERSION
|
||||
# endif
|
||||
# define MOZ_HAVE_CXX11_DELETE
|
||||
# else
|
||||
/* __final is a non-C++11 GCC synonym for 'final', per GCC r176655. */
|
||||
@ -101,6 +107,8 @@
|
||||
# define MOZ_HAVE_CXX11_OVERRIDE
|
||||
# define MOZ_HAVE_NEVER_INLINE __declspec(noinline)
|
||||
# define MOZ_HAVE_NORETURN __declspec(noreturn)
|
||||
// Staying away from explicit conversion operators in MSVC for now, see
|
||||
// http://stackoverflow.com/questions/20498142/visual-studio-2013-explicit-keyword-bug
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -121,6 +129,30 @@
|
||||
# define MOZ_CONSTEXPR_VAR const
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MOZ_EXPLICIT_CONVERSION is a specifier on a type conversion
|
||||
* overloaded operator that declares that a C++11 compiler should restrict
|
||||
* this operator to allow only explicit type conversions, disallowing
|
||||
* implicit conversions.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* template<typename T>
|
||||
* class Ptr
|
||||
* {
|
||||
* T* ptr;
|
||||
* MOZ_EXPLICIT_CONVERSION operator bool() const {
|
||||
* return ptr != nullptr;
|
||||
* }
|
||||
* };
|
||||
*
|
||||
*/
|
||||
#ifdef MOZ_HAVE_EXPLICIT_CONVERSION
|
||||
# define MOZ_EXPLICIT_CONVERSION explicit
|
||||
#else
|
||||
# define MOZ_EXPLICIT_CONVERSION /* no support */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MOZ_NEVER_INLINE is a macro which expands to tell the compiler that the
|
||||
* method decorated with it must never be inlined, even if the compiler would
|
||||
|
Loading…
Reference in New Issue
Block a user