From 73169b686304ed93a766f59536ff7042e0d06d39 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 13 Oct 2023 23:07:22 +0200 Subject: Issue #2281 - Replace std::iterator inheritance with iterator traits definitions (as required by C++17). --- js/src/jsapi.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 951b612502..19a0b805d2 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -5570,10 +5570,17 @@ class JS_PUBLIC_API(JSErrorNotes) // Create a deep copy of notes. js::UniquePtr copy(JSContext* cx); - class iterator : public std::iterator> - { + class iterator + { + private: js::UniquePtr* note_; - public: + public: + using iterator_category = std::input_iterator_tag; + using value_type = js::UniquePtr; + using difference_type = ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; + explicit iterator(js::UniquePtr* note = nullptr) : note_(note) {} -- cgit v1.2.3 From b886cfadff9f7f33e4b61232577950ca3b94d81a Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 13 Oct 2023 23:12:00 +0200 Subject: Issue #2281 - Mark mozalloc new() as noexcept to aligh with what the VC runtime expects. Currently spams warnings but may actually error out if not fixed, or result in undefined behaviour if mismatching signatures are treated as redeclarations with different exception specifications. --- memory/mozalloc/mozalloc.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index de8c549b31..8c224472c4 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -152,14 +152,11 @@ MFBT_API void* moz_xvalloc(size_t size) #if defined(_MSC_VER) /* - * Suppress build warning spam (bug 578546). + * Suppress build warning spam (issue #2281). */ -#define MOZALLOC_THROW_IF_HAS_EXCEPTIONS -#define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS +#define MOZALLOC_THROW_IF_HAS_EXCEPTIONS noexcept(true) +#define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS noexcept(false) #elif __cplusplus >= 201103 -/* - * C++11 has deprecated exception-specifications in favour of |noexcept|. - */ #define MOZALLOC_THROW_IF_HAS_EXCEPTIONS noexcept(true) #define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS noexcept(false) #else -- cgit v1.2.3 From 01c37ba21fddd39995f30e6e8842b7d1569c7c55 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 13 Oct 2023 23:12:37 +0200 Subject: Issue #2281 - The 'register' storage class is no longer a thing in c++17 --- gfx/angle/src/compiler/preprocessor/Tokenizer.cpp | 26 +++++++++++------------ gfx/angle/src/compiler/translator/glslang_lex.cpp | 26 +++++++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp b/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp index eb6156f475..4b50adc059 100755 --- a/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp +++ b/gfx/angle/src/compiler/preprocessor/Tokenizer.cpp @@ -823,9 +823,9 @@ extern int pplex \ */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; @@ -878,7 +878,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1336,9 +1336,9 @@ ECHO; static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1470,15 +1470,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1503,11 +1503,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; diff --git a/gfx/angle/src/compiler/translator/glslang_lex.cpp b/gfx/angle/src/compiler/translator/glslang_lex.cpp index 8ad7b1464d..4bda42eb9a 100755 --- a/gfx/angle/src/compiler/translator/glslang_lex.cpp +++ b/gfx/angle/src/compiler/translator/glslang_lex.cpp @@ -1286,9 +1286,9 @@ extern int yylex \ */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; @@ -1341,7 +1341,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -2237,9 +2237,9 @@ ECHO; static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -2371,15 +2371,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -2404,11 +2404,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; -- cgit v1.2.3 From 9074b8d943d41b4539c78f1183128e61aee5485c Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 15 Oct 2023 00:19:13 +0200 Subject: Issue #2281 - Build LZ4 as C instead of including it as C++. --- mfbt/Compression.cpp | 12 ++---------- mfbt/moz.build | 13 ++----------- mfbt/objs.mozbuild | 2 ++ 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/mfbt/Compression.cpp b/mfbt/Compression.cpp index 6147d0d611..8dc2ec3d86 100644 --- a/mfbt/Compression.cpp +++ b/mfbt/Compression.cpp @@ -11,17 +11,9 @@ // corecrt_memory.h. #include -using namespace mozilla::Compression; - -namespace { - -extern "C" { - -#include "lz4.c" +#include "lz4.h" -} - -}/* anonymous namespace */ +using namespace mozilla::Compression; /* Our wrappers */ diff --git a/mfbt/moz.build b/mfbt/moz.build index 54b13f21b9..e4b294292d 100644 --- a/mfbt/moz.build +++ b/mfbt/moz.build @@ -124,20 +124,11 @@ SOURCES += mfbt_nonunified_src_cppsrcs DISABLE_STL_WRAPPING = True -# Suppress warnings in third-party LZ4 code. -# TODO: Remove these suppressions after bug 993267 is fixed. - -if CONFIG['GNU_CXX']: - SOURCES['/mfbt/Compression.cpp'].flags += ['-Wno-unused-function'] - CXXFLAGS += ['-Wno-error=shadow'] - if CONFIG['CLANG_CXX']: # Suppress warnings from third-party V8 Decimal code. SOURCES['/mfbt/decimal/Decimal.cpp'].flags += ['-Wno-implicit-fallthrough'] -if CONFIG['_MSC_VER']: - # Error 4804 is "'>' : unsafe use of type 'bool' in operation" - SOURCES['/mfbt/Compression.cpp'].flags += ['-wd4804'] - if CONFIG['MOZ_NEEDS_LIBATOMIC']: OS_LIBS += ['atomic'] + +DEFINES['LZ4LIB_VISIBILITY'] = '' diff --git a/mfbt/objs.mozbuild b/mfbt/objs.mozbuild index 8aed3d179f..e8fd522d79 100644 --- a/mfbt/objs.mozbuild +++ b/mfbt/objs.mozbuild @@ -28,9 +28,11 @@ mfbt_src_cppsrcs = [ # Compression.cpp cannot be built in unified mode because it pulls in Windows system headers. # Decimal.cpp doesn't build in unified mode with gcc. +# We build lz4 in C mode mfbt_nonunified_src_lcppsrcs = [ 'Compression.cpp', 'decimal/Decimal.cpp', + 'lz4.c', ] mfbt_nonunified_src_cppsrcs = [ -- cgit v1.2.3 From 865d49bdc1a6e95012a93e593461a7128f602b20 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 15 Oct 2023 00:57:56 +0200 Subject: Issue #2281 - Avoid class-static constexpr in TypedArrayObject --- js/src/vm/TypedArrayObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index de7ce028eb..e6144c0ac4 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -372,7 +372,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject public: typedef NativeType ElementType; - static constexpr Scalar::Type ArrayTypeID() { return TypeIDOfType::id; } + static const Scalar::Type ArrayTypeID() { return TypeIDOfType::id; } static bool ArrayTypeIsUnsigned() { return TypeIsUnsigned(); } static bool ArrayTypeIsFloatingPoint() { return TypeIsFloatingPoint(); } -- cgit v1.2.3 From e29ae4e08ccce7f120f8ee88dd238bd2b4facbf4 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 15 Oct 2023 15:12:23 +0200 Subject: Issue #2281 - Default to C++17 when building. Configure the toolchain to default to C++17 language standard with optional gnu extensions (if on GCC) --- build/moz.configure/toolchain.configure | 19 +++++++++---------- build/moz.configure/warnings.configure | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index cc0540ea1c..40b87cf626 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -340,17 +340,16 @@ def check_compiler(compiler, language, target): if info.type in ('clang-cl', 'clang', 'gcc'): append_flag('-std=gnu99') - # Note: this is a strict version check because we used to always add - # -std=gnu++14. - cxx14_version = 201402 + cxx17_version = 201703 if info.language == 'C++': - if info.type in ('clang', 'gcc') and info.language_version != cxx14_version: - append_flag('-std=gnu++14') - # MSVC 2015 headers include C++14 features, but don't guard them - # with appropriate checks. - if info.type == 'clang-cl' and info.language_version != cxx14_version: - append_flag('-std=c++14') - # MSVC from 2015 on defaults to C++14. + if info.language_version != cxx17_version: + # Compiler doesn't default to C++17, so add the appropriate flag. + if info.type in ('clang', 'gcc'): + # We're on Clang or GCC, enable C++17 and add GNU extensions. + append_flag('-std=gnu++17') + else: + # We're on MSVC; enable C++17 language mode. + append_flag('-std:c++17') # We force clang-cl to emulate Visual C++ 2015 Update 3 with fallback to # cl.exe. diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index 2edf1748ad..0704f94a09 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -52,7 +52,7 @@ check_and_add_gcc_warning('-Wclass-varargs') check_and_add_gcc_warning('-Wloop-analysis') # catches C++ version forward-compat issues -check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler) +# check_and_add_gcc_warning('-Wc++2a-compat', cxx_compiler) # catches unintentional switch case fallthroughs check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler) -- cgit v1.2.3 From c87116b33267a8df388ca3652d211b7f8254a98d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 18 Oct 2023 14:35:59 +0200 Subject: Issue #2281 - Add some deduction guides for class template arguments. This is necessary if we want to start using Span() constructors instead of the MakeSpan() kludge. --- mfbt/Span.h | 9 +++++++++ xpcom/glue/nsTArray.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/mfbt/Span.h b/mfbt/Span.h index e71e068c60..fe679aa8bf 100644 --- a/mfbt/Span.h +++ b/mfbt/Span.h @@ -810,6 +810,15 @@ private: storage_type> storage_; }; +template +Span(T (&aArr)[Extent]) -> Span; + +template +Span(Container&) -> Span; + +template +Span(const Container&) -> Span; + // [Span.comparison], Span comparison operators template inline bool diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 03913a3765..47635de318 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -2466,6 +2466,12 @@ MakeSpan(const nsTArray_Impl& aTArray) return aTArray; } +template +Span(nsTArray_Impl&) -> Span; + +template +Span(const nsTArray_Impl&) -> Span; + } // namespace mozilla // Assert that AutoTArray doesn't have any extra padding inside. -- cgit v1.2.3 From a8a9d2cbd4cb3f3cee3c55ebe81d08a6f948a0c5 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 18 Oct 2023 14:40:16 +0200 Subject: Issue #2281 - Force clobber Without a clobber, mozconfigure doesn't properly pick up the /std:c++17 or -std=gnu++17 compiler switches needed to put them into C++17 mode. --- CLOBBER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLOBBER b/CLOBBER index 346b3dc7ee..0b54a80712 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Removal of SIMD.js and associated scalar types requires CLOBBER. (Issue #2307) +Switching to C++17 requires CLOBBER to pick up compiler conf. (Issue #2281) -- cgit v1.2.3 From 05abfd8200c56d52f74ca4ebdca4d1536d376fdd Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 4 Nov 2023 00:13:32 +0100 Subject: Issue #2281 - Remove the use of non-standard namespace std::tr1 in Google's WebRTC gtest code --- .../testing/gtest/include/gtest/gtest-printers.h | 39 +++++------ .../gtest/internal/gtest-param-util-generated.h | 75 +++++++++++----------- .../internal/gtest-param-util-generated.h.pump | 11 ++-- 3 files changed, 64 insertions(+), 61 deletions(-) diff --git a/media/webrtc/trunk/testing/gtest/include/gtest/gtest-printers.h b/media/webrtc/trunk/testing/gtest/include/gtest/gtest-printers.h index 0639d9f586..686e85f106 100644 --- a/media/webrtc/trunk/testing/gtest/include/gtest/gtest-printers.h +++ b/media/webrtc/trunk/testing/gtest/include/gtest/gtest-printers.h @@ -1,4 +1,5 @@ // Copyright 2007, Google Inc. +// Copyright 2023, Moonchild Productions // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -494,60 +495,60 @@ void PrintTupleTo(const T& t, ::std::ostream* os); // regardless of whether tr1::tuple is implemented using the // non-standard variadic template feature or not. -inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) { +inline void PrintTo(const ::std::tuple<>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, ::std::ostream* os) { +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } template -void PrintTo(const ::std::tr1::tuple& t, +void PrintTo(const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } @@ -555,7 +556,7 @@ void PrintTo(const ::std::tr1::tuple& t, template void PrintTo( - const ::std::tr1::tuple& t, + const ::std::tuple& t, ::std::ostream* os) { PrintTupleTo(t, os); } @@ -774,8 +775,8 @@ struct TuplePrefixPrinter { static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { TuplePrefixPrinter::PrintPrefixTo(t, os); *os << ", "; - UniversalPrinter::type> - ::Print(::std::tr1::get(t), os); + UniversalPrinter::type> + ::Print(::std::get(t), os); } // Tersely prints the first N fields of a tuple to a string vector, @@ -784,7 +785,7 @@ struct TuplePrefixPrinter { static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { TuplePrefixPrinter::TersePrintPrefixToStrings(t, strings); ::std::stringstream ss; - UniversalTersePrint(::std::tr1::get(t), &ss); + UniversalTersePrint(::std::get(t), &ss); strings->push_back(ss.str()); } }; @@ -807,14 +808,14 @@ template <> struct TuplePrefixPrinter<1> { template static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { - UniversalPrinter::type>:: - Print(::std::tr1::get<0>(t), os); + UniversalPrinter::type>:: + Print(::std::get<0>(t), os); } template static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { ::std::stringstream ss; - UniversalTersePrint(::std::tr1::get<0>(t), &ss); + UniversalTersePrint(::std::get<0>(t), &ss); strings->push_back(ss.str()); } }; @@ -824,7 +825,7 @@ struct TuplePrefixPrinter<1> { template void PrintTupleTo(const T& t, ::std::ostream* os) { *os << "("; - TuplePrefixPrinter< ::std::tr1::tuple_size::value>:: + TuplePrefixPrinter< ::std::tuple_size::value>:: PrintPrefixTo(t, os); *os << ")"; } @@ -835,7 +836,7 @@ void PrintTupleTo(const T& t, ::std::ostream* os) { template Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) { Strings result; - TuplePrefixPrinter< ::std::tr1::tuple_size::value>:: + TuplePrefixPrinter< ::std::tuple_size::value>:: TersePrintPrefixToStrings(value, &result); return result; } diff --git a/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h b/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h index e80548592c..fa8f6f0c3b 100644 --- a/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h +++ b/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h @@ -2,7 +2,8 @@ // pump.py gtest-param-util-generated.h.pump // DO NOT EDIT BY HAND!!! -// Copyright 2008 Google Inc. +// Copyright 2008, Google Inc. +// Copyright 2023, Moonchild Productions // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without @@ -3157,9 +3158,9 @@ class ValueArray50 { // template class CartesianProductGenerator2 - : public ParamGeneratorInterface< ::std::tr1::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator2(const ParamGenerator& g1, const ParamGenerator& g2) @@ -3272,9 +3273,9 @@ class CartesianProductGenerator2 template class CartesianProductGenerator3 - : public ParamGeneratorInterface< ::std::tr1::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator3(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3) @@ -3404,9 +3405,9 @@ class CartesianProductGenerator3 template class CartesianProductGenerator4 - : public ParamGeneratorInterface< ::std::tr1::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator4(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -3555,9 +3556,9 @@ class CartesianProductGenerator4 template class CartesianProductGenerator5 - : public ParamGeneratorInterface< ::std::tr1::tuple > { + : public ParamGeneratorInterface< ::std::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator5(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -3723,10 +3724,10 @@ class CartesianProductGenerator5 template class CartesianProductGenerator6 - : public ParamGeneratorInterface< ::std::tr1::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator6(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -3909,10 +3910,10 @@ class CartesianProductGenerator6 template class CartesianProductGenerator7 - : public ParamGeneratorInterface< ::std::tr1::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator7(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4112,10 +4113,10 @@ class CartesianProductGenerator7 template class CartesianProductGenerator8 - : public ParamGeneratorInterface< ::std::tr1::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator8(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4334,10 +4335,10 @@ class CartesianProductGenerator8 template class CartesianProductGenerator9 - : public ParamGeneratorInterface< ::std::tr1::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator9(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4573,10 +4574,10 @@ class CartesianProductGenerator9 template class CartesianProductGenerator10 - : public ParamGeneratorInterface< ::std::tr1::tuple > { public: - typedef ::std::tr1::tuple ParamType; + typedef ::std::tuple ParamType; CartesianProductGenerator10(const ParamGenerator& g1, const ParamGenerator& g2, const ParamGenerator& g3, @@ -4838,8 +4839,8 @@ class CartesianProductHolder2 { CartesianProductHolder2(const Generator1& g1, const Generator2& g2) : g1_(g1), g2_(g2) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator2( static_cast >(g1_), static_cast >(g2_))); @@ -4860,8 +4861,8 @@ CartesianProductHolder3(const Generator1& g1, const Generator2& g2, const Generator3& g3) : g1_(g1), g2_(g2), g3_(g3) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator3( static_cast >(g1_), static_cast >(g2_), @@ -4885,8 +4886,8 @@ CartesianProductHolder4(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator4( static_cast >(g1_), static_cast >(g2_), @@ -4912,8 +4913,8 @@ CartesianProductHolder5(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator5( static_cast >(g1_), static_cast >(g2_), @@ -4943,8 +4944,8 @@ CartesianProductHolder6(const Generator1& g1, const Generator2& g2, : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + operator ParamGenerator< ::std::tuple >() const { + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator6( static_cast >(g1_), static_cast >(g2_), @@ -4976,9 +4977,9 @@ CartesianProductHolder7(const Generator1& g1, const Generator2& g2, : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator7( static_cast >(g1_), static_cast >(g2_), @@ -5014,9 +5015,9 @@ CartesianProductHolder8(const Generator1& g1, const Generator2& g2, g8_(g8) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( + return ParamGenerator< ::std::tuple >( new CartesianProductGenerator8( static_cast >(g1_), static_cast >(g2_), @@ -5055,9 +5056,9 @@ CartesianProductHolder9(const Generator1& g1, const Generator2& g2, g9_(g9) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( new CartesianProductGenerator9( static_cast >(g1_), @@ -5099,9 +5100,9 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2, g9_(g9), g10_(g10) {} template - operator ParamGenerator< ::std::tr1::tuple >() const { - return ParamGenerator< ::std::tr1::tuple >( new CartesianProductGenerator10( diff --git a/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h.pump b/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h.pump index 009206fd31..864fbee16b 100644 --- a/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-param-util-generated.h.pump @@ -1,7 +1,8 @@ $$ -*- mode: c++; -*- $var n = 50 $$ Maximum length of Values arguments we want to support. $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. -// Copyright 2008 Google Inc. +// Copyright 2008, Google Inc. +// Copyright 2023, Moonchild Productions // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without @@ -128,9 +129,9 @@ $range k 2..i template <$for j, [[typename T$j]]> class CartesianProductGenerator$i - : public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > { + : public ParamGeneratorInterface< ::std::tuple<$for j, [[T$j]]> > { public: - typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType; + typedef ::std::tuple<$for j, [[T$j]]> ParamType; CartesianProductGenerator$i($for j, [[const ParamGenerator& g$j]]) : $for j, [[g$(j)_(g$j)]] {} @@ -269,8 +270,8 @@ class CartesianProductHolder$i { CartesianProductHolder$i($for j, [[const Generator$j& g$j]]) : $for j, [[g$(j)_(g$j)]] {} template <$for j, [[typename T$j]]> - operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const { - return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >( + operator ParamGenerator< ::std::tuple<$for j, [[T$j]]> >() const { + return ParamGenerator< ::std::tuple<$for j, [[T$j]]> >( new CartesianProductGenerator$i<$for j, [[T$j]]>( $for j,[[ -- cgit v1.2.3 From 087aa28bc7bc81e2b2aebafd1189f37ae1943d22 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 5 Nov 2023 20:05:27 +0100 Subject: Issue #2281 - Patch out google protobuf inheritance from std::iterator Updating Iterators to be compatible with C++17 The std::iterator class is being deprecated on MSVC++, and currently if the compilation flag /std:c++latest is used a warning is issued in this regard if any iterators use the class as a base class. If an external source file being compiled includes the repeated_field.h header, the iterator clases RepeatedPtrIterator and RepeatedPtrOverPtrsIterator trigger the warning. This change solves the warning and should avoid it in the future when the default is to remove the class. See https://github.com/protocolbuffers/protobuf/commit/2949ebd842e25c1bcb8b63b377a454a0887ea5a2 --- .../protobuf/src/google/protobuf/repeated_field.h | 41 +++++++--------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/toolkit/components/protobuf/src/google/protobuf/repeated_field.h b/toolkit/components/protobuf/src/google/protobuf/repeated_field.h index 50051831d6..29fe823360 100644 --- a/toolkit/components/protobuf/src/google/protobuf/repeated_field.h +++ b/toolkit/components/protobuf/src/google/protobuf/repeated_field.h @@ -1250,23 +1250,14 @@ namespace internal { // This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin // (jyasskin@google.com). template -class RepeatedPtrIterator - : public std::iterator< - std::random_access_iterator_tag, Element> { +class RepeatedPtrIterator { public: typedef RepeatedPtrIterator iterator; - typedef std::iterator< - std::random_access_iterator_tag, Element> superclass; - - // Shadow the value_type in std::iterator<> because const_iterator::value_type - // needs to be T, not const T. - typedef typename remove_const::type value_type; - - // Let the compiler know that these are type names, so we don't have to - // write "typename" in front of them everywhere. - typedef typename superclass::reference reference; - typedef typename superclass::pointer pointer; - typedef typename superclass::difference_type difference_type; + typedef std::random_access_iterator_tag iterator_category; + typedef Element value_type; + typedef std::ptrdiff_t difference_type; + typedef Element* pointer; + typedef Element& reference; RepeatedPtrIterator() : it_(NULL) {} explicit RepeatedPtrIterator(void* const* it) : it_(it) {} @@ -1346,22 +1337,14 @@ class RepeatedPtrIterator // referenced by the iterator. It should either be "void *" for a mutable // iterator, or "const void *" for a constant iterator. template -class RepeatedPtrOverPtrsIterator - : public std::iterator { +class RepeatedPtrOverPtrsIterator { public: typedef RepeatedPtrOverPtrsIterator iterator; - typedef std::iterator< - std::random_access_iterator_tag, Element*> superclass; - - // Shadow the value_type in std::iterator<> because const_iterator::value_type - // needs to be T, not const T. - typedef typename remove_const::type value_type; - - // Let the compiler know that these are type names, so we don't have to - // write "typename" in front of them everywhere. - typedef typename superclass::reference reference; - typedef typename superclass::pointer pointer; - typedef typename superclass::difference_type difference_type; + typedef std::random_access_iterator_tag iterator_category; + typedef Element value_type; + typedef std::ptrdiff_t difference_type; + typedef Element* pointer; + typedef Element& reference; RepeatedPtrOverPtrsIterator() : it_(NULL) {} explicit RepeatedPtrOverPtrsIterator(VoidPtr* it) : it_(it) {} -- cgit v1.2.3 From e6f9b299513446b6b6b80d172db8e72772704ffa Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 7 Nov 2023 19:54:01 +0100 Subject: Issue #2281 - Exclude throw wrapping on modern libcpp. As discussed. --- memory/mozalloc/throw_gcc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/memory/mozalloc/throw_gcc.h b/memory/mozalloc/throw_gcc.h index c51794573e..3c61939eba 100644 --- a/memory/mozalloc/throw_gcc.h +++ b/memory/mozalloc/throw_gcc.h @@ -6,6 +6,9 @@ #ifndef mozilla_throw_gcc_h #define mozilla_throw_gcc_h +// Wrapping shouldn't be needed on libcpp 14+ +#if !defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 14000 + #include "mozilla/Attributes.h" #include // snprintf @@ -140,4 +143,6 @@ __throw_system_error(int err) #undef MOZ_THROW_NORETURN +#endif // !_LIBCPP_VERSION || _LIBCPP_VERSION < 14000 + #endif // mozilla_throw_gcc_h -- cgit v1.2.3