WebKit Bugzilla
Attachment 342742 Details for
Bug 186615
: Activate -Wexit-time-destructors -and Wglobal-constructors in libwebrtc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186615-20180614105028.patch (text/plain), 12.23 KB, created by
youenn fablet
on 2018-06-14 10:50:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-06-14 10:50:28 PDT
Size:
12.23 KB
patch
obsolete
>Subversion Revision: 232840 >diff --git a/Source/ThirdParty/libwebrtc/ChangeLog b/Source/ThirdParty/libwebrtc/ChangeLog >index a656b0754484de2f0776e7495abe2f87497d86cc..7016871bf077cec7c74e4dda7e44a5c502ecf23a 100644 >--- a/Source/ThirdParty/libwebrtc/ChangeLog >+++ b/Source/ThirdParty/libwebrtc/ChangeLog >@@ -1,3 +1,26 @@ >+2018-06-14 Youenn Fablet <youenn@apple.com> >+ >+ Activate -Wexit-time-destructors -and Wglobal-constructors in libwebrtc >+ https://bugs.webkit.org/show_bug.cgi?id=186615 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update xcconfig files to activate these compile flags. >+ Update libwebrtc code base to accomodate these flags. >+ >+ * Configurations/libwebrtc.xcconfig: >+ * Configurations/opus.xcconfig: >+ * Configurations/usrsctp.xcconfig: >+ * Source/webrtc/modules/audio_processing/beamformer/array_util.h: >+ (webrtc::DegreesToRadians): Make function constexpr. >+ * Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc: >+ Make sure the destructor is never called. >+ * Source/webrtc/rtc_base/logging.cc: >+ Update code to move streams_ from a static class member to a regular static function variable. >+ * Source/webrtc/rtc_base/logging.h: >+ * Source/webrtc/system_wrappers/source/clock.cc: >+ Make sure the destructor is never called. >+ > 2018-06-14 Youenn Fablet <youenn@apple.com> > > Eliminate static initializers in libwebrtc.dylib >diff --git a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig >index d8cf487e91246b2e42b0cdadbe5f1bb00370f4c5..c14a46cb8041d403b3a383233bfe2c48bab0dadc 100644 >--- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig >+++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig >@@ -23,7 +23,7 @@ HEADER_SEARCH_PATHS = Source Source/third_party/jsoncpp/source/include Source/th > PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc; > USE_HEADERMAP = NO; > INSTALLHDRS_SCRIPT_PHASE = YES; >-WARNING_CFLAGS = -Wno-deprecated-declarations; >+WARNING_CFLAGS = -Wno-deprecated-declarations $(inherited); > > // FIXME: Set WEBRTC_USE_BUILTIN_ISAC_FIX and WEBRTC_USE_BUILTIN_ISAC_FLOAT for iOS and Mac > GCC_PREPROCESSOR_DEFINITIONS = GTEST_RELATIVE_PATH WEBRTC_OPUS_SUPPORT_120MS_PTIME=0 WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED RTC_DISABLE_VP9 RTC_DISABLE_VP8 HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722 WEBRTC_OPUS_VARIABLE_COMPLEXITY=0 WEBRTC_USE_BUILTIN_ISAC_FIX=1 WEBRTC_USE_BUILTIN_ISAC_FLOAT=0 $(inherited); >diff --git a/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig b/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig >index b910177b80d036d7090de628308b67e29eb2f0d7..d058c76406ab438765767af1a1883639ba8fb9cf 100644 >--- a/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig >+++ b/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig >@@ -12,7 +12,7 @@ HEADER_SEARCH_PATHS = Source/third_party/opus/src/include Source/third_party/opu > INSTALL_PATH = /usr/local/lib; > PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc; > USE_HEADERMAP = NO; >-WARNING_CFLAGS = -Wno-incompatible-pointer-types >+WARNING_CFLAGS = -Wno-incompatible-pointer-types $(inherited) > GCC_PREPROCESSOR_DEFINITIONS = VAR_ARRAYS OPUS_BUILD OPUS_EXPORT= HAVE_LRINT HAVE_LRINTF OPUS_X86_MAY_HAVE_SSE2 $(inherited); > GCC_PREPROCESSOR_DEFINITIONS[arch=arm64*] = $(inherited) OPUS_ARM_PRESUME_AARCH64_NEON_INTR; > GCC_PREPROCESSOR_DEFINITIONS[arch=x86_64] = $(inherited) $(SSE4_FLAG); >diff --git a/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig b/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig >index bea021696624249bbd2d862d57d7ebb55b50f1b8..b0919adfee69b5c29af8116ccd13946ccc860f6e 100644 >--- a/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig >+++ b/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig >@@ -10,6 +10,6 @@ HEADER_SEARCH_PATHS = Source/ Source/third_party/usrsctp/usrsctplib/usrsctplib/n > INSTALL_PATH = /usr/local/lib; > PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/libwebrtc; > USE_HEADERMAP = NO; >-WARNING_CFLAGS = -Wno-deprecated-declarations; >+WARNING_CFLAGS = -Wno-deprecated-declarations $(inherited); > GCC_PREPROCESSOR_DEFINITIONS = SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin $(inherited); > OTHER_CFLAGS = -UINET -UINET6 -U__APPLE__; >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h >index f23492969395a09518622d3194e93bca7e8ab225..a7271fcbacc307156ce64fe0d68955a630e0e6d3 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h >@@ -103,7 +103,7 @@ using SphericalPointf = SphericalPoint<float>; > > // Helper functions to transform degrees to radians and the inverse. > template <typename T> >-T DegreesToRadians(T angle_degrees) { >+constexpr T DegreesToRadians(T angle_degrees) { > return M_PI * angle_degrees / 180; > } > >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc >index c814716b44860994105789a125ad9df20d775413..204b7ed0adb67776da7f9d1d1b78bf6e8fd37abc 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc >@@ -19,8 +19,9 @@ > namespace webrtc { > > RtpFeedback* NullObjectRtpFeedback() { >- static NullRtpFeedback null_rtp_feedback; >- return &null_rtp_feedback; >+ static std::aligned_storage<sizeof(NullRtpFeedback), std::alignment_of<NullRtpFeedback>::value>::type null_rtp_feedback_storage; >+ static NullRtpFeedback* null_rtp_feedback = new (&null_rtp_feedback_storage) NullRtpFeedback; >+ return null_rtp_feedback; > } > > namespace RtpUtility { >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >index 95e49cc0055cc03db8214310e3821f705f139f11..d5715528169d8302516976caec8b7b1c5b052a48 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc >@@ -106,7 +106,7 @@ bool LogMessage::log_to_stderr_ = true; > > namespace { > >-// Global lock for log subsystem, only needed to serialize access to streams_. >+// Global lock for log subsystem, only needed to serialize access to streamList(). > CriticalSection& logCriticalScope() { > static std::aligned_storage<sizeof(CriticalSection), std::alignment_of<CriticalSection>::value>::type g_log_crit_storage; > static CriticalSection* g_log_crit = new (&g_log_crit_storage) CriticalSection; >@@ -119,7 +119,17 @@ CriticalSection& logCriticalScope() { > // Note: we explicitly do not clean this up, because of the uncertain ordering > // of destructors at program exit. Let the person who sets the stream trigger > // cleanup by setting to null, or let it leak (safe at program exit). >-LogMessage::StreamList LogMessage::streams_ RTC_GUARDED_BY(logCriticalScope()); >+ >+typedef std::pair<LogSink*, LoggingSeverity> StreamAndSeverity; >+typedef std::list<StreamAndSeverity> StreamList; >+ >+// The output streams and their associated severities >+StreamList& streamList() >+ RTC_EXCLUSIVE_LOCKS_REQUIRED(logCriticalScope()) { >+ static std::aligned_storage<sizeof(StreamList), std::alignment_of<StreamList>::value>::type stream_list_storage; >+ static StreamList* stream_list = new (&stream_list_storage) StreamList; >+ return *stream_list; >+} > > // Boolean options default to false (0) > bool LogMessage::thread_, LogMessage::timestamp_; >@@ -133,7 +143,9 @@ LogMessage::LogMessage(const char* file, > : severity_(sev), tag_(kLibjingle) { > > static std::once_flag callLogCriticalScopeOnce; >- std::call_once(callLogCriticalScopeOnce,[] { logCriticalScope(); }); >+ std::call_once(callLogCriticalScopeOnce,[] { >+ logCriticalScope(); >+ }); > > if (timestamp_) { > // Use SystemTimeMillis so that even if tests use fake clocks, the timestamp >@@ -220,7 +232,7 @@ LogMessage::~LogMessage() { > } > > CritScope cs(&logCriticalScope()); >- for (auto& kv : streams_) { >+ for (auto& kv : streamList()) { > if (severity_ >= kv.second) { > kv.first->OnLogMessage(str); > } >@@ -258,7 +270,7 @@ void LogMessage::SetLogToStderr(bool log_to_stderr) { > int LogMessage::GetLogToStream(LogSink* stream) { > CritScope cs(&logCriticalScope()); > LoggingSeverity sev = LS_NONE; >- for (auto& kv : streams_) { >+ for (auto& kv : streamList()) { > if (!stream || stream == kv.first) { > sev = std::min(sev, kv.second); > } >@@ -268,15 +280,16 @@ int LogMessage::GetLogToStream(LogSink* stream) { > > void LogMessage::AddLogToStream(LogSink* stream, LoggingSeverity min_sev) { > CritScope cs(&logCriticalScope()); >- streams_.push_back(std::make_pair(stream, min_sev)); >+ streamList().push_back(std::make_pair(stream, min_sev)); > UpdateMinLogSeverity(); > } > > void LogMessage::RemoveLogToStream(LogSink* stream) { > CritScope cs(&logCriticalScope()); >- for (StreamList::iterator it = streams_.begin(); it != streams_.end(); ++it) { >+ auto& streams = streamList(); >+ for (auto it = streams.begin(); it != streams.end(); ++it) { > if (stream == it->first) { >- streams_.erase(it); >+ streams.erase(it); > break; > } > } >@@ -348,7 +361,7 @@ void LogMessage::ConfigureLogging(const char* params) { > void LogMessage::UpdateMinLogSeverity() > RTC_EXCLUSIVE_LOCKS_REQUIRED(logCriticalScope()) { > LoggingSeverity min_sev = dbg_sev_; >- for (auto& kv : streams_) { >+ for (auto& kv : streamList()) { > min_sev = std::min(dbg_sev_, kv.second); > } > min_sev_ = min_sev; >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h >index e3879fc05bbf009131219e36b4ef5fb270e608e2..8a012080135d68e356dbd089326865320af6732b 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h >@@ -207,9 +207,6 @@ class LogMessage { > static void ConfigureLogging(const char* params); > > private: >- typedef std::pair<LogSink*, LoggingSeverity> StreamAndSeverity; >- typedef std::list<StreamAndSeverity> StreamList; >- > // Updates min_sev_ appropriately when debug sinks change. > static void UpdateMinLogSeverity(); > >@@ -238,9 +235,6 @@ class LogMessage { > // ctx_sev_ is the minimum level at which file context is displayed > static LoggingSeverity min_sev_, dbg_sev_, ctx_sev_; > >- // The output streams and their associated severities >- static StreamList streams_; >- > // Flags for formatting options > static bool thread_, timestamp_; > >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc >index 631974d9bcf36d4871af67d5f06d440d9c63f087..21d963f5d7c0700dd6148e9ce173c2b6c20f8d3c 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc >@@ -221,8 +221,9 @@ Clock* Clock::GetRealTimeClock() { > } > return g_shared_clock; > #elif defined(WEBRTC_POSIX) >- static UnixRealTimeClock clock; >- return &clock; >+ static std::aligned_storage<sizeof(UnixRealTimeClock), std::alignment_of<UnixRealTimeClock>::value>::type clock_storage; >+ static UnixRealTimeClock* clock = new (&clock_storage) UnixRealTimeClock; >+ return clock; > #else // defined(WEBRTC_POSIX) > return nullptr; > #endif // !defined(WEBRTC_WIN) || defined(WEBRTC_POSIX)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186615
:
342722
|
342724
|
342725
|
342742
|
342748
|
342754
|
342769