Fix new warnings emitted by GCC 7

llvm-svn: 302280
This commit is contained in:
Eric Fiselier 2017-05-05 20:32:26 +00:00
parent 81273c721c
commit 807790a09b
3 changed files with 14 additions and 7 deletions

View File

@ -1089,6 +1089,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_DIAGNOSE_ERROR(...)
#endif
#if __has_attribute(fallthough) || defined(_LIBCPP_COMPILER_GCC)
// Use a function like macro to imply that it must be followed by a semicolon
#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
#else
#define _LIBCPP_FALLTHROUGH() ((void)0)
#endif
#if defined(_LIBCPP_ABI_MICROSOFT) && \
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)

View File

@ -2825,7 +2825,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
return false;
}
}
// drop through
_LIBCPP_FALLTHROUGH();
case money_base::none:
if (__p != 3)
{

View File

@ -68,8 +68,8 @@ T&
make(A0 a0)
{
static typename aligned_storage<sizeof(T)>::type buf;
::new (&buf) T(a0);
return *reinterpret_cast<T*>(&buf);
auto *obj = ::new (&buf) T(a0);
return *obj;
}
template <class T, class A0, class A1>
@ -88,8 +88,8 @@ T&
make(A0 a0, A1 a1, A2 a2)
{
static typename aligned_storage<sizeof(T)>::type buf;
::new (&buf) T(a0, a1, a2);
return *reinterpret_cast<T*>(&buf);
auto *obj = ::new (&buf) T(a0, a1, a2);
return *obj;
}
template <typename T, size_t N>
@ -480,8 +480,8 @@ locale::__imp::make_global()
{
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
::new (&buf) locale(locale::classic());
return *reinterpret_cast<locale*>(&buf);
auto *obj = ::new (&buf) locale(locale::classic());
return *obj;
}
locale&