Fix GCC unknown pragma warning in libc++.

We should check defined(__clang__) before the usage of the
clang diagnostic pragmas.

The [-Wswitch] warning in src/future.cpp should be ignored.
As the result, the equivalent GCC pragma is added.

llvm-svn: 197314
This commit is contained in:
Logan Chien 2013-12-14 06:45:09 +00:00
parent ca83921ddc
commit b0d5be563b
2 changed files with 17 additions and 0 deletions

View File

@ -26,8 +26,13 @@ __future_error_category::name() const _NOEXCEPT
return "future"; return "future";
} }
#if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch" #pragma clang diagnostic ignored "-Wswitch"
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch"
#endif
string string
__future_error_category::message(int ev) const __future_error_category::message(int ev) const
@ -50,7 +55,11 @@ __future_error_category::message(int ev) const
return string("unspecified future_errc value\n"); return string("unspecified future_errc value\n");
} }
#if defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
const error_category& const error_category&
future_category() _NOEXCEPT future_category() _NOEXCEPT

View File

@ -69,8 +69,10 @@ regex_error::~regex_error() throw() {}
namespace { namespace {
#if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded" #pragma clang diagnostic ignored "-Wpadded"
#endif
struct collationnames struct collationnames
{ {
@ -78,7 +80,9 @@ struct collationnames
char char_; char char_;
}; };
#if defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif
const collationnames collatenames[] = const collationnames collatenames[] =
{ {
@ -195,8 +199,10 @@ const collationnames collatenames[] =
{"zero", 0x30} {"zero", 0x30}
}; };
#if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded" #pragma clang diagnostic ignored "-Wpadded"
#endif
struct classnames struct classnames
{ {
@ -204,7 +210,9 @@ struct classnames
ctype_base::mask mask_; ctype_base::mask mask_;
}; };
#if defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif
const classnames ClassNames[] = const classnames ClassNames[] =
{ {