Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//

// MSVC warning C4244: 'argument': conversion from 'const _Ty2' to 'T', possible loss of data
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4244

// <algorithm>

// UNSUPPORTED: c++03, c++11, c++14, c++17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
// equal(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2);

// We test the cartesian product, so we sometimes compare differently signed types
// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-sign-compare
// MSVC warning C4242: 'argument': conversion from 'int' to 'const _Ty', possible loss of data
// MSVC warning C4244: 'argument': conversion from 'wchar_t' to 'const _Ty', possible loss of data
// MSVC warning C4310: cast truncates constant value
// MSVC warning C4389: '==': signed/unsigned mismatch
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4242 /wd4244 /wd4310 /wd4389

#include <algorithm>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
//
//===----------------------------------------------------------------------===//

// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-sign-compare
// MSVC warning C4389: '==': signed/unsigned mismatch
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4389

// <algorithm>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17

// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-sign-compare
// MSVC warning C4242: 'argument': conversion from 'const _Ty' to 'ElementT', possible loss of data
// MSVC warning C4244: 'argument': conversion from 'const _Ty' to 'ElementT', possible loss of data
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4242 /wd4244

// template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
// requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//

// MSVC warning C4197: 'volatile std::atomic<operator_hijacker>': top-level volatile in cast is ignored
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4197

// UNSUPPORTED: c++03

// XFAIL: availability-synchronization_library-missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//

// MSVC warning C4197: 'volatile std::atomic<operator_hijacker *>': top-level volatile in cast is ignored
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4197

// UNSUPPORTED: c++03

// XFAIL: availability-synchronization_library-missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// is not trivially copyable, however Clang will sometimes emit additional
// errors while trying to instantiate the rest of std::atomic<T>.
// We silence those to make the test more robust.
// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error
// ADDITIONAL_COMPILE_FLAGS(verify-support): -Xclang -verify-ignore-unexpected=error

#include <atomic>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// We voluntarily use std::default_initializable on types that have redundant
// or ignored cv-qualifiers -- don't warn about it.
// ADDITIONAL_COMPILE_FLAGS: -Wno-ignored-qualifiers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-ignored-qualifiers

// template<class T>
// concept default_initializable = constructible_from<T> &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <map>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <map>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// template <size_t I, class T, size_t N> T& get(array<T, N>& a);

// Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify.
// ADDITIONAL_COMPILE_FLAGS: -Wno-array-bounds
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-array-bounds

#include <array>
#include <cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <unordered_map>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <unordered_map>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS: -Wno-missing-field-initializers
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-missing-field-initializers

// <set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// ADDITIONAL_COMPILE_FLAGS: -Wno-ctad-maybe-unsupported
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-ctad-maybe-unsupported

// <mdspan>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// MSVC warning C4244: 'initializing': conversion from '_Ty' to '_Ty', possible loss of data
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4244

// <mdspan>

// template<class OtherElementType, class OtherExtents,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// This test also generates spurious warnings when instantiating std::span
// with a very large extent (like size_t(-2)) -- silence those.
// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=warning
// ADDITIONAL_COMPILE_FLAGS(verify-support): -Xclang -verify-ignore-unexpected=warning

// <span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//

// MSVC warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4611

// test <setjmp.h>
//
// Even though <setjmp.h> is not provided by libc++, we still test that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// ADDITIONAL_COMPILE_FLAGS: -Wno-unused-value
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-unused-value

#include <limits>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//===----------------------------------------------------------------------===//

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT
// MSVC warning C4242: '+=': conversion from 'const _Ty' to 'size_t', possible loss of data
// MSVC warning C4244: 'argument': conversion from 'std::streamsize' to 'size_t', possible loss of data
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4242 /wd4244
// UNSUPPORTED: c++03

// <fstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//===----------------------------------------------------------------------===//

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT
// MSVC warning C4242: '+=': conversion from 'const _Ty' to 'size_t', possible loss of data
// MSVC warning C4244: 'argument': conversion from 'std::streamsize' to 'size_t', possible loss of data
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4242 /wd4244
// UNSUPPORTED: c++03

// <fstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//

// MSVC warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4611

// test <csetjmp>

#include <csetjmp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17

// This is a compile-only test, so "inline function is not defined" warnings are irrelevant.
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-undefined-inline

// template<input_range V, forward_range Pattern>
// requires view<V> && view<Pattern> &&
// indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//

// MSVC warning C4244: 'argument': conversion from '_Ty' to 'int', possible loss of data
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4244

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// template<class C, input_range R, class... Args> requires (!view<C>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// To silence a GCC warning-turned-error re. `BadAlloc::value_type`.
// ADDITIONAL_COMPILE_FLAGS: -Wno-unused-local-typedefs
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-unused-local-typedefs

// template<ranges::input_range R,
// class Allocator = allocator<ranges::range_value_t<R>>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{.+}}
// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx11.{{.+}}

// MSVC warning C4583: 'X::cv_': destructor is not implicitly called
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd4583

// This is a regression test for LWG3343.
//
// <condition_variable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// UNSUPPORTED: libcpp-has-no-experimental-stop_token
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: availability-synchronization_library-missing
// ADDITIONAL_COMPILE_FLAGS: -Wno-self-move
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-self-move

// jthread& operator=(jthread&&) noexcept;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// additional errors while trying to instantiate the rest of any_cast
// following the static_assert. We ignore unexpected errors in
// clang-verify to make the test more robust to changes in Clang.
// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error
// ADDITIONAL_COMPILE_FLAGS(verify-support): -Xclang -verify-ignore-unexpected=error

#include <any>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// additional errors while trying to instantiate the rest of any_cast
// following the static_assert. We ignore unexpected errors in
// clang-verify to make the test more robust to changes in Clang.
// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error
// ADDITIONAL_COMPILE_FLAGS(verify-support): -Xclang -verify-ignore-unexpected=error

#include <any>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
// UNSUPPORTED: c++03, c++11

// ignore deprecated volatile return types
// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated-volatile
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-deprecated-volatile
// MSVC warning C5216: 'volatile int' a volatile qualified return type is deprecated in C++20
// ADDITIONAL_COMPILE_FLAGS(msvc-cl-exe): /wd5216

#include <type_traits>
#include <utility>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// UNSUPPORTED: c++03

// Self assignment post-conditions are tested.
// ADDITIONAL_COMPILE_FLAGS: -Wno-self-move
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-self-move

// <memory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// We make sure that it is not ill-formed, however we still produce a warning for
// this one because explicit construction from a variant using CTAD is ambiguous
// (in the sense that the programer intent is not clear).
// ADDITIONAL_COMPILE_FLAGS: -Wno-ctad-maybe-unsupported
// ADDITIONAL_COMPILE_FLAGS(any-clang-or-gcc): -Wno-ctad-maybe-unsupported

#include <variant>

Expand Down
9 changes: 8 additions & 1 deletion libcxx/utils/libcxx/test/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
import subprocess
import sys

_isClang = lambda cfg: "__clang__" in compilerMacros(cfg) and "__apple_build_version__" not in compilerMacros(cfg)
_isAnyClangOrGCC = lambda cfg: "__clang__" in compilerMacros(
cfg
) or "__GNUC__" in compilerMacros(cfg)
_isClang = lambda cfg: "__clang__" in compilerMacros(
cfg
) and "__apple_build_version__" not in compilerMacros(cfg)
_isAppleClang = lambda cfg: "__apple_build_version__" in compilerMacros(cfg)
_isGCC = lambda cfg: "__GNUC__" in compilerMacros(cfg) and "__clang__" not in compilerMacros(cfg)
_isMSVC = lambda cfg: "_MSC_VER" in compilerMacros(cfg)
Expand Down Expand Up @@ -61,6 +66,8 @@ def _getAndroidDeviceApi(cfg):
# Lit features are evaluated in order. Some checks may require the compiler detection to have
# run first in order to work properly.
DEFAULT_FEATURES = [
# any-clang-or-gcc detects compilers that understand -Wno-meow flags, unlike MSVC's compiler driver cl.exe.
Feature(name="any-clang-or-gcc", when=_isAnyClangOrGCC),
Feature(name="apple-clang", when=_isAppleClang),
Feature(
name=lambda cfg: "apple-clang-{__clang_major__}".format(**compilerMacros(cfg)),
Expand Down