diff --git a/CMakeLists.txt b/CMakeLists.txt index 64c6c31c4..d0ed9df5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,10 +322,19 @@ add_compile_flags_if_supported(-nostdinc++) # Warning flags =============================================================== add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) add_compile_flags_if_supported( - -Wall -W -Wwrite-strings - -Wno-unused-parameter -Wno-long-long -Wno-user-defined-literals - -Wno-covered-switch-default + -Wall -Wextra -W -Wwrite-strings + -Wno-unused-parameter -Wno-long-long -Werror=return-type) +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + add_compile_flags_if_supported( + -Wno-user-defined-literals + -Wno-covered-switch-default) +elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + add_compile_flags_if_supported( + -Wno-attributes # FIXME: Fix -Wattribute warnings. + -Wno-literal-suffix + -Wno-c++14-compat) +endif() if (LIBCXX_ENABLE_WERROR) add_compile_flags_if_supported(-Werror) add_compile_flags_if_supported(-WX) diff --git a/include/__config b/include/__config index 353ca10e4..bd3f59a27 100644 --- a/include/__config +++ b/include/__config @@ -691,6 +691,12 @@ template struct __static_assert_check {}; #define _NOALIAS #endif +#ifdef __GNUC__ +#define _LIBCPP_MAY_ALIAS __attribute__((__may_alias__)) +#else +#define _LIBCPP_MAY_ALIAS +#endif + #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) # define _LIBCPP_EXPLICIT explicit #else diff --git a/include/__tuple b/include/__tuple index 6d978a2dc..caa427aa5 100644 --- a/include/__tuple +++ b/include/__tuple @@ -374,7 +374,7 @@ template struct __all_dummy; template -using __all = is_same<__all_dummy<_Pred...>, __all_dummy<(_Pred, true)...>>; +using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>; struct __tuple_sfinae_base { template