Title: [232858] trunk/Source/ThirdParty/libwebrtc
Revision
232858
Author
[email protected]
Date
2018-06-14 16:21:06 -0700 (Thu, 14 Jun 2018)

Log Message

Activate -Wexit-time-destructors -and Wglobal-constructors in libwebrtc
https://bugs.webkit.org/show_bug.cgi?id=186615

Reviewed by Darin Adler.

Update xcconfig files to activate these compile flags.
Also enable -Wthread-safety since libwebrtc code is using some related attributes.
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.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-06-14 23:21:06 UTC (rev 232858)
@@ -1,5 +1,29 @@
 2018-06-14  Youenn Fablet  <[email protected]>
 
+        Activate -Wexit-time-destructors -and Wglobal-constructors in libwebrtc
+        https://bugs.webkit.org/show_bug.cgi?id=186615
+
+        Reviewed by Darin Adler.
+
+        Update xcconfig files to activate these compile flags.
+        Also enable -Wthread-safety since libwebrtc code is using some related attributes.
+        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  <[email protected]>
+
         Eliminate static initializers in libwebrtc.dylib
         https://bugs.webkit.org/show_bug.cgi?id=186570
         <rdar://problem/41054874>

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/Base.xcconfig	2018-06-14 23:21:06 UTC (rev 232858)
@@ -50,7 +50,7 @@
 GCC_WARN_UNUSED_VARIABLE = YES;
 PREBINDING = NO;
 STRIP_INSTALLED_PRODUCT = NO;
-WARNING_CFLAGS = -Wexit-time-destructors -Wglobal-constructors;
+WARNING_CFLAGS = -Wexit-time-destructors -Wglobal-constructors -Wthread-safety;
 
 SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx;
 VALID_ARCHS = $(ARCHS_STANDARD_64_BIT);

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig	2018-06-14 23:21:06 UTC (rev 232858)
@@ -23,7 +23,7 @@
 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);

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/opus.xcconfig	2018-06-14 23:21:06 UTC (rev 232858)
@@ -12,7 +12,7 @@
 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);

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/usrsctp.xcconfig	2018-06-14 23:21:06 UTC (rev 232858)
@@ -10,6 +10,6 @@
 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__;

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/audio_processing/beamformer/array_util.h	2018-06-14 23:21:06 UTC (rev 232858)
@@ -103,7 +103,7 @@
 
 // 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;
 }
 

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/rtp_rtcp/source/rtp_utility.cc	2018-06-14 23:21:06 UTC (rev 232858)
@@ -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 {

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.cc	2018-06-14 23:21:06 UTC (rev 232858)
@@ -106,7 +106,7 @@
 
 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,8 +119,18 @@
 // 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_;
 
@@ -220,7 +230,7 @@
   }
 
   CritScope cs(&logCriticalScope());
-  for (auto& kv : streams_) {
+  for (auto& kv : streamList()) {
     if (severity_ >= kv.second) {
       kv.first->OnLogMessage(str);
     }
@@ -258,7 +268,7 @@
 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 +278,16 @@
 
 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 +359,7 @@
 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;

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/logging.h	2018-06-14 23:21:06 UTC (rev 232858)
@@ -207,9 +207,6 @@
   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 @@
   // 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_;
 

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/virtualsocketserver.cc	2018-06-14 23:21:06 UTC (rev 232858)
@@ -1043,11 +1043,9 @@
   }
 }
 
-static double PI = 4 * atan(1.0);
-
 static double Normal(double x, double mean, double stddev) {
   double a = (x - mean) * (x - mean) / (2 * stddev * stddev);
-  return exp(-a) / (stddev * sqrt(2 * PI));
+  return exp(-a) / (stddev * sqrt(2 * M_PI));
 }
 
 #if 0  // static unused gives a warning

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc (232857 => 232858)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc	2018-06-14 22:08:22 UTC (rev 232857)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/system_wrappers/source/clock.cc	2018-06-14 23:21:06 UTC (rev 232858)
@@ -221,8 +221,9 @@
   }
   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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to