[libc++] Add a job running GCC with C++11

This configuration is interesting because GCC has a different level of
strictness for some C++ rules. In particular, it implements the older
standards more stringently than Clang, which can help find places where
we are non-conforming (especially in the test suite).

Differential Revision: https://reviews.llvm.org/D105936
This commit is contained in:
Louis Dionne 2021-07-15 09:46:36 -04:00
parent 766a08df12
commit 851a335b1e
13 changed files with 40 additions and 9 deletions

View File

@ -27,10 +27,11 @@ template <class T>
struct TestFn {
void operator()() const {
typedef std::atomic<T> A;
A t = T();
bool b1 = std::atomic_is_lock_free(static_cast<const A*>(&t));
volatile A vt = T();
bool b2 = std::atomic_is_lock_free(static_cast<const volatile A*>(&vt));
T t = T();
A a(t);
bool b1 = std::atomic_is_lock_free(static_cast<const A*>(&a));
volatile A va(t);
bool b2 = std::atomic_is_lock_free(static_cast<const volatile A*>(&va));
assert(b1 == b2);
}
};

View File

@ -19,6 +19,8 @@ public:
A(const A& a) : id_(a.id_) {++count;}
~A() {assert(id_ >= 0); id_ = -1; --count;}
A& operator=(const A& other) { id_ = other.id_; return *this; }
int id() const {return id_;}
static int count;

View File

@ -19,6 +19,8 @@ public:
A(const A& a) : id_(a.id_) {++count;}
virtual ~A() {assert(id_ >= 0); id_ = -1; --count;}
A& operator=(const A& other) { id_ = other.id_; return *this; }
static int count;
};

View File

@ -148,7 +148,10 @@ int main(int, char**)
#ifndef _LIBCPP_HAS_NO_STDIN
static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
#if TEST_STD_VER <= 11
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations" // disable the warning from the C library
static_assert((std::is_same<decltype(std::gets(cp)), char*>::value), "");
# pragma GCC diagnostic pop
#endif
static_assert((std::is_same<decltype(std::scanf(" ")), int>::value), "");
static_assert((std::is_same<decltype(std::vscanf(" ",va)), int>::value), "");

View File

@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: gcc-10, gcc-11
// GCC's __builtin_strlen isn't constexpr yet
// GCC's __builtin_strlen isn't constexpr yet
// XFAIL: (gcc-10 || gcc-11) && !(c++11 || c++14 || c++17)
// UNSUPPORTED: LIBCXX-DEBUG-FIXME
// <string_view>

View File

@ -36,7 +36,7 @@ int A::count = 0;
struct B : public A {
static int count;
B() { ++count; }
B(const B&) { ++count; }
B(const B& b) : A(b) { ++count; }
virtual ~B() { --count; }
};

View File

@ -139,7 +139,7 @@
# define TEST_NOEXCEPT_COND(...)
#endif
#if TEST_STD_VER >= 17
#if TEST_STD_VER >= 11
# define TEST_THROW_SPEC(...)
#else
# define TEST_THROW_SPEC(...) throw(__VA_ARGS__)

View File

@ -132,7 +132,7 @@ steps:
- exit_status: -1 # Agent was lost
limit: 2
- label: "GCC 11"
- label: "GCC 11 / C++latest"
command: "libcxx/utils/ci/run-buildbot generic-gcc"
artifact_paths:
- "**/test-results.xml"
@ -149,6 +149,18 @@ steps:
#
- wait
- label: "GCC 11 / C++11"
command: "libcxx/utils/ci/run-buildbot generic-gcc-cxx11"
artifact_paths:
- "**/test-results.xml"
agents:
queue: "libcxx-builders"
os: "linux"
retry:
automatic:
- exit_status: -1 # Agent was lost
limit: 2
- label: "Clang 11"
command: "libcxx/utils/ci/run-buildbot generic-clang-11"
artifact_paths:

View File

@ -278,6 +278,13 @@ generic-gcc)
generate-cmake
check-cxx-cxxabi
;;
generic-gcc-cxx11)
export CC=gcc-11
export CXX=g++-11
clean
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
check-cxx-cxxabi
;;
generic-asan)
clean
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"

View File

@ -13,6 +13,7 @@
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunreachable-code"
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated
#endif
struct A

View File

@ -15,6 +15,7 @@
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunreachable-code"
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated
#endif
struct A

View File

@ -15,6 +15,7 @@
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunreachable-code"
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated
#endif
struct A

View File

@ -15,6 +15,7 @@
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunreachable-code"
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated
#endif
struct A