Skip to content

[libc++] Add CI job for testing macOS C++03 #75355

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
Dec 13, 2023

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Dec 13, 2023

It's not that I have much love for C++03, but we should ensure that it works. Some recent changes broke this configuration because slightly older Clang versions don't support attribute syntax in C++03 mode.

It's not that I have much love for C++03, but we should ensure that it
works. Some recent changes broke this configuration because slightly
older Clang versions don't support attribute syntax in C++03 mode.
@ldionne ldionne requested a review from a team as a code owner December 13, 2023 16:56
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 13, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2023

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

It's not that I have much love for C++03, but we should ensure that it works. Some recent changes broke this configuration because slightly older Clang versions don't support attribute syntax in C++03 mode.


Full diff: https://github.com/llvm/llvm-project/pull/75355.diff

5 Files Affected:

  • (modified) libcxx/include/deque (+20-10)
  • (modified) libcxx/include/string (+3-2)
  • (modified) libcxx/include/vector (+9-5)
  • (modified) libcxx/test/support/assert_macros.h (+1-1)
  • (modified) libcxx/utils/ci/buildkite-pipeline.yml (+5)
diff --git a/libcxx/include/deque b/libcxx/include/deque
index b5d094dc415ddf..d45793c502a9a7 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -967,12 +967,18 @@ public:
 // For more details, see the "Using libc++" documentation page or
 // the documentation for __sanitizer_annotate_contiguous_container.
     _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
-       [[__maybe_unused__]] const void* __beg,
-       [[__maybe_unused__]] const void* __end,
-       [[__maybe_unused__]] const void* __old_con_beg,
-       [[__maybe_unused__]] const void* __old_con_end,
-       [[__maybe_unused__]] const void* __new_con_beg,
-       [[__maybe_unused__]] const void* __new_con_end) const {
+        const void* __beg,
+        const void* __end,
+        const void* __old_con_beg,
+        const void* __old_con_end,
+        const void* __new_con_beg,
+        const void* __new_con_end) const {
+        (void)__beg;
+        (void)__end;
+        (void)__old_con_beg;
+        (void)__old_con_end;
+        (void)__new_con_beg;
+        (void)__new_con_end;
 #ifndef _LIBCPP_HAS_NO_ASAN
         if (__beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
             __sanitizer_annotate_double_ended_contiguous_container(
@@ -982,10 +988,14 @@ public:
 
     _LIBCPP_HIDE_FROM_ABI
     void __annotate_from_to(
-            [[__maybe_unused__]] size_type __beg,
-            [[__maybe_unused__]] size_type __end,
-            [[__maybe_unused__]] __asan_annotation_type __annotation_type,
-            [[__maybe_unused__]] __asan_annotation_place __place) const _NOEXCEPT {
+            size_type __beg,
+            size_type __end,
+            __asan_annotation_type __annotation_type,
+            __asan_annotation_place __place) const _NOEXCEPT {
+        (void)__beg;
+        (void)__end;
+        (void)__annotation_type;
+        (void)__place;
 #ifndef _LIBCPP_HAS_NO_ASAN
         // __beg - index of the first item to annotate
         // __end - index behind the last item to annotate (so last item + 1)
diff --git a/libcxx/include/string b/libcxx/include/string
index 80ccf442ce69df..5bb4e941af36f7 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1917,8 +1917,9 @@ private:
         {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
 
     // The following functions are no-ops outside of AddressSanitizer mode.
-    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_contiguous_container(
-        [[__maybe_unused__]] const void* __old_mid, [[__maybe_unused__]] const void* __new_mid) const {
+    _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
+        (void)__old_mid;
+        (void)__new_mid;
 #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
         const void* __begin = data();
         const void* __end = data() + capacity() + 1;
diff --git a/libcxx/include/vector b/libcxx/include/vector
index fd2d5e11f0ea4e..d010a1f6ec9f91 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -852,11 +852,15 @@ private:
     // the documentation for __sanitizer_annotate_contiguous_container.
 
     _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-    void __annotate_contiguous_container([[__maybe_unused__]] const void *__beg,
-                                         [[__maybe_unused__]] const void *__end,
-                                         [[__maybe_unused__]] const void *__old_mid,
-                                         [[__maybe_unused__]] const void *__new_mid) const
-    {
+    void __annotate_contiguous_container(const void *__beg,
+                                         const void *__end,
+                                         const void *__old_mid,
+                                         const void *__new_mid) const
+    {
+      (void)__beg;
+      (void)__end;
+      (void)__old_mid;
+      (void)__new_mid;
 #ifndef _LIBCPP_HAS_NO_ASAN
       if (!__libcpp_is_constant_evaluated() && __beg != nullptr && __asan_annotate_container_with_allocator<_Allocator>::value)
         __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
diff --git a/libcxx/test/support/assert_macros.h b/libcxx/test/support/assert_macros.h
index b7011794025bf0..1059823dcb2465 100644
--- a/libcxx/test/support/assert_macros.h
+++ b/libcxx/test/support/assert_macros.h
@@ -50,7 +50,7 @@ void test_log(const char* condition, const char* file, int line, const F& functo
 }
 
 template <class Arg>
-[[noreturn]] void test_fail(const char* file, int line, const Arg& arg) {
+TEST_NORETURN void test_fail(const char* file, int line, const Arg& arg) {
   test_log("", file, line, arg);
   std::abort();
 }
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 51b9999026247f..3beb19d9df8f0f 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -156,6 +156,11 @@ steps:
     <<: *mac_agent_any_arch
     <<: *common
 
+  - label: MacOS with C++03
+    command: libcxx/utils/ci/run-buildbot generic-cxx03
+    <<: *mac_agent_any_arch
+    <<: *common
+
     # Build with the configuration we use to generate libc++.dylib on Apple platforms
   - label: Apple system
     command: libcxx/utils/ci/run-buildbot apple-system

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit surprised this got merged. I mentioned that this won't work until the next release on discord. (And apparently we have to wait until the next AppleClang update too)

LGTM.

@ldionne ldionne merged commit f0d4811 into llvm:main Dec 13, 2023
@ldionne ldionne deleted the review/macos-ci-cxx03 branch December 13, 2023 23:05
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.

3 participants