git: 20f8ce784b79 - main - www/firefox www/firefox-esr mail/thunderbird: fix build with libc++ 14

From: Christoph Moench-Tegeder <cmt_at_FreeBSD.org>
Date: Wed, 16 Mar 2022 19:48:09 UTC
The branch main has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=20f8ce784b79819cb29d1f70d8a4ebac15aabeb9

commit 20f8ce784b79819cb29d1f70d8a4ebac15aabeb9
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-03-16 19:43:55 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2022-03-16 19:47:21 +0000

    www/firefox www/firefox-esr mail/thunderbird: fix build with libc++ 14
    
    Mozilla attempts to redefine several internal libc++ functions, such as
    __throw_out_of_range(). With libc++ 14 and higher, this now leads to
    compile errors:
    
    In file included from /wrkdirs/usr/ports/www/firefox/work/.build/dist/system_wrappers/deque:3:
    /usr/include/c++/v1/deque:1865:9: error: call to '__throw_out_of_range' is ambiguous
            _VSTD::__throw_out_of_range("deque");
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/v1/__config:824:15: note: expanded from macro '_VSTD'
                  ^
    /wrkdirs/usr/ports/www/firefox/work/.build/dist/include/mozilla/throw_gcc.h:97:59: note: candidate function
    MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
                                                                  ^
    /usr/include/c++/v1/stdexcept:264:6: note: candidate function
    void __throw_out_of_range(const char*__msg)
         ^
    
    To work around this issue, avoid redefining those internal libc++
    functions, if _LIBCPP_VERSION is set.
---
 .../files/patch-memory_mozalloc_throw__gcc.h       | 69 ++++++++++++++++++++++
 .../files/patch-memory_mozalloc_throw__gcc.h       | 69 ++++++++++++++++++++++
 .../files/patch-memory_mozalloc_throw__gcc.h       | 69 ++++++++++++++++++++++
 3 files changed, 207 insertions(+)

diff --git a/mail/thunderbird/files/patch-memory_mozalloc_throw__gcc.h b/mail/thunderbird/files/patch-memory_mozalloc_throw__gcc.h
new file mode 100644
index 000000000000..788b9cbf837a
--- /dev/null
+++ b/mail/thunderbird/files/patch-memory_mozalloc_throw__gcc.h
@@ -0,0 +1,69 @@
+--- memory/mozalloc/throw_gcc.h.orig	2022-03-07 19:34:37 UTC
++++ memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+   mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure(
+     const char* msg) {
diff --git a/www/firefox-esr/files/patch-memory_mozalloc_throw__gcc.h b/www/firefox-esr/files/patch-memory_mozalloc_throw__gcc.h
new file mode 100644
index 000000000000..53db05bc0803
--- /dev/null
+++ b/www/firefox-esr/files/patch-memory_mozalloc_throw__gcc.h
@@ -0,0 +1,69 @@
+--- memory/mozalloc/throw_gcc.h.orig	2022-03-05 00:14:41 UTC
++++ memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+   mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure(
+     const char* msg) {
diff --git a/www/firefox/files/patch-memory_mozalloc_throw__gcc.h b/www/firefox/files/patch-memory_mozalloc_throw__gcc.h
new file mode 100644
index 000000000000..81a511179852
--- /dev/null
+++ b/www/firefox/files/patch-memory_mozalloc_throw__gcc.h
@@ -0,0 +1,69 @@
+--- memory/mozalloc/throw_gcc.h.orig	2022-02-02 17:33:38 UTC
++++ memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+   mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error(
+     const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+   mozalloc_abort(msg);
+ }
++#endif  // _LIBCPP_VERSION
+ 
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure(
+     const char* msg) {