Skip to content

[libc++][NFC] Avoid opening namespace std in the tests #94160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

philnik777
Copy link
Contributor

This also adds a few FIXMEs where we use UB in the tests.

Copy link

github-actions bot commented Jun 2, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@StephanTLavavej
Copy link
Member

This will make it easier for MSVC's STL to consume the variant and optional tests, thank you! 😻

@philnik777 philnik777 marked this pull request as ready for review July 31, 2024 17:54
@philnik777 philnik777 requested a review from a team as a code owner July 31, 2024 17:54
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 31, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 31, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

This also adds a few FIXMEs where we use UB in the tests.


Patch is 66.27 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94160.diff

35 Files Affected:

  • (modified) libcxx/test/libcxx/utilities/any/allocator.pass.cpp (+48-50)
  • (modified) libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp (+10-14)
  • (modified) libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp (+219-230)
  • (modified) libcxx/test/std/concepts/concepts.lang/concept.commonref/common_reference.compile.pass.cpp (+12-16)
  • (modified) libcxx/test/std/containers/Emplaceable.h (+1-5)
  • (modified) libcxx/test/std/containers/NotConstructible.h (+1-6)
  • (modified) libcxx/test/std/containers/container.node/node_handle.pass.cpp (+2-4)
  • (modified) libcxx/test/std/containers/unord/unord.map/compare.pass.cpp (+4-7)
  • (modified) libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp (+4-5)
  • (modified) libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp (+4-5)
  • (modified) libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp (+2-6)
  • (modified) libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp (+2-6)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/ErrorCodeEnum.pass.cpp (+2-6)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.constructors/lwg3629.pass.cpp (+2-4)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/ErrorCodeEnum.pass.cpp (+2-6)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.modifiers/lwg3629.pass.cpp (+2-4)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.constructors/lwg3629.pass.cpp (+2-4)
  • (modified) libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.modifiers/lwg3629.pass.cpp (+2-4)
  • (modified) libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp (+2-3)
  • (modified) libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.readable/indirectly_readable.compile.pass.cpp (+14-14)
  • (modified) libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/user_defined_char_type.pass.cpp (+5-8)
  • (modified) libcxx/test/std/ranges/range.utility/range.subrange/ctor.range_size.pass.cpp (+2-4)
  • (modified) libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp (+1-3)
  • (modified) libcxx/test/std/time/rep.h (+4-4)
  • (modified) libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp (+1-6)
  • (modified) libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp (+1-6)
  • (modified) libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp (+3-7)
  • (modified) libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp (+16-19)
  • (modified) libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp (+1-5)
  • (modified) libcxx/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp (+2-3)
  • (modified) libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.pair_like.pass.cpp (+2-6)
  • (modified) libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp (+3-8)
  • (modified) libcxx/test/std/utilities/variant/variant.visit.member/visit.pass.cpp (+1)
  • (modified) libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp (+1)
  • (modified) libcxx/test/support/Counter.h (+1-4)
diff --git a/libcxx/test/libcxx/utilities/any/allocator.pass.cpp b/libcxx/test/libcxx/utilities/any/allocator.pass.cpp
index daaf74a2783fd..009a4ebed6353 100644
--- a/libcxx/test/libcxx/utilities/any/allocator.pass.cpp
+++ b/libcxx/test/libcxx/utilities/any/allocator.pass.cpp
@@ -39,61 +39,59 @@ bool Large_was_deallocated = false;
 bool Small_was_constructed = false;
 bool Small_was_destroyed = false;
 
-namespace std {
-  template <>
-  struct allocator<Large> {
-    using value_type = Large;
-    using size_type = std::size_t;
-    using difference_type = std::ptrdiff_t;
-    using propagate_on_container_move_assignment = std::true_type;
-    using is_always_equal = std::true_type;
-
-    Large* allocate(std::size_t n) {
-      Large_was_allocated = true;
-      return static_cast<Large*>(::operator new(n * sizeof(Large)));
-    }
+template <>
+struct std::allocator<Large> {
+  using value_type = Large;
+  using size_type = std::size_t;
+  using difference_type = std::ptrdiff_t;
+  using propagate_on_container_move_assignment = std::true_type;
+  using is_always_equal = std::true_type;
+
+  Large* allocate(std::size_t n) {
+    Large_was_allocated = true;
+    return static_cast<Large*>(::operator new(n * sizeof(Large)));
+  }
 
-    template <typename ...Args>
-    void construct(Large* p, Args&& ...args) {
-      new (p) Large(std::forward<Args>(args)...);
-      Large_was_constructed = true;
-    }
+  template <typename ...Args>
+  void construct(Large* p, Args&& ...args) {
+    new (p) Large(std::forward<Args>(args)...);
+    Large_was_constructed = true;
+  }
 
-    void destroy(Large* p) {
-      p->~Large();
-      Large_was_destroyed = true;
-    }
+  void destroy(Large* p) {
+    p->~Large();
+    Large_was_destroyed = true;
+  }
 
-    void deallocate(Large* p, std::size_t) {
-      Large_was_deallocated = true;
-      return ::operator delete(p);
-    }
-  };
-
-  template <>
-  struct allocator<Small> {
-    using value_type = Small;
-    using size_type = std::size_t;
-    using difference_type = std::ptrdiff_t;
-    using propagate_on_container_move_assignment = std::true_type;
-    using is_always_equal = std::true_type;
-
-    Small* allocate(std::size_t) { assert(false); return nullptr; }
-
-    template <typename ...Args>
-    void construct(Small* p, Args&& ...args) {
-      new (p) Small(std::forward<Args>(args)...);
-      Small_was_constructed = true;
-    }
+  void deallocate(Large* p, std::size_t) {
+    Large_was_deallocated = true;
+    return ::operator delete(p);
+  }
+};
+
+template <>
+struct std::allocator<Small> {
+  using value_type = Small;
+  using size_type = std::size_t;
+  using difference_type = std::ptrdiff_t;
+  using propagate_on_container_move_assignment = std::true_type;
+  using is_always_equal = std::true_type;
+
+  Small* allocate(std::size_t) { assert(false); return nullptr; }
+
+  template <typename ...Args>
+  void construct(Small* p, Args&& ...args) {
+    new (p) Small(std::forward<Args>(args)...);
+    Small_was_constructed = true;
+  }
 
-    void destroy(Small* p) {
-      p->~Small();
-      Small_was_destroyed = true;
-    }
+  void destroy(Small* p) {
+    p->~Small();
+    Small_was_destroyed = true;
+  }
 
-    void deallocate(Small*, std::size_t) { assert(false); }
-  };
-} // end namespace std
+  void deallocate(Small*, std::size_t) { assert(false); }
+};
 
 
 int main(int, char**) {
diff --git a/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp b/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp
index 5c100322fbcf3..9790aeff189e7 100644
--- a/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp
+++ b/libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp
@@ -61,26 +61,24 @@ struct valid {
   void insert(iterator, CharT*, CharT*);
 };
 
-namespace std::__format {
 template <>
-inline constexpr bool __enable_insertable<no_value_type<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_value_type<char>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_end<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_end<char>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_insert<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_insert<char>> = true;
 template <>
-inline constexpr bool __enable_insertable<valid<char>> = true;
+inline constexpr bool std::__format::__enable_insertable<valid<char>> = true;
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
 template <>
-inline constexpr bool __enable_insertable<no_value_type<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_value_type<wchar_t>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_end<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_end<wchar_t>> = true;
 template <>
-inline constexpr bool __enable_insertable<no_insert<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<no_insert<wchar_t>> = true;
 template <>
-inline constexpr bool __enable_insertable<valid<wchar_t>> = true;
+inline constexpr bool std::__format::__enable_insertable<valid<wchar_t>> = true;
 #endif
-} // namespace std::__format
 
 static_assert(!std::__format::__insertable<no_value_type<char>>);
 static_assert(!std::__format::__insertable<no_end<char>>);
@@ -95,12 +93,10 @@ static_assert(!std::__format::__insertable<no_specialization<wchar_t>>);
 static_assert(std::__format::__insertable<valid<wchar_t>>);
 #endif
 
-namespace std::__format {
 template <>
-inline constexpr bool __enable_insertable<valid<signed char>> = true;
+inline constexpr bool std::__format::__enable_insertable<valid<signed char>> = true;
 template <>
-inline constexpr bool __enable_insertable<valid<unsigned char>> = true;
-} // namespace std::__format
+inline constexpr bool std::__format::__enable_insertable<valid<unsigned char>> = true;
 
 static_assert(!std::__format::__insertable<valid<signed char>>);
 static_assert(!std::__format::__insertable<valid<unsigned char>>);
diff --git a/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp
index 5d80c1cba2655..91d060e37f098 100644
--- a/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.lang/concept.common/common_with.compile.pass.cpp
@@ -262,17 +262,16 @@ struct BadBasicCommonType {
   // should be placed so the test doesn't get deleted.
 };
 
-namespace std {
 template <>
-struct common_type<BadBasicCommonType, int> {
+struct std::common_type<BadBasicCommonType, int> {
   using type = BadBasicCommonType;
 };
 
 template <>
-struct common_type<int, BadBasicCommonType> {
+struct std::common_type<int, BadBasicCommonType> {
   using type = int;
 };
-} // namespace std
+
 static_assert(requires {
   typename std::common_type_t<BadBasicCommonType, int>;
 });
@@ -289,17 +288,16 @@ static_assert(!std::convertible_to<DullCommonType, int>);
 struct T1 {};
 static_assert(!std::convertible_to<DullCommonType, T1>);
 
-namespace std {
 template <>
-struct common_type<T1, int> {
+struct std::common_type<T1, int> {
   using type = DullCommonType;
 };
 
 template <>
-struct common_type<int, T1> {
+struct std::common_type<int, T1> {
   using type = DullCommonType;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T1, int>());
 static_assert(!CheckCommonWith<T1, int>());
 
@@ -314,17 +312,16 @@ struct T2 {};
 static_assert(
     !std::convertible_to<CommonTypeImplicitlyConstructibleFromInt, T2>);
 
-namespace std {
 template <>
-struct common_type<T2, int> {
+struct std::common_type<T2, int> {
   using type = CommonTypeImplicitlyConstructibleFromInt;
 };
 
 template <>
-struct common_type<int, T2> {
+struct std::common_type<int, T2> {
   using type = CommonTypeImplicitlyConstructibleFromInt;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T2, int>());
 static_assert(!CheckCommonWith<T2, int>());
 
@@ -339,17 +336,16 @@ struct T3 {};
 static_assert(
     !std::convertible_to<CommonTypeExplicitlyConstructibleFromInt, T2>);
 
-namespace std {
 template <>
-struct common_type<T3, int> {
+struct std::common_type<T3, int> {
   using type = CommonTypeExplicitlyConstructibleFromInt;
 };
 
 template <>
-struct common_type<int, T3> {
+struct std::common_type<int, T3> {
   using type = CommonTypeExplicitlyConstructibleFromInt;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T3, int>());
 static_assert(!CheckCommonWith<T3, int>());
 
@@ -361,17 +357,16 @@ static_assert(requires(T4 t4) {
   static_cast<CommonTypeImplicitlyConstructibleFromT4>(t4);
 });
 
-namespace std {
 template <>
-struct common_type<T4, int> {
+struct std::common_type<T4, int> {
   using type = CommonTypeImplicitlyConstructibleFromT4;
 };
 
 template <>
-struct common_type<int, T4> {
+struct std::common_type<int, T4> {
   using type = CommonTypeImplicitlyConstructibleFromT4;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T4, int>());
 static_assert(!CheckCommonWith<T4, int>());
 
@@ -383,17 +378,16 @@ static_assert(requires(T5 t5) {
   static_cast<CommonTypeExplicitlyConstructibleFromT5>(t5);
 });
 
-namespace std {
 template <>
-struct common_type<T5, int> {
+struct std::common_type<T5, int> {
   using type = CommonTypeExplicitlyConstructibleFromT5;
 };
 
 template <>
-struct common_type<int, T5> {
+struct std::common_type<int, T5> {
   using type = CommonTypeExplicitlyConstructibleFromT5;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T5, int>());
 static_assert(!CheckCommonWith<T5, int>());
 
@@ -403,113 +397,111 @@ struct CommonTypeNoCommonReference {
   CommonTypeNoCommonReference(int);
 };
 
-namespace std {
 template <>
-struct common_type<T6, int> {
+struct std::common_type<T6, int> {
   using type = CommonTypeNoCommonReference;
 };
 
 template <>
-struct common_type<int, T6> {
+struct std::common_type<int, T6> {
   using type = CommonTypeNoCommonReference;
 };
 
 template <>
-struct common_type<T6&, int&> {};
+struct std::common_type<T6&, int&> {};
 
 template <>
-struct common_type<int&, T6&> {};
+struct std::common_type<int&, T6&> {};
 
 template <>
-struct common_type<T6&, const int&> {};
+struct std::common_type<T6&, const int&> {};
 
 template <>
-struct common_type<int&, const T6&> {};
+struct std::common_type<int&, const T6&> {};
 
 template <>
-struct common_type<T6&, volatile int&> {};
+struct std::common_type<T6&, volatile int&> {};
 
 template <>
-struct common_type<int&, volatile T6&> {};
+struct std::common_type<int&, volatile T6&> {};
 
 template <>
-struct common_type<T6&, const volatile int&> {};
+struct std::common_type<T6&, const volatile int&> {};
 
 template <>
-struct common_type<int&, const volatile T6&> {};
+struct std::common_type<int&, const volatile T6&> {};
 
 template <>
-struct common_type<const T6&, int&> {};
+struct std::common_type<const T6&, int&> {};
 
 template <>
-struct common_type<const int&, T6&> {};
+struct std::common_type<const int&, T6&> {};
 
 template <>
-struct common_type<const T6&, const int&> {};
+struct std::common_type<const T6&, const int&> {};
 
 template <>
-struct common_type<const int&, const T6&> {};
+struct std::common_type<const int&, const T6&> {};
 
 template <>
-struct common_type<const T6&, volatile int&> {};
+struct std::common_type<const T6&, volatile int&> {};
 
 template <>
-struct common_type<const int&, volatile T6&> {};
+struct std::common_type<const int&, volatile T6&> {};
 
 template <>
-struct common_type<const T6&, const volatile int&> {};
+struct std::common_type<const T6&, const volatile int&> {};
 
 template <>
-struct common_type<const int&, const volatile T6&> {};
+struct std::common_type<const int&, const volatile T6&> {};
 
 template <>
-struct common_type<volatile T6&, int&> {};
+struct std::common_type<volatile T6&, int&> {};
 
 template <>
-struct common_type<volatile int&, T6&> {};
+struct std::common_type<volatile int&, T6&> {};
 
 template <>
-struct common_type<volatile T6&, const int&> {};
+struct std::common_type<volatile T6&, const int&> {};
 
 template <>
-struct common_type<volatile int&, const T6&> {};
+struct std::common_type<volatile int&, const T6&> {};
 
 template <>
-struct common_type<volatile T6&, volatile int&> {};
+struct std::common_type<volatile T6&, volatile int&> {};
 
 template <>
-struct common_type<volatile int&, volatile T6&> {};
+struct std::common_type<volatile int&, volatile T6&> {};
 
 template <>
-struct common_type<volatile T6&, const volatile int&> {};
+struct std::common_type<volatile T6&, const volatile int&> {};
 
 template <>
-struct common_type<volatile int&, const volatile T6&> {};
+struct std::common_type<volatile int&, const volatile T6&> {};
 
 template <>
-struct common_type<const volatile T6&, int&> {};
+struct std::common_type<const volatile T6&, int&> {};
 
 template <>
-struct common_type<const volatile int&, T6&> {};
+struct std::common_type<const volatile int&, T6&> {};
 
 template <>
-struct common_type<const volatile T6&, const int&> {};
+struct std::common_type<const volatile T6&, const int&> {};
 
 template <>
-struct common_type<const volatile int&, const T6&> {};
+struct std::common_type<const volatile int&, const T6&> {};
 
 template <>
-struct common_type<const volatile T6&, volatile int&> {};
+struct std::common_type<const volatile T6&, volatile int&> {};
 
 template <>
-struct common_type<const volatile int&, volatile T6&> {};
+struct std::common_type<const volatile int&, volatile T6&> {};
 
 template <>
-struct common_type<const volatile T6&, const volatile int&> {};
+struct std::common_type<const volatile T6&, const volatile int&> {};
 
 template <>
-struct common_type<const volatile int&, const volatile T6&> {};
-} // namespace std
+struct std::common_type<const volatile int&, const volatile T6&> {};
 
 template <typename T, typename U>
 constexpr bool HasCommonReference() noexcept {
@@ -526,177 +518,176 @@ struct CommonTypeNoMetaCommonReference {
   CommonTypeNoMetaCommonReference(int);
 };
 
-namespace std {
 template <>
-struct common_type<T7, int> {
+struct std::common_type<T7, int> {
   using type = CommonTypeNoMetaCommonReference;
 };
 
 template <>
-struct common_type<int, T7> {
+struct std::common_type<int, T7> {
   using type = CommonTypeNoMetaCommonReference;
 };
 
 template <>
-struct common_type<T7&, int&> {
+struct std::common_type<T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, T7&> {
+struct std::common_type<int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<T7&, const int&> {
+struct std::common_type<T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, const T7&> {
+struct std::common_type<int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<T7&, volatile int&> {
+struct std::common_type<T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, volatile T7&> {
+struct std::common_type<int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<T7&, const volatile int&> {
+struct std::common_type<T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<int&, const volatile T7&> {
+struct std::common_type<int&, const volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, int&> {
+struct std::common_type<const T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, T7&> {
+struct std::common_type<const int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, const int&> {
+struct std::common_type<const T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, const T7&> {
+struct std::common_type<const int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, volatile int&> {
+struct std::common_type<const T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, volatile T7&> {
+struct std::common_type<const int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const T7&, const volatile int&> {
+struct std::common_type<const T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const int&, const volatile T7&> {
+struct std::common_type<const int&, const volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, int&> {
+struct std::common_type<volatile T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, T7&> {
+struct std::common_type<volatile int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, const int&> {
+struct std::common_type<volatile T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, const T7&> {
+struct std::common_type<volatile int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, volatile int&> {
+struct std::common_type<volatile T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, volatile T7&> {
+struct std::common_type<volatile int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile T7&, const volatile int&> {
+struct std::common_type<volatile T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<volatile int&, const volatile T7&> {
+struct std::common_type<volatile int&, const volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, int&> {
+struct std::common_type<const volatile T7&, int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, T7&> {
+struct std::common_type<const volatile int&, T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, const int&> {
+struct std::common_type<const volatile T7&, const int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, const T7&> {
+struct std::common_type<const volatile int&, const T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, volatile int&> {
+struct std::common_type<const volatile T7&, volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, volatile T7&> {
+struct std::common_type<const volatile int&, volatile T7&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile T7&, const volatile int&> {
+struct std::common_type<const volatile T7&, const volatile int&> {
   using type = void;
 };
 
 template <>
-struct common_type<const volatile int&, const volatile T7&> {
+struct std::common_type<const volatile int&, const volatile T7&> {
   using type = void;
 };
-} // namespace std
+
 static_assert(HasValidCommonType<T7, int>());
 static_assert(HasValidCommonType<const T7&, const int&>());
 static_assert(HasCommonReference<const T7&, const int&>());
@@ -709,284 +700,282 @@ struct CommonWithInt {
   operator int() const volatile;
 };
 
-namespace std {
 template <>
-struct common_type<CommonWithInt, int> {
+struct std::common_type<CommonWithInt, int> {
   using type = int;
 };
 
 template <>
-struct common_type<int, CommonWithInt> : common_type<CommonWithInt, int> {};
+struct std::common_type<int, CommonWithInt> : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<CommonWithInt&, int&> : common_type<CommonWithInt, int> {};
+struct std::common_type<CommonWithInt&, int&> : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<int&, CommonWithInt&> : common_type<CommonWithInt, int> {};
+struct std::common_type<int&, CommonWithInt&> : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<CommonWithInt&, const int&>
-    : common_type<CommonWithInt, int> {};
+struct std::common_type<CommonWithInt&, const int&>
+    : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<int&, const CommonWithInt&>
-    : common_type<CommonWithInt, int> {};
+struct std::common_type<int&, const CommonWithInt&>
+    : std::common_type<CommonWithInt, int> {};
 
 template <>
-struct common_type<CommonWithInt&, volatile int&>
-    : common_type<CommonWithInt, ...
[truncated]

@philnik777 philnik777 force-pushed the avoid_opening_namespace_std branch from 9485846 to 8dd7ee6 Compare August 1, 2024 08:17
@philnik777 philnik777 force-pushed the avoid_opening_namespace_std branch from 8dd7ee6 to 8b24e40 Compare August 1, 2024 08:27
@philnik777 philnik777 merged commit 5dfdac7 into llvm:main Aug 1, 2024
9 of 11 checks passed
@philnik777 philnik777 deleted the avoid_opening_namespace_std branch August 1, 2024 08:57
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 1, 2024

LLVM Buildbot has detected a new failure on builder clang-hip-vega20 running on hip-vega20-0 while building libcxx at step 3 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/2989

Here is the relevant piece of the build log for the reference:

Step 3 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/hip-build.sh --jobs=' (failure)
...
[38/40] : && /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/clang++ -O3 -DNDEBUG  External/HIP/CMakeFiles/memmove-hip-6.0.2.dir/memmove.hip.o -o External/HIP/memmove-hip-6.0.2  --rocm-path=/buildbot/Externals/hip/rocm-6.0.2 --hip-link -rtlib=compiler-rt -unwindlib=libgcc -frtlib-add-rpath && cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP && /usr/local/bin/cmake -E create_symlink /buildbot/llvm-test-suite/External/HIP/memmove.reference_output /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/memmove.reference_output-hip-6.0.2
[39/40] /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/clang++ -DNDEBUG  -O3 -DNDEBUG   -w -Werror=date-time --rocm-path=/buildbot/Externals/hip/rocm-6.0.2 --offload-arch=gfx908 --offload-arch=gfx90a --offload-arch=gfx1030 --offload-arch=gfx1100 -xhip -mfma -MD -MT External/HIP/CMakeFiles/TheNextWeek-hip-6.0.2.dir/workload/ray-tracing/TheNextWeek/main.cc.o -MF External/HIP/CMakeFiles/TheNextWeek-hip-6.0.2.dir/workload/ray-tracing/TheNextWeek/main.cc.o.d -o External/HIP/CMakeFiles/TheNextWeek-hip-6.0.2.dir/workload/ray-tracing/TheNextWeek/main.cc.o -c /buildbot/llvm-test-suite/External/HIP/workload/ray-tracing/TheNextWeek/main.cc
[40/40] : && /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/clang++ -O3 -DNDEBUG  External/HIP/CMakeFiles/TheNextWeek-hip-6.0.2.dir/workload/ray-tracing/TheNextWeek/main.cc.o -o External/HIP/TheNextWeek-hip-6.0.2  --rocm-path=/buildbot/Externals/hip/rocm-6.0.2 --hip-link -rtlib=compiler-rt -unwindlib=libgcc -frtlib-add-rpath && cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP && /usr/local/bin/cmake -E create_symlink /buildbot/llvm-test-suite/External/HIP/TheNextWeek.reference_output /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/TheNextWeek.reference_output-hip-6.0.2
+ build_step 'Testing HIP test-suite'
+ echo '@@@BUILD_STEP Testing HIP test-suite@@@'
@@@BUILD_STEP Testing HIP test-suite@@@
+ ninja -v check-hip-simple
[0/1] cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP && /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/llvm-lit -sv empty-hip-6.0.2.test with-fopenmp-hip-6.0.2.test saxpy-hip-6.0.2.test memmove-hip-6.0.2.test InOneWeekend-hip-6.0.2.test TheNextWeek-hip-6.0.2.test blender.test
-- Testing: 7 tests, 7 workers --
Testing:  0.. 10.. 20.. 30.. 40
FAIL: test-suite :: External/HIP/InOneWeekend-hip-6.0.2.test (4 of 7)
******************** TEST 'test-suite :: External/HIP/InOneWeekend-hip-6.0.2.test' FAILED ********************

/buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/timeit-target --timeout 7200 --limit-core 0 --limit-cpu 7200 --limit-file-size 209715200 --limit-rss-size 838860800 --append-exitstatus --redirect-output /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.out --redirect-input /dev/null --summary /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.time /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/InOneWeekend-hip-6.0.2
cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP ; /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/fpcmp-target /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.out InOneWeekend.reference_output-hip-6.0.2

+ cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP
+ /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/fpcmp-target /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.out InOneWeekend.reference_output-hip-6.0.2
/buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/fpcmp-target: Comparison failed, textual difference between 'M' and 'i'

********************
/usr/bin/strip: /bin/bash.stripped: Bad file descriptor
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  test-suite :: External/HIP/InOneWeekend-hip-6.0.2.test


Testing Time: 375.73s

Total Discovered Tests: 7
  Passed: 6 (85.71%)
  Failed: 1 (14.29%)
FAILED: External/HIP/CMakeFiles/check-hip-simple-hip-6.0.2 
cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP && /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/llvm-lit -sv empty-hip-6.0.2.test with-fopenmp-hip-6.0.2.test saxpy-hip-6.0.2.test memmove-hip-6.0.2.test InOneWeekend-hip-6.0.2.test TheNextWeek-hip-6.0.2.test blender.test
ninja: build stopped: subcommand failed.
Step 12 (Testing HIP test-suite) failure: Testing HIP test-suite (failure)
@@@BUILD_STEP Testing HIP test-suite@@@
+ ninja -v check-hip-simple
[0/1] cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP && /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/llvm-lit -sv empty-hip-6.0.2.test with-fopenmp-hip-6.0.2.test saxpy-hip-6.0.2.test memmove-hip-6.0.2.test InOneWeekend-hip-6.0.2.test TheNextWeek-hip-6.0.2.test blender.test
-- Testing: 7 tests, 7 workers --
Testing:  0.. 10.. 20.. 30.. 40
FAIL: test-suite :: External/HIP/InOneWeekend-hip-6.0.2.test (4 of 7)
******************** TEST 'test-suite :: External/HIP/InOneWeekend-hip-6.0.2.test' FAILED ********************

/buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/timeit-target --timeout 7200 --limit-core 0 --limit-cpu 7200 --limit-file-size 209715200 --limit-rss-size 838860800 --append-exitstatus --redirect-output /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.out --redirect-input /dev/null --summary /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.time /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/InOneWeekend-hip-6.0.2
cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP ; /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/fpcmp-target /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.out InOneWeekend.reference_output-hip-6.0.2

+ cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP
+ /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/fpcmp-target /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP/Output/InOneWeekend-hip-6.0.2.test.out InOneWeekend.reference_output-hip-6.0.2
/buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/tools/fpcmp-target: Comparison failed, textual difference between 'M' and 'i'

********************
/usr/bin/strip: /bin/bash.stripped: Bad file descriptor
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  test-suite :: External/HIP/InOneWeekend-hip-6.0.2.test


Testing Time: 375.73s

Total Discovered Tests: 7
  Passed: 6 (85.71%)
  Failed: 1 (14.29%)
FAILED: External/HIP/CMakeFiles/check-hip-simple-hip-6.0.2 
cd /buildbot/hip-vega20-0/clang-hip-vega20/test-suite-build/External/HIP && /buildbot/hip-vega20-0/clang-hip-vega20/llvm/bin/llvm-lit -sv empty-hip-6.0.2.test with-fopenmp-hip-6.0.2.test saxpy-hip-6.0.2.test memmove-hip-6.0.2.test InOneWeekend-hip-6.0.2.test TheNextWeek-hip-6.0.2.test blender.test
ninja: build stopped: subcommand failed.
program finished with exit code 1
elapsedTime=489.140569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants