git: 46c59ea9b617 - main - Redo libc++ customizations

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 06 Apr 2024 20:18:12 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=46c59ea9b61755455ff6bf9f3e7b834e1af634ea

commit 46c59ea9b61755455ff6bf9f3e7b834e1af634ea
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-01-14 13:20:42 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-04-06 20:13:43 +0000

    Redo libc++ customizations
    
    * Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
    * Instead, add direct major __FreeBSD__ check for using ::gets declaration
    * Mark EINTEGRITY values as FreeBSD customization
    * Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization
    
    PR:             276104
    MFC after:      1 month
---
 contrib/llvm-project/libcxx/include/__config              | 8 ++------
 contrib/llvm-project/libcxx/include/__system_error/errc.h | 4 ++--
 contrib/llvm-project/libcxx/include/cstdio                | 2 +-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config
index ce4cece198b1..9154be8d8577 100644
--- a/contrib/llvm-project/libcxx/include/__config
+++ b/contrib/llvm-project/libcxx/include/__config
@@ -486,10 +486,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
 #    include <features.h> // for __NATIVE_ASCII_F
 #  endif
 
-#  ifdef __FreeBSD__
-#    include <osreldate.h> // for __FreeBSD_version
-#  endif
-
 #  ifndef __BYTE_ORDER__
 #    error                                                                                                             \
         "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"
@@ -734,8 +730,8 @@ typedef __char32_t char32_t;
 #      define _LIBCPP_TEMPLATE_VIS
 #    endif
 
-#    if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) \
-        && _LIBCPP_CLANG_VER >= 1500 // FreeBSD customization
+#    if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) && \
+        _LIBCPP_CLANG_VER >= 1500 // FreeBSD customization
 #      define _LIBCPP_TYPE_VISIBILITY_DEFAULT __attribute__((__type_visibility__("default")))
 #    else
 #      define _LIBCPP_TYPE_VISIBILITY_DEFAULT
diff --git a/contrib/llvm-project/libcxx/include/__system_error/errc.h b/contrib/llvm-project/libcxx/include/__system_error/errc.h
index a14ec56070c4..b0cdacc5ec1d 100644
--- a/contrib/llvm-project/libcxx/include/__system_error/errc.h
+++ b/contrib/llvm-project/libcxx/include/__system_error/errc.h
@@ -45,7 +45,7 @@ enum class errc
     identifier_removed,                 // EIDRM
     illegal_byte_sequence,              // EILSEQ
     inappropriate_io_control_operation, // ENOTTY
-    integrity_check_failed,             // EINTEGRITY
+    integrity_check_failed,             // EINTEGRITY // FreeBSD customization
     interrupted,                        // EINTR
     invalid_argument,                   // EINVAL
     invalid_seek,                       // ESPIPE
@@ -143,7 +143,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc){
     illegal_byte_sequence              = EILSEQ,
     inappropriate_io_control_operation = ENOTTY,
 #ifdef EINTEGRITY
-    integrity_check_failed             = EINTEGRITY,
+    integrity_check_failed             = EINTEGRITY, // FreeBSD customization
 #endif
     interrupted                        = EINTR,
     invalid_argument                   = EINVAL,
diff --git a/contrib/llvm-project/libcxx/include/cstdio b/contrib/llvm-project/libcxx/include/cstdio
index 0a867cec1a38..383655036d5f 100644
--- a/contrib/llvm-project/libcxx/include/cstdio
+++ b/contrib/llvm-project/libcxx/include/cstdio
@@ -159,7 +159,7 @@ using ::tmpfile _LIBCPP_USING_IF_EXISTS;
 using ::tmpnam _LIBCPP_USING_IF_EXISTS;
 
 using ::getchar _LIBCPP_USING_IF_EXISTS;
-#if _LIBCPP_STD_VER <= 11
+#if _LIBCPP_STD_VER <= 11 && !(defined(__FreeBSD__) && __FreeBSD__ >= 13) // FreeBSD customization
 using ::gets _LIBCPP_USING_IF_EXISTS;
 #endif
 using ::scanf _LIBCPP_USING_IF_EXISTS;