From e10854f8ada6b2e3385ebab416fbb84c05cdea9c Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 11 Aug 2017 17:45:50 -0700 Subject: [PATCH 01/31] Bug 1389598 - Part 1: Remove gonk references from gfx/ r=jrmuizel --- gfx/doc/B2GInputFlow.svg | 349 --------------------- gfx/tests/mochitest/test_acceleration.html | 2 +- gfx/thebes/gfxPlatform.h | 2 - 3 files changed, 1 insertion(+), 352 deletions(-) delete mode 100644 gfx/doc/B2GInputFlow.svg diff --git a/gfx/doc/B2GInputFlow.svg b/gfx/doc/B2GInputFlow.svg deleted file mode 100644 index ee6f4332c28d..000000000000 --- a/gfx/doc/B2GInputFlow.svg +++ /dev/null @@ -1,349 +0,0 @@ - - - Touch input event flow on B2G - - - - diff --git a/gfx/tests/mochitest/test_acceleration.html b/gfx/tests/mochitest/test_acceleration.html index 52706321bedf..75a482b48689 100644 --- a/gfx/tests/mochitest/test_acceleration.html +++ b/gfx/tests/mochitest/test_acceleration.html @@ -123,7 +123,7 @@ break; default: - if (xr.OS == "Android" && xr.widgetToolkit != "gonk") { + if (xr.OS == "Android") { isnot(acceleratedWindows, 0, "Acceleration enabled on Android"); } else { is(acceleratedWindows, 0, "Acceleration not supported on '" + osName + "'"); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index dd6859e42edc..91ca73bcc6dc 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -600,8 +600,6 @@ class gfxPlatform { void PurgeSkiaGPUCache(); static void PurgeSkiaFontCache(); - virtual bool IsInGonkEmulator() const { return false; } - static bool UsesOffMainThreadCompositing(); bool HasEnoughTotalSystemMemoryForSkiaGL(); From 99221f7af6d5bf4080edf891ef393f1bc15825a1 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 11 Aug 2017 17:46:15 -0700 Subject: [PATCH 02/31] Bug 1389598 - Part 2: Remove gonk references from media/ r=jesup --- build/gyp.mozbuild | 1 - media/mtransport/common.build | 5 - media/mtransport/gonk_addrs.cpp | 170 ------------------ media/mtransport/third_party/nICEr/nicer.gyp | 13 -- media/webrtc/signaling/signaling.gyp | 12 +- .../signaling/src/jsep/JsepSessionImpl.cpp | 4 - .../src/mediapipeline/MediaPipeline.cpp | 4 - media/webrtc/trunk/build/common.gypi | 2 +- .../common_audio/resampler/resampler.cc | 2 +- .../audio_device/gonk/audio_manager.cc | 1 - .../modules/audio_device/gonk/audio_manager.h | 6 - .../linux/pulseaudiosymboltable_linux.cc | 2 +- .../modules/video_capture/video_capture.h | 2 +- .../system_wrappers/include/static_instance.h | 2 +- .../system_wrappers/source/cpu_features.cc | 4 +- .../voice_engine/voice_engine_defines.h | 4 +- 16 files changed, 10 insertions(+), 224 deletions(-) delete mode 100644 media/mtransport/gonk_addrs.cpp delete mode 100644 media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.cc delete mode 100644 media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.h diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild index 5b4eaa1b80fc..ed7043d2f958 100644 --- a/build/gyp.mozbuild +++ b/build/gyp.mozbuild @@ -60,7 +60,6 @@ gyp_vars.update({ 'arm_neon': 0, 'arm_neon_optional': 1, - 'moz_widget_toolkit_gonk': 0, 'moz_webrtc_omx': 0, 'moz_webrtc_mediacodec': 0, diff --git a/media/mtransport/common.build b/media/mtransport/common.build index e79979b95e49..ca914f42e821 100644 --- a/media/mtransport/common.build +++ b/media/mtransport/common.build @@ -28,11 +28,6 @@ mtransport_lcppsrcs = [ 'transportlayerprsock.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - mtransport_lcppsrcs += [ - 'gonk_addrs.cpp', - ] - mtransport_cppsrcs = [ '/media/mtransport/%s' % s for s in sorted(mtransport_lcppsrcs) ] diff --git a/media/mtransport/gonk_addrs.cpp b/media/mtransport/gonk_addrs.cpp deleted file mode 100644 index 1c69b711ec0c..000000000000 --- a/media/mtransport/gonk_addrs.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ -extern "C" { -#include -#include "r_types.h" -#include "stun.h" -#include "addrs.h" -} - -#include -#include -#include "nsINetworkInterface.h" -#include "nsINetworkInterfaceListService.h" -#include "runnable_utils.h" -#include "nsCOMPtr.h" -#include "nsMemory.h" -#include "nsThreadUtils.h" -#include "nsServiceManagerUtils.h" -#include "mozilla/SyncRunnable.h" - -namespace { -struct NetworkInterface { - struct sockaddr_in addr; - std::string name; - // See NR_INTERFACE_TYPE_* in nICEr/src/net/local_addrs.h - int type; -}; - -nsresult -GetInterfaces(std::vector* aInterfaces) -{ - MOZ_ASSERT(aInterfaces); - - // Obtain network interfaces from network manager. - nsresult rv; - nsCOMPtr listService = - do_GetService("@mozilla.org/network/interface-list-service;1", &rv); - NS_ENSURE_SUCCESS(rv, rv); - - int32_t flags = - nsINetworkInterfaceListService::LIST_NOT_INCLUDE_SUPL_INTERFACES | - nsINetworkInterfaceListService::LIST_NOT_INCLUDE_MMS_INTERFACES | - nsINetworkInterfaceListService::LIST_NOT_INCLUDE_IMS_INTERFACES | - nsINetworkInterfaceListService::LIST_NOT_INCLUDE_DUN_INTERFACES | - nsINetworkInterfaceListService::LIST_NOT_INCLUDE_FOTA_INTERFACES; - nsCOMPtr networkList; - NS_ENSURE_SUCCESS(listService->GetDataInterfaceList(flags, - getter_AddRefs(networkList)), - NS_ERROR_FAILURE); - - // Translate nsINetworkInterfaceList to NetworkInterface. - int32_t listLength; - NS_ENSURE_SUCCESS(networkList->GetNumberOfInterface(&listLength), - NS_ERROR_FAILURE); - aInterfaces->clear(); - - for (int32_t i = 0; i < listLength; i++) { - nsCOMPtr info; - if (NS_FAILED(networkList->GetInterfaceInfo(i, getter_AddRefs(info)))) { - continue; - } - - char16_t **ips = nullptr; - uint32_t *prefixs = nullptr; - uint32_t count = 0; - bool isAddressGot = false; - NetworkInterface interface; - memset(&(interface.addr), 0, sizeof(interface.addr)); - interface.addr.sin_family = AF_INET; - - if (NS_FAILED(info->GetAddresses(&ips, &prefixs, &count))) { - continue; - } - - for (uint32_t j = 0; j < count; j++) { - nsAutoString ip; - - ip.Assign(ips[j]); - if (inet_pton(AF_INET, NS_ConvertUTF16toUTF8(ip).get(), - &(interface.addr.sin_addr.s_addr)) == 1) { - isAddressGot = true; - break; - } - } - - free(prefixs); - NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, ips); - - if (!isAddressGot) { - continue; - } - - nsAutoString ifaceName; - if (NS_FAILED(info->GetName(ifaceName))) { - continue; - } - interface.name = NS_ConvertUTF16toUTF8(ifaceName).get(); - - int32_t type; - if (NS_FAILED(info->GetType(&type))) { - continue; - } - switch (type) { - case nsINetworkInfo::NETWORK_TYPE_WIFI: - interface.type = NR_INTERFACE_TYPE_WIFI; - break; - case nsINetworkInfo::NETWORK_TYPE_MOBILE: - interface.type = NR_INTERFACE_TYPE_MOBILE; - break; - } - - aInterfaces->push_back(interface); - } - return NS_OK; -} -} // anonymous namespace - -int -nr_stun_get_addrs(nr_local_addr aAddrs[], int aMaxAddrs, - int aDropLoopback, int aDropLinkLocal, int* aCount) -{ - nsresult rv; - int r; - - // Get network interface list. - std::vector interfaces; - nsCOMPtr mainThread = do_GetMainThread(); - mozilla::SyncRunnable::DispatchToThread( - mainThread.get(), - mozilla::WrapRunnableNMRet(&rv, &GetInterfaces, &interfaces), - false); - if (NS_FAILED(rv)) { - return R_FAILED; - } - - // Translate to nr_transport_addr. - int32_t n = 0; - size_t num_interface = std::min(interfaces.size(), (size_t)aMaxAddrs); - for (size_t i = 0; i < num_interface; ++i) { - NetworkInterface &interface = interfaces[i]; - if (nr_sockaddr_to_transport_addr((sockaddr*)&(interface.addr), - IPPROTO_UDP, 0, &(aAddrs[n].addr))) { - r_log(NR_LOG_STUN, LOG_WARNING, "Problem transforming address"); - return R_FAILED; - } - strlcpy(aAddrs[n].addr.ifname, interface.name.c_str(), - sizeof(aAddrs[n].addr.ifname)); - aAddrs[n].interface.type = interface.type; - aAddrs[n].interface.estimated_speed = 0; - n++; - } - - *aCount = n; - r = nr_stun_remove_duplicate_addrs(aAddrs, aDropLoopback, aDropLinkLocal, aCount); - if (r != 0) { - return r; - } - - for (int i = 0; i < *aCount; ++i) { - char typestr[100]; - nr_local_addr_fmt_info_string(aAddrs + i, typestr, sizeof(typestr)); - r_log(NR_LOG_STUN, LOG_DEBUG, "Address %d: %s on %s, type: %s\n", - i, aAddrs[i].addr.as_string, aAddrs[i].addr.ifname, typestr); - } - - return 0; -} diff --git a/media/mtransport/third_party/nICEr/nicer.gyp b/media/mtransport/third_party/nICEr/nicer.gyp index f11aec4a93f7..4621f7f6b4be 100644 --- a/media/mtransport/third_party/nICEr/nicer.gyp +++ b/media/mtransport/third_party/nICEr/nicer.gyp @@ -7,7 +7,6 @@ # { 'variables' : { - 'build_with_gonk%': 0, 'have_ethtool_cmd_speed_hi%': 1 }, 'targets' : [ @@ -232,18 +231,6 @@ 'sources': [ ], - }], - ['moz_widget_toolkit_gonk==1', { - 'defines' : [ - 'WEBRTC_GONK', - 'NO_REG_RPC', - ], - }], - # Gonk has its own nr_stun_get_addrs implementation. - ['build_with_gonk==1', { - 'defines': [ - "USE_PLATFORM_NR_STUN_GET_ADDRS", - ] }], ['have_ethtool_cmd_speed_hi==0', { 'defines': [ diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp index b775b9336c41..834fb0479625 100644 --- a/media/webrtc/signaling/signaling.gyp +++ b/media/webrtc/signaling/signaling.gyp @@ -39,16 +39,6 @@ 'chromium_code': 1, }, - 'target_defaults': { - 'conditions': [ - ['moz_widget_toolkit_gonk==1', { - 'defines' : [ - 'WEBRTC_GONK', - ], - }], - ], - }, - 'targets': [ # @@ -296,7 +286,7 @@ 'cflags_mozilla': [ ], }], - ['OS=="android" or moz_widget_toolkit_gonk==1', { + ['OS=="android"', { 'cflags_mozilla': [ # This warning complains about important MOZ_EXPORT attributes # on forward declarations for Android API types. diff --git a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp index a7fdbe1a6421..f8baadafc6e5 100644 --- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp +++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp @@ -2259,12 +2259,8 @@ JsepSessionImpl::SetupDefaultCodecs() 48000, 2, 960, -#ifdef WEBRTC_GONK // TODO Move this elsewhere to be adaptive to rate - Bug 1207925 - 16000 // B2G uses lower capture sampling rate -#else 40000 -#endif )); mSupportedCodecs.values.push_back(new JsepAudioCodecDescription( diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 5c2bcd16d017..07aa6f9b94c5 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -25,10 +25,6 @@ #include "MediaStreamVideoSink.h" #include "VideoUtils.h" #include "VideoStreamTrack.h" -#ifdef WEBRTC_GONK -#include "GrallocImages.h" -#include "mozilla/layers/GrallocTextureClient.h" -#endif #include "nsError.h" #include "AudioSegment.h" diff --git a/media/webrtc/trunk/build/common.gypi b/media/webrtc/trunk/build/common.gypi index 9e94ce9615da..49c7cc8bac7d 100644 --- a/media/webrtc/trunk/build/common.gypi +++ b/media/webrtc/trunk/build/common.gypi @@ -428,7 +428,7 @@ }], # Flags to use X11 on non-Mac POSIX platforms - ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or moz_widget_toolkit_gonk==1', { + ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', { 'use_glib%': 0, 'use_x11%': 0, }, { diff --git a/media/webrtc/trunk/webrtc/common_audio/resampler/resampler.cc b/media/webrtc/trunk/webrtc/common_audio/resampler/resampler.cc index caaad7898b11..aa451555d825 100644 --- a/media/webrtc/trunk/webrtc/common_audio/resampler/resampler.cc +++ b/media/webrtc/trunk/webrtc/common_audio/resampler/resampler.cc @@ -23,7 +23,7 @@ // TODO(jesup) better adjust per platform ability // Note: if these are changed (higher), you may need to change the // KernelDelay values in the unit tests here and in output_mixer. -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_GONK) +#if defined(WEBRTC_ANDROID) #define RESAMPLER_QUALITY 2 #else #define RESAMPLER_QUALITY 3 diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.cc b/media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.cc deleted file mode 100644 index faa93c765161..000000000000 --- a/media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.cc +++ /dev/null @@ -1 +0,0 @@ -#include "../android/audio_manager.cc" diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.h b/media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.h deleted file mode 100644 index 1b79c1e58c65..000000000000 --- a/media/webrtc/trunk/webrtc/modules/audio_device/gonk/audio_manager.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef WEBRTC_MODULES_AUDIO_DEVICE_GONK_AUDIO_MANAGER_H_ -#define WEBRTC_MODULES_AUDIO_DEVICE_GONK_AUDIO_MANAGER_H_ - -#include "../android/audio_manager.h" - -#endif diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc b/media/webrtc/trunk/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc index 1fe2cf7511f2..c6c2eba5aa95 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc +++ b/media/webrtc/trunk/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc @@ -29,7 +29,7 @@ namespace webrtc_adm_linux_pulse { -#if defined(__OpenBSD__) || defined(WEBRTC_GONK) +#if defined(__OpenBSD__) LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so") #else LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so.0") diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.h b/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.h index 2de7d87a50bf..7febacb2b5ec 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.h +++ b/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.h @@ -17,7 +17,7 @@ #include "webrtc/modules/include/module.h" #include "webrtc/modules/video_capture/video_capture_defines.h" -#if defined(ANDROID) && !defined(WEBRTC_GONK) +#if defined(ANDROID) #include #endif diff --git a/media/webrtc/trunk/webrtc/system_wrappers/include/static_instance.h b/media/webrtc/trunk/webrtc/system_wrappers/include/static_instance.h index d6df05c92cb5..46dbdc9d0989 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/include/static_instance.h +++ b/media/webrtc/trunk/webrtc/system_wrappers/include/static_instance.h @@ -13,7 +13,7 @@ #include -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_GONK) +#if defined(WEBRTC_ANDROID) #define OS_LINUX #endif #include "base/singleton.h" diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features.cc index 51f24b690011..99736edfde49 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features.cc @@ -67,7 +67,7 @@ static int GetCPUInfo(CPUFeature feature) { return 0; } -#if !defined(WEBRTC_GONK) && !defined(ANDROID) +#if !defined(ANDROID) #ifdef WEBRTC_ARCH_ARM_V7 uint64_t WebRtc_GetCPUFeaturesARM(void) { return kCPUFeatureARMv7 @@ -77,7 +77,7 @@ uint64_t WebRtc_GetCPUFeaturesARM(void) { | kCPUFeatureVFPv3; } #endif // WEBRTC_ARCH_ARM_V7 -#endif // !WEBRTC_GONK && !ANDROID +#endif // !ANDROID #endif diff --git a/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h b/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h index 52f638eb568d..6ccd75886e70 100644 --- a/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h +++ b/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h @@ -60,13 +60,13 @@ enum { kVoiceEngineMaxModuleVersionSize = 960 }; // Audio processing const NoiseSuppression::Level kDefaultNsMode = NoiseSuppression::kModerate; const GainControl::Mode kDefaultAgcMode = -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_GONK) +#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) GainControl::kAdaptiveDigital; #else GainControl::kAdaptiveAnalog; #endif const bool kDefaultAgcState = -#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_GONK) +#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) false; #else true; From 948ea6064d37b544d50669da1d5419a2e5c343f1 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Sat, 12 Aug 2017 17:42:11 -0700 Subject: [PATCH 03/31] Bug 1389598 - Part 3: Remove gonk references from dom/ r=bkelly --- dom/canvas/ImageUtils.cpp | 1 - .../test/unit/xpcshell-child-process.ini | 2 +- .../test/unit/xpcshell-parent-process.ini | 1 - dom/interfaces/base/nsIDOMWindowUtils.idl | 3 +-- dom/media/MediaDevices.cpp | 2 -- dom/media/MediaPrefs.h | 3 --- dom/media/mediasource/moz.build | 3 --- dom/media/moz.build | 3 --- dom/media/mp4/MP4Decoder.cpp | 4 ---- dom/media/mp4/moz.build | 3 --- dom/media/platforms/PDMFactory.cpp | 9 -------- dom/media/platforms/omx/OmxDataDecoder.cpp | 7 +++--- dom/media/platforms/omx/OmxPlatformLayer.cpp | 23 +------------------ dom/media/platforms/omx/OmxPlatformLayer.h | 6 ++--- dom/media/platforms/omx/OmxPromiseLayer.h | 2 +- dom/media/webrtc/MediaEngine.h | 4 +--- .../webrtc/MediaEngineCameraVideoSource.h | 3 +-- .../webspeech/synth/pico/nsPicoService.cpp | 8 +++---- dom/webidl/Window.webidl | 2 +- dom/xhr/tests/mochitest.ini | 2 +- 20 files changed, 18 insertions(+), 73 deletions(-) diff --git a/dom/canvas/ImageUtils.cpp b/dom/canvas/ImageUtils.cpp index f9e06451f3b8..b06f6c47363f 100644 --- a/dom/canvas/ImageUtils.cpp +++ b/dom/canvas/ImageUtils.cpp @@ -178,7 +178,6 @@ class YUVImpl final : public ImageUtils::Impl }; // TODO: optimize for other platforms. -// For GONK: implement GrallocImageImpl, GrallocPlanarYCbCrImpl and GonkCameraImpl. // For Windows: implement D3D9RGB32TextureImpl and D3D11ShareHandleTextureImpl. // Others: SharedBGRImpl, MACIOSrufaceImpl, GLImageImpl, SurfaceTextureImpl // EGLImageImpl and OverlayImegImpl. diff --git a/dom/indexedDB/test/unit/xpcshell-child-process.ini b/dom/indexedDB/test/unit/xpcshell-child-process.ini index 970fe8c3ddd6..5918471ead13 100644 --- a/dom/indexedDB/test/unit/xpcshell-child-process.ini +++ b/dom/indexedDB/test/unit/xpcshell-child-process.ini @@ -6,7 +6,7 @@ dupe-manifest = head = xpcshell-head-child-process.js tail = -skip-if = toolkit == 'android' || toolkit == 'gonk' +skip-if = toolkit == 'android' support-files = GlobalObjectsChild.js GlobalObjectsComponent.js diff --git a/dom/indexedDB/test/unit/xpcshell-parent-process.ini b/dom/indexedDB/test/unit/xpcshell-parent-process.ini index 5f32d6e6dd6a..264a82791d4c 100644 --- a/dom/indexedDB/test/unit/xpcshell-parent-process.ini +++ b/dom/indexedDB/test/unit/xpcshell-parent-process.ini @@ -6,7 +6,6 @@ dupe-manifest = head = xpcshell-head-parent-process.js tail = -skip-if = toolkit == 'gonk' support-files = bug1056939_profile.zip defaultStorageUpgrade_profile.zip diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index d6d9a2487392..9488e6cb693c 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -723,8 +723,7 @@ interface nsIDOMWindowUtils : nsISupports { * drag - msg1-n:TOUCH_CONTACT (moving), msgn+1:TOUCH_REMOVE * hover drag - msg1-n:TOUCH_HOVER (moving), msgn+1:TOUCH_REMOVE * - * Widget support: Windows 8.0+, Winrt/Win32. Gonk supports CONTACT, REMOVE, - * and CANCEL but no HOVER. Other widgets will throw. + * Widget support: Windows 8.0+, Winrt/Win32. Other widgets will throw. * * NOTE: The synthesized native event will be fired asynchronously, and upon * completion the observer, if provided, will be notified with a "touchpoint" diff --git a/dom/media/MediaDevices.cpp b/dom/media/MediaDevices.cpp index 6a49bd25d380..d93f8aef71b6 100644 --- a/dom/media/MediaDevices.cpp +++ b/dom/media/MediaDevices.cpp @@ -82,8 +82,6 @@ class MediaDevices::EnumDevResolver : public nsIGetUserMediaDevicesSuccessCallba NS_IMETHOD OnSuccess(nsIVariant* aDevices) override { - // Cribbed from MediaPermissionGonk.cpp - // Create array for nsIMediaDevice nsTArray> devices; // Contain the fumes diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index 4454f63995bc..16420edb877a 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -116,9 +116,6 @@ class MediaPrefs final DECL_MEDIA_PREF("media.eme.enabled", EMEEnabled, bool, false); DECL_MEDIA_PREF("media.use-blank-decoder", PDMUseBlankDecoder, bool, false); DECL_MEDIA_PREF("media.gpu-process-decoder", PDMUseGPUDecoder, bool, false); -#ifdef MOZ_GONK_MEDIACODEC - DECL_MEDIA_PREF("media.gonk.enabled", PDMGonkDecoderEnabled, bool, true); -#endif #ifdef MOZ_WIDGET_ANDROID DECL_MEDIA_PREF("media.android-media-codec.enabled", PDMAndroidMediaCodecEnabled, bool, false); DECL_MEDIA_PREF("media.android-media-codec.preferred", PDMAndroidMediaCodecPreferred, bool, false); diff --git a/dom/media/mediasource/moz.build b/dom/media/mediasource/moz.build index 6ded1875d8f8..a1689c2169a8 100644 --- a/dom/media/mediasource/moz.build +++ b/dom/media/mediasource/moz.build @@ -38,9 +38,6 @@ TEST_DIRS += [ 'gtest', ] -if CONFIG['MOZ_GONK_MEDIACODEC']: - DEFINES['MOZ_GONK_MEDIACODEC'] = True - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/dom/media/moz.build b/dom/media/moz.build index a93f61f1778d..70d012286470 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -319,9 +319,6 @@ else: if CONFIG['ANDROID_VERSION'] > '15': DEFINES['MOZ_OMX_WEBM_DECODER'] = True -if CONFIG['MOZ_GONK_MEDIACODEC']: - DEFINES['MOZ_GONK_MEDIACODEC'] = True - if CONFIG['MOZ_ANDROID_HLS_SUPPORT']: DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True diff --git a/dom/media/mp4/MP4Decoder.cpp b/dom/media/mp4/MP4Decoder.cpp index b4be75341880..9de5ef77f360 100644 --- a/dom/media/mp4/MP4Decoder.cpp +++ b/dom/media/mp4/MP4Decoder.cpp @@ -71,10 +71,6 @@ MP4Decoder::IsSupportedType(const MediaContainerType& aType, aType.Type() == MEDIAMIMETYPE("audio/x-m4a"); const bool isVideo = aType.Type() == MEDIAMIMETYPE("video/mp4") || aType.Type() == MEDIAMIMETYPE("video/quicktime") - // On B2G, treat 3GPP as MP4 when Gonk PDM is available. -#ifdef MOZ_GONK_MEDIACODEC - || aType.Type() == MEDIAMIMETYPE(VIDEO_3GPP) -#endif || aType.Type() == MEDIAMIMETYPE("video/x-m4v"); if (!isAudio && !isVideo) { diff --git a/dom/media/mp4/moz.build b/dom/media/mp4/moz.build index 29db7f85fc94..f4dd9889ec9a 100644 --- a/dom/media/mp4/moz.build +++ b/dom/media/mp4/moz.build @@ -40,9 +40,6 @@ SOURCES += [ FINAL_LIBRARY = 'xul' -if CONFIG['MOZ_GONK_MEDIACODEC']: - DEFINES['MOZ_GONK_MEDIACODEC'] = True - # Supress warnnings for now. if CONFIG['_MSC_VER']: diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp index b425cee37a42..49386328a82b 100644 --- a/dom/media/platforms/PDMFactory.cpp +++ b/dom/media/platforms/PDMFactory.cpp @@ -19,9 +19,6 @@ #ifdef MOZ_APPLEMEDIA #include "AppleDecoderModule.h" #endif -#ifdef MOZ_GONK_MEDIACODEC -#include "GonkDecoderModule.h" -#endif #ifdef MOZ_WIDGET_ANDROID #include "AndroidDecoderModule.h" #endif @@ -373,12 +370,6 @@ PDMFactory::CreatePDMs() m = new AppleDecoderModule(); StartupPDM(m); #endif -#ifdef MOZ_GONK_MEDIACODEC - if (MediaPrefs::PDMGonkDecoderEnabled()) { - m = new GonkDecoderModule(); - StartupPDM(m); - } -#endif #ifdef MOZ_WIDGET_ANDROID if(MediaPrefs::PDMAndroidMediaCodecEnabled()){ m = new AndroidDecoderModule(); diff --git a/dom/media/platforms/omx/OmxDataDecoder.cpp b/dom/media/platforms/omx/OmxDataDecoder.cpp index 3db108f1b9c5..bc422dd93584 100644 --- a/dom/media/platforms/omx/OmxDataDecoder.cpp +++ b/dom/media/platforms/omx/OmxDataDecoder.cpp @@ -300,8 +300,8 @@ OmxDataDecoder::FillBufferDone(BufferData* aData) MOZ_ASSERT(!aData || aData->mStatus == BufferData::BufferStatus::OMX_CLIENT); // Don't output sample when flush or shutting down, especially for video - // decoded frame. Because video decoded frame has a promise in BufferData - // waiting for layer to resolve it via recycle callback on Gonk, if other + // decoded frame. Because video decoded frame can have a promise in + // BufferData waiting for layer to resolve it via recycle callback, if other // module doesn't send it to layer, it will cause a unresolved promise and // waiting for resolve infinitely. if (mFlushing || mShuttingDown) { @@ -336,8 +336,7 @@ OmxDataDecoder::Output(BufferData* aData) if (isPlatformData) { // If the MediaData is platform dependnet data, it's mostly a kind of - // limited resource, for example, GraphicBuffer on Gonk. So we use promise - // to notify when the resource is free. + // limited resource, so we use promise to notify when the resource is free. aData->mStatus = BufferData::BufferStatus::OMX_CLIENT_OUTPUT; MOZ_RELEASE_ASSERT(aData->mPromise.IsEmpty()); diff --git a/dom/media/platforms/omx/OmxPlatformLayer.cpp b/dom/media/platforms/omx/OmxPlatformLayer.cpp index fd6952d10f1b..55b576b50b03 100644 --- a/dom/media/platforms/omx/OmxPlatformLayer.cpp +++ b/dom/media/platforms/omx/OmxPlatformLayer.cpp @@ -282,26 +282,7 @@ OmxPlatformLayer::CompressionFormat() } } -// Implementations for different platforms will be defined in their own files. -#ifdef OMX_PLATFORM_GONK - -bool -OmxPlatformLayer::SupportsMimeType(const nsACString& aMimeType) -{ - return GonkOmxPlatformLayer::FindComponents(aMimeType); -} - -OmxPlatformLayer* -OmxPlatformLayer::Create(OmxDataDecoder* aDataDecoder, - OmxPromiseLayer* aPromiseLayer, - TaskQueue* aTaskQueue, - layers::ImageContainer* aImageContainer) -{ - return new GonkOmxPlatformLayer(aDataDecoder, aPromiseLayer, aTaskQueue, aImageContainer); -} - -#else // For platforms without OMX IL support. - +// For platforms without OMX IL support. bool OmxPlatformLayer::SupportsMimeType(const nsACString& aMimeType) { @@ -317,6 +298,4 @@ OmxPlatformLayer::Create(OmxDataDecoder* aDataDecoder, return nullptr; } -#endif - } diff --git a/dom/media/platforms/omx/OmxPlatformLayer.h b/dom/media/platforms/omx/OmxPlatformLayer.h index 03b05d212346..e85e25db27cd 100644 --- a/dom/media/platforms/omx/OmxPlatformLayer.h +++ b/dom/media/platforms/omx/OmxPlatformLayer.h @@ -45,9 +45,9 @@ class OmxPlatformLayer OMX_U32 aParam1, OMX_PTR aCmdData) = 0; - // Buffer could be platform dependent; for example, video decoding needs gralloc - // on Gonk. Therefore, derived class needs to implement its owned buffer - // allocate/release API according to its platform type. + // Buffer could be platform dependent. Therefore, derived class needs to + // implement its owned buffer allocate/release API according to its platform + // type. virtual nsresult AllocateOmxBuffer(OMX_DIRTYPE aType, BUFFERLIST* aBufferList) = 0; virtual nsresult ReleaseOmxBuffer(OMX_DIRTYPE aType, BUFFERLIST* aBufferList) = 0; diff --git a/dom/media/platforms/omx/OmxPromiseLayer.h b/dom/media/platforms/omx/OmxPromiseLayer.h index c3378de31b33..9f169fd686a9 100644 --- a/dom/media/platforms/omx/OmxPromiseLayer.h +++ b/dom/media/platforms/omx/OmxPromiseLayer.h @@ -142,7 +142,7 @@ class OmxPromiseLayer NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BufferData) // In most cases, the ID of this buffer is the pointer address of mBuffer. - // However, in platform like gonk, it is another value. + // However, on some platforms it may be another value. virtual BufferID ID() { return mBuffer; diff --git a/dom/media/webrtc/MediaEngine.h b/dom/media/webrtc/MediaEngine.h index a60afc507050..6034d9b34e79 100644 --- a/dom/media/webrtc/MediaEngine.h +++ b/dom/media/webrtc/MediaEngine.h @@ -30,8 +30,7 @@ enum { * Abstract interface for managing audio and video devices. Each platform * must implement a concrete class that will map these classes and methods * to the appropriate backend. For example, on Desktop platforms, these will - * correspond to equivalent webrtc (GIPS) calls, and on B2G they will map to - * a Gonk interface. + * correspond to equivalent webrtc (GIPS) calls. */ class MediaEngineVideoSource; class MediaEngineAudioSource; @@ -309,7 +308,6 @@ class MediaEngineSource : public nsISupports, /* If implementation of MediaEngineSource supports TakePhoto(), the picture * should be return via aCallback object. Otherwise, it returns NS_ERROR_NOT_IMPLEMENTED. - * Currently, only Gonk MediaEngineSource implementation supports it. */ virtual nsresult TakePhoto(MediaEnginePhotoCallback* aCallback) = 0; diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.h b/dom/media/webrtc/MediaEngineCameraVideoSource.h index 81233960389e..d8a8c9502590 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.h +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.h @@ -119,10 +119,9 @@ class MediaEngineCameraVideoSource : public MediaEngineVideoSource nsTArray mPrincipalHandles; // Directly mapped to mSources. RefPtr mImage; RefPtr mImageContainer; - int mWidth, mHeight; // protected with mMonitor on Gonk due to different threading // end of data protected by mMonitor - + int mWidth, mHeight; bool mInitDone; bool mHasDirectListeners; int mCaptureIndex; diff --git a/dom/media/webspeech/synth/pico/nsPicoService.cpp b/dom/media/webspeech/synth/pico/nsPicoService.cpp index 559a0232d7be..5e2e967b79c6 100644 --- a/dom/media/webspeech/synth/pico/nsPicoService.cpp +++ b/dom/media/webspeech/synth/pico/nsPicoService.cpp @@ -52,8 +52,8 @@ // Pico's sample rate is always 16000 #define PICO_SAMPLE_RATE 16000 -// The path to the language files in Gonk -#define GONK_PICO_LANG_PATH "/system/tts/lang_pico" +// The path to the language files in Android +#define PICO_LANG_PATH "/system/tts/lang_pico" namespace mozilla { namespace dom { @@ -514,11 +514,11 @@ nsPicoService::Init() return; } - // Use environment variable, or default android/b2g path + // Use environment variable, or default android path nsAutoCString langPath(PR_GetEnv("PICO_LANG_PATH")); if (langPath.IsEmpty()) { - langPath.AssignLiteral(GONK_PICO_LANG_PATH); + langPath.AssignLiteral(PICO_LANG_PATH); } nsCOMPtr voicesDir; diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl index ae02f7b1d44f..74baf6c3cfe4 100644 --- a/dom/webidl/Window.webidl +++ b/dom/webidl/Window.webidl @@ -359,7 +359,7 @@ Window implements TouchEventHandlers; Window implements OnErrorEventHandlerForWindow; -#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) +#if defined(MOZ_WIDGET_ANDROID) // https://compat.spec.whatwg.org/#windoworientation-interface partial interface Window { [NeedsCallerType] diff --git a/dom/xhr/tests/mochitest.ini b/dom/xhr/tests/mochitest.ini index 51e75f25530b..51f38c275996 100644 --- a/dom/xhr/tests/mochitest.ini +++ b/dom/xhr/tests/mochitest.ini @@ -104,7 +104,7 @@ skip-if = toolkit == 'android' [test_xhr_send.html] [test_xhr_send_readystate.html] [test_XHR_system.html] -skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + ) +skip-if = (buildapp == 'b2g') # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + ) [test_XHR_timeout.html] skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743) support-files = test_XHR_timeout.js From 8b9e70a3c735c4c5264809c4af866761ff7e30fb Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Sat, 12 Aug 2017 17:45:18 -0700 Subject: [PATCH 04/31] Bug 1389598 - Part 4: Remove remaining gonk refs. r=froydnj --- Android.mk | 5 ----- accessible/jsat/PointerAdapter.jsm | 11 ----------- config/system-headers | 3 --- devtools/shared/discovery/discovery.js | 13 +------------ hal/moz.build | 2 +- ipc/dbus/RawDBusConnection.h | 4 ++-- memory/build/mozmemory_wrap.h | 4 ++-- moz.build | 3 --- netwerk/dns/nsIDNSService.idl | 3 +-- old-configure.in | 2 +- testing/mochitest/runtests.py | 9 ++++----- testing/modules/tests/xpcshell/xpcshell.ini | 2 +- testing/mozbase/mozrunner/mozrunner/utils.py | 5 +---- testing/xpcshell/example/unit/xpcshell.ini | 1 - .../components/captivedetect/captivedetect.js | 11 +---------- .../osfile/modules/osfile_async_front.jsm | 2 +- .../osfile/tests/xpcshell/test_constants.js | 7 +------ .../xpcshell/test_osfile_async_setDates.js | 4 ++-- .../tests/xpcshell/test_path_constants.js | 2 +- toolkit/crashreporter/crashreporter.mozbuild | 3 --- toolkit/crashreporter/nsExceptionHandler.cpp | 2 +- toolkit/mozapps/extensions/extensions.manifest | 2 -- toolkit/mozapps/installer/packager.mk | 3 --- toolkit/mozapps/installer/upload-files.mk | 4 +--- toolkit/mozapps/update/nsIUpdateService.idl | 2 +- .../exthandler/nsExternalHelperAppService.cpp | 4 ++-- widget/NativeKeyToDOMCodeName.h | 2 +- widget/tests/TestAppShellSteadyState.cpp | 2 +- xpcom/build/nsXULAppAPI.h | 17 ----------------- 29 files changed, 27 insertions(+), 107 deletions(-) delete mode 100644 Android.mk diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 54329b7a6fa8..000000000000 --- a/Android.mk +++ /dev/null @@ -1,5 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# empty file to block B2G/Gonk from trying to build anything inside mozilla-central diff --git a/accessible/jsat/PointerAdapter.jsm b/accessible/jsat/PointerAdapter.jsm index 3a63a3f9b83b..2858436008f0 100644 --- a/accessible/jsat/PointerAdapter.jsm +++ b/accessible/jsat/PointerAdapter.jsm @@ -44,17 +44,6 @@ var PointerRelay = { // jshint ignore:line 'touchend': true }; break; - case 'gonk': - this._eventsOfInterest = { - 'touchstart': true, - 'touchmove': true, - 'touchend': true, - 'mousedown': false, - 'mousemove': false, - 'mouseup': false, - 'click': false }; - break; - default: // Desktop. this._eventsOfInterest = { diff --git a/config/system-headers b/config/system-headers index ef02715d67c5..fee81f70dc7b 100644 --- a/config/system-headers +++ b/config/system-headers @@ -392,9 +392,6 @@ DiskInit.h dlfcn.h dlgs.h dl.h -#ifdef MOZ_WIDGET_GONK -dns_sd.h -#endif docobj.h dos/dosextens.h dos.h diff --git a/devtools/shared/discovery/discovery.js b/devtools/shared/discovery/discovery.js index d60c4566ae50..70d6fe5d7729 100644 --- a/devtools/shared/discovery/discovery.js +++ b/devtools/shared/discovery/discovery.js @@ -160,18 +160,7 @@ LocalDevice.prototype = { * Triggers the |name| setter to persist if needed. */ _generate: function () { - if (Services.appinfo.widgetToolkit == "gonk") { - // For Firefox OS devices, create one from the device name plus a little - // randomness. The goal is just to distinguish devices in an office - // environment where many people may have the same device model for - // testing purposes (which would otherwise all report the same name). - let name = libcutils.property_get("ro.product.device"); - // Pick a random number from [0, 2^32) - let randomID = Math.floor(Math.random() * Math.pow(2, 32)); - // To hex and zero pad - randomID = ("00000000" + randomID.toString(16)).slice(-8); - this.name = name + "-" + randomID; - } else if (Services.appinfo.widgetToolkit == "android") { + if (Services.appinfo.widgetToolkit == "android") { // For Firefox for Android, use the device's model name. // TODO: Bug 1180997: Find the right way to expose an editable name this.name = sysInfo.get("device"); diff --git a/hal/moz.build b/hal/moz.build index cd412ec77432..d6ca499ab261 100644 --- a/hal/moz.build +++ b/hal/moz.build @@ -85,7 +85,7 @@ else: 'fallback/FallbackVibration.cpp', ] -# Fallbacks for backends implemented on Gonk only. +# Fallbacks for backends no longer implemented. UNIFIED_SOURCES += [ 'fallback/FallbackDiskSpaceWatcher.cpp', 'fallback/FallbackFactoryReset.cpp', diff --git a/ipc/dbus/RawDBusConnection.h b/ipc/dbus/RawDBusConnection.h index 21b809edf102..d2e0307706a8 100644 --- a/ipc/dbus/RawDBusConnection.h +++ b/ipc/dbus/RawDBusConnection.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef mozilla_ipc_dbus_gonk_rawdbusconnection_h__ -#define mozilla_ipc_dbus_gonk_rawdbusconnection_h__ +#ifndef mozilla_ipc_dbus_rawdbusconnection_h__ +#define mozilla_ipc_dbus_rawdbusconnection_h__ #include #include "mozilla/ipc/DBusConnectionRefPtr.h" diff --git a/memory/build/mozmemory_wrap.h b/memory/build/mozmemory_wrap.h index 6a21667fbd8e..40b7c44e9fae 100644 --- a/memory/build/mozmemory_wrap.h +++ b/memory/build/mozmemory_wrap.h @@ -59,13 +59,13 @@ * unprefixed, as well as duplication functions. * Jemalloc-specific functions are also left unprefixed. * - * - On Android and Gonk, all functions are left unprefixed. Additionally, + * - On Android all functions are left unprefixed. Additionally, * C++ allocation functions (operator new/delete) are also exported and * unprefixed. * * - On other systems (mostly Linux), all functions are left unprefixed. * - * Only Android and Gonk add C++ allocation functions. + * Only Android adds C++ allocation functions. * * Proper exporting of the various functions is done with the MOZ_MEMORY_API * and MOZ_JEMALLOC_API macros. MOZ_MEMORY_API is meant to be used for malloc diff --git a/moz.build b/moz.build index f82167a0bf28..b42e44689d92 100644 --- a/moz.build +++ b/moz.build @@ -19,9 +19,6 @@ with Files('aclocal.m4'): with Files('Cargo.*'): BUG_COMPONENT = ('Core', 'Build Config') -with Files('Android.mk'): - BUG_COMPONENT = ('Firefox for Android', 'Build Config & IDE Support') - with Files('client.*'): BUG_COMPONENT = ('Core', 'Build Config') diff --git a/netwerk/dns/nsIDNSService.idl b/netwerk/dns/nsIDNSService.idl index a755a6aa74ff..d9462c50b0a4 100644 --- a/netwerk/dns/nsIDNSService.idl +++ b/netwerk/dns/nsIDNSService.idl @@ -132,8 +132,7 @@ interface nsIDNSService : nsISupports * This function is identical to asyncResolve except an additional * parameter aNetwortInterface. If parameter aNetworkInterface is an empty * string function will return the same result as asyncResolve. - * Setting aNetworkInterface value make only sense for gonk,because it - * an per networking interface query is possible. + * Setting aNetworkInterface is deprecated. */ [implicit_jscontext, optional_argc] nsICancelable asyncResolveExtended(in AUTF8String aHostName, diff --git a/old-configure.in b/old-configure.in index 04e61072c031..024521da2056 100644 --- a/old-configure.in +++ b/old-configure.in @@ -3999,7 +3999,7 @@ fi AC_SUBST(MOZ_DISABLE_STARTUPCACHE) dnl ======================================================== -dnl = Enable Pico Speech Synthesis (Gonk usually) +dnl = Enable Pico Speech Synthesis dnl ======================================================== MOZ_ARG_ENABLE_BOOL(synth-pico, [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ], diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 9d95233bbd3e..3f81cdfce7a0 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -2143,11 +2143,10 @@ def timeoutHandler(): # install specialpowers and mochikit addons addons = Addons(self.marionette) - if mozinfo.info.get('toolkit') != 'gonk': - addons.install(create_zip( - os.path.join(here, 'extensions', 'specialpowers') - )) - addons.install(create_zip(self.mochijar)) + addons.install(create_zip( + os.path.join(here, 'extensions', 'specialpowers') + )) + addons.install(create_zip(self.mochijar)) self.execute_start_script() diff --git a/testing/modules/tests/xpcshell/xpcshell.ini b/testing/modules/tests/xpcshell/xpcshell.ini index ffeec2d914cc..8e42180cdd2f 100644 --- a/testing/modules/tests/xpcshell/xpcshell.ini +++ b/testing/modules/tests/xpcshell/xpcshell.ini @@ -1,6 +1,6 @@ [DEFAULT] head = -skip-if = toolkit == 'android' || toolkit == 'gonk' +skip-if = toolkit == 'android' [test_assert.js] [test_mockRegistrar.js] diff --git a/testing/mozbase/mozrunner/mozrunner/utils.py b/testing/mozbase/mozrunner/mozrunner/utils.py index 3df2e1997418..b0efd1894d09 100755 --- a/testing/mozbase/mozrunner/mozrunner/utils.py +++ b/testing/mozbase/mozrunner/mozrunner/utils.py @@ -102,10 +102,7 @@ def test_environment(xrePath, env=None, crashreporter=True, debugger=False, envVar = None dmdLibrary = None preloadEnvVar = None - if 'toolkit' in mozinfo.info and mozinfo.info['toolkit'] == "gonk": - # Skip all of this, it's only valid for the host. - pass - elif mozinfo.isUnix: + if mozinfo.isUnix: envVar = "LD_LIBRARY_PATH" env['MOZILLA_FIVE_HOME'] = xrePath dmdLibrary = "libdmd.so" diff --git a/testing/xpcshell/example/unit/xpcshell.ini b/testing/xpcshell/example/unit/xpcshell.ini index 37085b29564c..db7cf3a750b4 100644 --- a/testing/xpcshell/example/unit/xpcshell.ini +++ b/testing/xpcshell/example/unit/xpcshell.ini @@ -4,7 +4,6 @@ [DEFAULT] head = -skip-if = toolkit == 'gonk' support-files = subdir/file.txt file.txt diff --git a/toolkit/components/captivedetect/captivedetect.js b/toolkit/components/captivedetect/captivedetect.js index 649334be06cf..3457aebbd6af 100644 --- a/toolkit/components/captivedetect/captivedetect.js +++ b/toolkit/components/captivedetect/captivedetect.js @@ -105,8 +105,6 @@ function LoginObserver(captivePortalDetector) { .getService(Ci.nsIHttpActivityDistributor); let urlFetcher = null; - let waitForNetworkActivity = Services.appinfo.widgetToolkit == "gonk"; - let pageCheckingDone = function pageCheckingDone() { if (state === LOGIN_OBSERVER_STATE_VERIFYING) { urlFetcher = null; @@ -195,14 +193,7 @@ function LoginObserver(captivePortalDetector) { state = LOGIN_OBSERVER_STATE_VERIFY_NEEDED; // Fall though to start polling timer case LOGIN_OBSERVER_STATE_IDLE: - if (waitForNetworkActivity) { - timer.initWithCallback(this, - captivePortalDetector._pollingTime, - timer.TYPE_ONE_SHOT); - break; - } - // if we don't need to wait for network activity, just fall through - // to perform a captive portal check. + // Just fall through to perform a captive portal check. case LOGIN_OBSERVER_STATE_VERIFY_NEEDED: // Polling the canonical website since network stays idle for a while state = LOGIN_OBSERVER_STATE_VERIFYING; diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index 8f50f292bd17..cd22b270fea7 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -776,7 +776,7 @@ File.prototype = { }; -if (SharedAll.Constants.Sys.Name != "Android" && SharedAll.Constants.Sys.Name != "Gonk") { +if (SharedAll.Constants.Sys.Name != "Android") { /** * Set the last access and modification date of the file. * The time stamp resolution is 1 second at best, but might be worse diff --git a/toolkit/components/osfile/tests/xpcshell/test_constants.js b/toolkit/components/osfile/tests/xpcshell/test_constants.js index d28ba4503282..6ef1f32f2dfd 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_constants.js +++ b/toolkit/components/osfile/tests/xpcshell/test_constants.js @@ -15,12 +15,7 @@ add_task(async function check_definition() { do_check_true(OS.Constants.Path!=null); do_check_true(OS.Constants.Sys!=null); //check system name - if (OS.Constants.Sys.Name == "Gonk") { - // Services.appinfo.OS doesn't know the difference between Gonk and Android - do_check_eq(Services.appinfo.OS, "Android"); - } else { - do_check_eq(Services.appinfo.OS, OS.Constants.Sys.Name); - } + do_check_eq(Services.appinfo.OS, OS.Constants.Sys.Name); //check if using DEBUG build if (Components.classes["@mozilla.org/xpcom/debug;1"].getService(Components.interfaces.nsIDebug2).isDebugBuild == true) { diff --git a/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js b/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js index 7a072d1c6c60..04ff0a5ee4a6 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js +++ b/toolkit/components/osfile/tests/xpcshell/test_osfile_async_setDates.js @@ -95,8 +95,8 @@ add_task(async function test_nonproto() { // Prototypical tests, operating on |File| handles. add_task(async function test_proto() { - if (OS.Constants.Sys.Name == "Android" || OS.Constants.Sys.Name == "Gonk") { - do_print("File.prototype.setDates is not implemented for Android/B2G"); + if (OS.Constants.Sys.Name == "Android") { + do_print("File.prototype.setDates is not implemented for Android"); do_check_eq(OS.File.prototype.setDates, undefined); return; } diff --git a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js index f45149eefa3a..1815ac6536f5 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js +++ b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js @@ -58,7 +58,7 @@ add_task(async function test_simple_paths() { // Test presence of paths that only exist on Desktop platforms add_task(async function test_desktop_paths() { - if (OS.Constants.Sys.Name == "Android" || OS.Constants.Sys.Name == "Gonk") { + if (OS.Constants.Sys.Name == "Android") { return; } do_check_true(!!OS.Constants.Path.desktopDir); diff --git a/toolkit/crashreporter/crashreporter.mozbuild b/toolkit/crashreporter/crashreporter.mozbuild index 7fdf71fb8ace..3f66ac745a02 100644 --- a/toolkit/crashreporter/crashreporter.mozbuild +++ b/toolkit/crashreporter/crashreporter.mozbuild @@ -35,7 +35,4 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']: '-Wno-c++11-narrowing', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': - DEFINES['ELFSIZE'] = 32 - DEFINES['NO_STABS_SUPPORT'] = True diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 888d2ff5a8c8..ef8d219ae177 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -1285,7 +1285,7 @@ BuildTempPath(char* aBuf, size_t aBufLen) static size_t BuildTempPath(char* aBuf, size_t aBufLen) { - // GeckoAppShell or Gonk's init.rc sets this in the environment + // GeckoAppShell sets this in the environment const char *tempenv = PR_GetEnv("TMPDIR"); if (!tempenv) { return false; diff --git a/toolkit/mozapps/extensions/extensions.manifest b/toolkit/mozapps/extensions/extensions.manifest index acea7bf25a02..4ba3cc7661ec 100644 --- a/toolkit/mozapps/extensions/extensions.manifest +++ b/toolkit/mozapps/extensions/extensions.manifest @@ -5,7 +5,6 @@ component {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} nsBlocklistServiceContent.js pr contract @mozilla.org/extensions/blocklist;1 {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} process=content category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400 -#ifndef MOZ_WIDGET_GONK component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa} #ifndef MOZ_WIDGET_ANDROID @@ -20,6 +19,5 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm #endif category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm -#endif component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235} diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index cdec301f312f..7c5e26a1452f 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -27,9 +27,6 @@ ifdef MOZ_SIGN_PREPARED_PACKAGE_CMD $(MOZ_SIGN_PREPARED_PACKAGE_CMD) $(DEPTH)/installer-stage && true endif -ifeq (gonk,$(MOZ_WIDGET_TOOLKIT)) -ELF_HACK_FLAGS = --fill -endif export USE_ELF_HACK ELF_HACK_FLAGS # Override the value of OMNIJAR_NAME from config.status with the value diff --git a/toolkit/mozapps/installer/upload-files.mk b/toolkit/mozapps/installer/upload-files.mk index b66d9b222bc2..5ca364277987 100644 --- a/toolkit/mozapps/installer/upload-files.mk +++ b/toolkit/mozapps/installer/upload-files.mk @@ -335,9 +335,7 @@ endif ifneq (android,$(MOZ_WIDGET_TOOLKIT)) OPTIMIZEJARS = 1 - ifneq (gonk,$(MOZ_WIDGET_TOOLKIT)) - DISABLE_JAR_COMPRESSION = 1 - endif + DISABLE_JAR_COMPRESSION = 1 endif # A js binary is needed to perform verification of JavaScript minification. diff --git a/toolkit/mozapps/update/nsIUpdateService.idl b/toolkit/mozapps/update/nsIUpdateService.idl index 9e6820a09c62..2ae7efe1d1e1 100644 --- a/toolkit/mozapps/update/nsIUpdateService.idl +++ b/toolkit/mozapps/update/nsIUpdateService.idl @@ -413,7 +413,7 @@ interface nsIUpdateProcessor : nsISupports * On Windows, this can also be used for switching to an applied * update request. * @param update The update being applied, or null if this is a switch - * to updated application request. Must be non-null on GONK. + * to updated application request. */ void processUpdate(in nsIUpdate update); }; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 25a7d302df94..49a7434b9cad 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -1809,7 +1809,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ if (type == kWriteError) { // Attempt to write without sufficient permissions. #if defined(ANDROID) - // On Android (and Gonk), this means the SD card is present but + // On Android this means the SD card is present but // unavailable (read-only). msgId = "SDAccessErrorCardReadOnly"; #else @@ -1830,7 +1830,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ } #if defined(ANDROID) else if (type == kWriteError) { - // On Android (and Gonk), this means the SD card is missing (not in + // On Android this means the SD card is missing (not in // SD slot). msgId = "SDAccessErrorCardMissing"; break; diff --git a/widget/NativeKeyToDOMCodeName.h b/widget/NativeKeyToDOMCodeName.h index cd326a0d86bd..bf1fa077e620 100644 --- a/widget/NativeKeyToDOMCodeName.h +++ b/widget/NativeKeyToDOMCodeName.h @@ -21,7 +21,7 @@ #define CODE_MAP_MAC(aCPPCodeName, aNativeKey) // GTK and Qt on Linux #define CODE_MAP_X11(aCPPCodeName, aNativeKey) -// Android and Gonk +// Android #define CODE_MAP_ANDROID(aCPPCodeName, aNativeKey) #if defined(XP_WIN) diff --git a/widget/tests/TestAppShellSteadyState.cpp b/widget/tests/TestAppShellSteadyState.cpp index 03888fc0a8af..162343e38f16 100644 --- a/widget/tests/TestAppShellSteadyState.cpp +++ b/widget/tests/TestAppShellSteadyState.cpp @@ -310,7 +310,7 @@ already_AddRefed GetAppShell() { static const char* platforms[] = { - "android", "mac", "gonk", "gtk", "qt", "win" + "android", "mac", "gtk", "qt", "win" }; NS_NAMED_LITERAL_CSTRING(contractPrefix, "@mozilla.org/widget/appshell/"); diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index f9141dfc4be6..30454afb5315 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -169,27 +169,10 @@ * * Mac: ~/Library/Caches/Mozilla/updates/ * - * Gonk: /data/local - * * All others: Parent directory of XRE_EXECUTABLE_FILE. */ #define XRE_UPDATE_ROOT_DIR "UpdRootD" -/** - * A directory service key which provides an alternate location - * to UpdRootD to to store large files. This key is currently - * only implemented in the Gonk directory service provider. - */ - -#define XRE_UPDATE_ARCHIVE_DIR "UpdArchD" - -/** - * A directory service key which provides the directory where an OS update is -* applied. - * At present this is supported only in Gonk. - */ -#define XRE_OS_UPDATE_APPLY_TO_DIR "OSUpdApplyToD" - /** * Begin an XUL application. Does not return until the user exits the * application. From a7456c176c4a63a819d02899782d30c18fc327fd Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 16:53:10 +0900 Subject: [PATCH 05/31] Bug 1395070 - Replace MOZ_MEMORY_WINDOWS with XP_WIN. r=njn --- dom/plugins/base/nsNPAPIPlugin.cpp | 6 +-- memory/mozjemalloc/mozjemalloc.cpp | 72 +++++++++++++++--------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index ccdc0f567ace..2170c17a4fca 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -435,7 +435,7 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target, return NPERR_NO_ERROR; } -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(MOZ_MEMORY) && defined(XP_WIN) extern "C" size_t malloc_usable_size(const void *ptr); #endif @@ -506,7 +506,7 @@ doGetIdentifier(JSContext *cx, const NPUTF8* name) return StringToNPIdentifier(cx, str); } -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(MOZ_MEMORY) && defined(XP_WIN) BOOL InHeap(HANDLE hHeap, LPVOID lpMem) { @@ -1509,7 +1509,7 @@ _releasevariantvalue(NPVariant* variant) const NPString *s = &NPVARIANT_TO_STRING(*variant); if (s->UTF8Characters) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(MOZ_MEMORY) && defined(XP_WIN) if (malloc_usable_size((void *)s->UTF8Characters) != 0) { free((void*)s->UTF8Characters); } else { diff --git a/memory/mozjemalloc/mozjemalloc.cpp b/memory/mozjemalloc/mozjemalloc.cpp index 37fc8f8561d3..6920fd88f144 100644 --- a/memory/mozjemalloc/mozjemalloc.cpp +++ b/memory/mozjemalloc/mozjemalloc.cpp @@ -141,7 +141,7 @@ #include #include -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN /* Some defines from the CRT internal headers that we need here. */ #define _CRT_SPINCOUNT 5000 @@ -194,7 +194,7 @@ typedef long ssize_t; #define MALLOC_DECOMMIT #endif -#ifndef MOZ_MEMORY_WINDOWS +#ifndef XP_WIN #ifndef MOZ_MEMORY_SOLARIS #include #endif @@ -298,7 +298,7 @@ void *_mmap(void *addr, size_t length, int prot, int flags, static pthread_key_t tlsIndex; #endif -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN /* MSVC++ does not support C99 variable-length arrays. */ # define RB_NO_C99_VARARRAYS #endif @@ -358,7 +358,7 @@ static pthread_key_t tlsIndex; * must be 8 bytes on 32-bit, 16 bytes on 64-bit. On Linux and Mac, even * malloc(1) must reserve a word's worth of memory (see Mozilla bug 691003). */ -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN #define TINY_MIN_2POW (sizeof(void*) == 8 ? 4 : 3) #else #define TINY_MIN_2POW (sizeof(void*) == 8 ? 3 : 2) @@ -405,7 +405,7 @@ static pthread_key_t tlsIndex; * places, because they require malloc()ed memory, which causes bootstrapping * issues in some cases. */ -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) #define malloc_mutex_t CRITICAL_SECTION #define malloc_spinlock_t CRITICAL_SECTION #elif defined(MOZ_MEMORY_DARWIN) @@ -423,7 +423,7 @@ typedef pthread_mutex_t malloc_spinlock_t; /* Set to true once the allocator has been initialized. */ static bool malloc_initialized = false; -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) /* No init lock for Windows. */ #elif defined(MOZ_MEMORY_DARWIN) static malloc_mutex_t init_lock = {OS_SPINLOCK_INIT}; @@ -953,7 +953,7 @@ static malloc_spinlock_t arenas_lock; /* Protects arenas initialization. */ * Map of pthread_self() --> arenas[???], used for selecting an arena to use * for allocations. */ -#if !defined(MOZ_MEMORY_WINDOWS) && !defined(MOZ_MEMORY_DARWIN) +#if !defined(XP_WIN) && !defined(MOZ_MEMORY_DARWIN) static __thread arena_t *arenas_map; #endif #endif @@ -997,7 +997,7 @@ static void *huge_malloc(size_t size, bool zero); static void *huge_palloc(size_t size, size_t alignment, bool zero); static void *huge_ralloc(void *ptr, size_t size, size_t oldsize); static void huge_dalloc(void *ptr); -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN extern "C" #else static @@ -1022,7 +1022,7 @@ static inline size_t load_acquire_z(size_t *p) { volatile size_t result = *p; -# ifdef MOZ_MEMORY_WINDOWS +# ifdef XP_WIN /* * We use InterlockedExchange with a dummy value to insert a memory * barrier. This has been confirmed to generate the right instruction @@ -1039,7 +1039,7 @@ load_acquire_z(size_t *p) static void _malloc_message(const char *p) { -#if !defined(MOZ_MEMORY_WINDOWS) +#if !defined(XP_WIN) #define _write write #endif // Pretend to check _write() errors to suppress gcc warnings about @@ -1078,7 +1078,7 @@ int pthread_atfork(void (*)(void), void (*)(void), void(*)(void)); static bool malloc_mutex_init(malloc_mutex_t *mutex) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) if (!InitializeCriticalSectionAndSpinCount(mutex, _CRT_SPINCOUNT)) return (true); #elif defined(MOZ_MEMORY_DARWIN) @@ -1104,7 +1104,7 @@ static inline void malloc_mutex_lock(malloc_mutex_t *mutex) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) EnterCriticalSection(mutex); #elif defined(MOZ_MEMORY_DARWIN) OSSpinLockLock(&mutex->lock); @@ -1117,7 +1117,7 @@ static inline void malloc_mutex_unlock(malloc_mutex_t *mutex) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) LeaveCriticalSection(mutex); #elif defined(MOZ_MEMORY_DARWIN) OSSpinLockUnlock(&mutex->lock); @@ -1132,7 +1132,7 @@ __attribute__((unused)) static bool malloc_spin_init(malloc_spinlock_t *lock) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) if (!InitializeCriticalSectionAndSpinCount(lock, _CRT_SPINCOUNT)) return (true); #elif defined(MOZ_MEMORY_DARWIN) @@ -1158,7 +1158,7 @@ static inline void malloc_spin_lock(malloc_spinlock_t *lock) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) EnterCriticalSection(lock); #elif defined(MOZ_MEMORY_DARWIN) OSSpinLockLock(&lock->lock); @@ -1170,7 +1170,7 @@ malloc_spin_lock(malloc_spinlock_t *lock) static inline void malloc_spin_unlock(malloc_spinlock_t *lock) { -#if defined(MOZ_MEMORY_WINDOWS) +#if defined(XP_WIN) LeaveCriticalSection(lock); #elif defined(MOZ_MEMORY_DARWIN) OSSpinLockUnlock(&lock->lock); @@ -1258,7 +1258,7 @@ static inline void pages_decommit(void *addr, size_t size) { -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN /* * The region starting at addr may have been allocated in multiple calls * to VirtualAlloc and recycled, so decommitting the entire region in one @@ -1286,7 +1286,7 @@ static inline void pages_commit(void *addr, size_t size) { -# ifdef MOZ_MEMORY_WINDOWS +# ifdef XP_WIN /* * The region starting at addr may have been allocated in multiple calls * to VirtualAlloc and recycled, so committing the entire region in one @@ -1492,7 +1492,7 @@ extent_tree_bounds_search(extent_tree_t *tree, extent_node_t *key) { * Begin chunk management functions. */ -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN static void * pages_map(void *addr, size_t size) @@ -1800,7 +1800,7 @@ pages_trim(void *addr, size_t alloc_size, size_t leadsize, size_t size) void *ret = (void *)((uintptr_t)addr + leadsize); MOZ_ASSERT(alloc_size >= leadsize + size); -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN { void *new_addr; @@ -1898,7 +1898,7 @@ pages_purge(void *addr, size_t length, bool force_zero) if (force_zero) memset(addr, 0, length); # endif -# ifdef MOZ_MEMORY_WINDOWS +# ifdef XP_WIN /* * The region starting at addr may have been allocated in multiple calls * to VirtualAlloc and recycled, so resetting the entire region in one @@ -2023,7 +2023,7 @@ chunk_recycle(extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, size_t size, return (ret); } -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN /* * On Windows, calls to VirtualAlloc and VirtualFree must be matched, making it * awkward to recycle allocations of varying sizes. Therefore we only allow @@ -2246,7 +2246,7 @@ thread_local_arena(bool enabled) arena = arenas[0]; malloc_spin_unlock(&arenas_lock); } -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN TlsSetValue(tlsIndex, arena); #elif defined(MOZ_MEMORY_DARWIN) pthread_setspecific(tlsIndex, arena); @@ -2281,7 +2281,7 @@ choose_arena(void) */ #ifndef NO_TLS -# ifdef MOZ_MEMORY_WINDOWS +# ifdef XP_WIN ret = (arena_t*)TlsGetValue(tlsIndex); # elif defined(MOZ_MEMORY_DARWIN) ret = (arena_t*)pthread_getspecific(tlsIndex); @@ -4354,7 +4354,7 @@ huge_dalloc(void *ptr) * implementation has to take pains to avoid infinite recursion during * initialization. */ -#if (defined(MOZ_MEMORY_WINDOWS) || defined(MOZ_MEMORY_DARWIN)) +#if (defined(XP_WIN) || defined(MOZ_MEMORY_DARWIN)) #define malloc_init() false #else static inline bool @@ -4372,7 +4372,7 @@ malloc_init(void) extern "C" void register_zone(void); #endif -#if !defined(MOZ_MEMORY_WINDOWS) +#if !defined(XP_WIN) static #endif bool @@ -4382,7 +4382,7 @@ malloc_init_hard(void) const char *opts; long result; -#ifndef MOZ_MEMORY_WINDOWS +#ifndef XP_WIN malloc_mutex_lock(&init_lock); #endif @@ -4391,13 +4391,13 @@ malloc_init_hard(void) * Another thread initialized the allocator before this one * acquired init_lock. */ -#ifndef MOZ_MEMORY_WINDOWS +#ifndef XP_WIN malloc_mutex_unlock(&init_lock); #endif return (false); } -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN /* get a thread local storage index */ tlsIndex = TlsAlloc(); #elif defined(MOZ_MEMORY_DARWIN) @@ -4405,7 +4405,7 @@ malloc_init_hard(void) #endif /* Get page size and number of CPUs */ -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN { SYSTEM_INFO info; @@ -4602,7 +4602,7 @@ malloc_init_hard(void) */ arenas_extend(); if (!arenas || !arenas[0]) { -#ifndef MOZ_MEMORY_WINDOWS +#ifndef XP_WIN malloc_mutex_unlock(&init_lock); #endif return (true); @@ -4613,7 +4613,7 @@ malloc_init_hard(void) * spurious creation of an extra arena if the application switches to * threaded mode. */ -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN TlsSetValue(tlsIndex, arenas[0]); #elif defined(MOZ_MEMORY_DARWIN) pthread_setspecific(tlsIndex, arenas[0]); @@ -4628,7 +4628,7 @@ malloc_init_hard(void) malloc_initialized = true; -#if !defined(MOZ_MEMORY_WINDOWS) && !defined(MOZ_MEMORY_DARWIN) +#if !defined(XP_WIN) && !defined(MOZ_MEMORY_DARWIN) /* Prevent potential deadlock on malloc locks after fork. */ pthread_atfork(_malloc_prefork, _malloc_postfork_parent, _malloc_postfork_child); #endif @@ -4637,7 +4637,7 @@ malloc_init_hard(void) register_zone(); #endif -#ifndef MOZ_MEMORY_WINDOWS +#ifndef XP_WIN malloc_mutex_unlock(&init_lock); #endif return (false); @@ -5096,7 +5096,7 @@ jemalloc_purge_freed_pages_impl() -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN void* _recalloc(void *ptr, size_t count, size_t size) { @@ -5289,7 +5289,7 @@ MOZ_EXPORT void *(*__memalign_hook)(size_t alignment, size_t size) = MEMALIGN; # endif #endif -#ifdef MOZ_MEMORY_WINDOWS +#ifdef XP_WIN /* * In the new style jemalloc integration jemalloc is built as a separate * shared library. Since we're no longer hooking into the CRT binary, From e08683df0675e794644f9ad2507b8d87f46db949 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 16:54:17 +0900 Subject: [PATCH 06/31] Bug 1395070 - Replace MOZ_MEMORY_DARWIN with XP_DARWIN. r=njn --- memory/mozjemalloc/mozjemalloc.cpp | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/memory/mozjemalloc/mozjemalloc.cpp b/memory/mozjemalloc/mozjemalloc.cpp index 6920fd88f144..e068589d3cdc 100644 --- a/memory/mozjemalloc/mozjemalloc.cpp +++ b/memory/mozjemalloc/mozjemalloc.cpp @@ -128,7 +128,7 @@ * The jemalloc_purge_freed_pages definition in memory/build/mozmemory.h needs * to be adjusted if MALLOC_DOUBLE_PURGE is ever enabled on Linux. */ -#ifdef MOZ_MEMORY_DARWIN +#ifdef XP_DARWIN #define MALLOC_DOUBLE_PURGE #endif @@ -223,12 +223,12 @@ typedef long ssize_t; #include #include #include -#ifndef MOZ_MEMORY_DARWIN +#ifndef XP_DARWIN #include #endif #include -#ifdef MOZ_MEMORY_DARWIN +#ifdef XP_DARWIN #include #include #include @@ -294,7 +294,7 @@ void *_mmap(void *addr, size_t length, int prot, int flags, #endif #endif -#ifdef MOZ_MEMORY_DARWIN +#ifdef XP_DARWIN static pthread_key_t tlsIndex; #endif @@ -408,7 +408,7 @@ static pthread_key_t tlsIndex; #if defined(XP_WIN) #define malloc_mutex_t CRITICAL_SECTION #define malloc_spinlock_t CRITICAL_SECTION -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) typedef struct { OSSpinLock lock; } malloc_mutex_t; @@ -425,7 +425,7 @@ static bool malloc_initialized = false; #if defined(XP_WIN) /* No init lock for Windows. */ -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) static malloc_mutex_t init_lock = {OS_SPINLOCK_INIT}; #elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID) static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; @@ -953,7 +953,7 @@ static malloc_spinlock_t arenas_lock; /* Protects arenas initialization. */ * Map of pthread_self() --> arenas[???], used for selecting an arena to use * for allocations. */ -#if !defined(XP_WIN) && !defined(MOZ_MEMORY_DARWIN) +#if !defined(XP_WIN) && !defined(XP_DARWIN) static __thread arena_t *arenas_map; #endif #endif @@ -1004,7 +1004,7 @@ static #endif bool malloc_init_hard(void); -#ifdef MOZ_MEMORY_DARWIN +#ifdef XP_DARWIN #define FORK_HOOK extern "C" #else #define FORK_HOOK static @@ -1081,7 +1081,7 @@ malloc_mutex_init(malloc_mutex_t *mutex) #if defined(XP_WIN) if (!InitializeCriticalSectionAndSpinCount(mutex, _CRT_SPINCOUNT)) return (true); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) mutex->lock = OS_SPINLOCK_INIT; #elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID) pthread_mutexattr_t attr; @@ -1106,7 +1106,7 @@ malloc_mutex_lock(malloc_mutex_t *mutex) #if defined(XP_WIN) EnterCriticalSection(mutex); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) OSSpinLockLock(&mutex->lock); #else pthread_mutex_lock(mutex); @@ -1119,7 +1119,7 @@ malloc_mutex_unlock(malloc_mutex_t *mutex) #if defined(XP_WIN) LeaveCriticalSection(mutex); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) OSSpinLockUnlock(&mutex->lock); #else pthread_mutex_unlock(mutex); @@ -1135,7 +1135,7 @@ malloc_spin_init(malloc_spinlock_t *lock) #if defined(XP_WIN) if (!InitializeCriticalSectionAndSpinCount(lock, _CRT_SPINCOUNT)) return (true); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) lock->lock = OS_SPINLOCK_INIT; #elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID) pthread_mutexattr_t attr; @@ -1160,7 +1160,7 @@ malloc_spin_lock(malloc_spinlock_t *lock) #if defined(XP_WIN) EnterCriticalSection(lock); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) OSSpinLockLock(&lock->lock); #else pthread_mutex_lock(lock); @@ -1172,7 +1172,7 @@ malloc_spin_unlock(malloc_spinlock_t *lock) { #if defined(XP_WIN) LeaveCriticalSection(lock); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) OSSpinLockUnlock(&lock->lock); #else pthread_mutex_unlock(lock); @@ -1189,7 +1189,7 @@ malloc_spin_unlock(malloc_spinlock_t *lock) * priority inversion. */ -#if !defined(MOZ_MEMORY_DARWIN) +#if !defined(XP_DARWIN) # define malloc_spin_init malloc_mutex_init # define malloc_spin_lock malloc_mutex_lock # define malloc_spin_unlock malloc_mutex_unlock @@ -1627,7 +1627,7 @@ pages_unmap(void *addr, size_t size) } #endif -#ifdef MOZ_MEMORY_DARWIN +#ifdef XP_DARWIN #define VM_COPY_MIN (pagesize << 5) static inline void pages_copy(void *dest, const void *src, size_t n) @@ -2248,7 +2248,7 @@ thread_local_arena(bool enabled) } #ifdef XP_WIN TlsSetValue(tlsIndex, arena); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) pthread_setspecific(tlsIndex, arena); #else arenas_map = arena; @@ -2283,7 +2283,7 @@ choose_arena(void) # ifdef XP_WIN ret = (arena_t*)TlsGetValue(tlsIndex); -# elif defined(MOZ_MEMORY_DARWIN) +# elif defined(XP_DARWIN) ret = (arena_t*)pthread_getspecific(tlsIndex); # else ret = arenas_map; @@ -4354,7 +4354,7 @@ huge_dalloc(void *ptr) * implementation has to take pains to avoid infinite recursion during * initialization. */ -#if (defined(XP_WIN) || defined(MOZ_MEMORY_DARWIN)) +#if (defined(XP_WIN) || defined(XP_DARWIN)) #define malloc_init() false #else static inline bool @@ -4368,7 +4368,7 @@ malloc_init(void) } #endif -#if defined(MOZ_MEMORY_DARWIN) +#if defined(XP_DARWIN) extern "C" void register_zone(void); #endif @@ -4400,7 +4400,7 @@ malloc_init_hard(void) #ifdef XP_WIN /* get a thread local storage index */ tlsIndex = TlsAlloc(); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) pthread_key_create(&tlsIndex, nullptr); #endif @@ -4615,7 +4615,7 @@ malloc_init_hard(void) */ #ifdef XP_WIN TlsSetValue(tlsIndex, arenas[0]); -#elif defined(MOZ_MEMORY_DARWIN) +#elif defined(XP_DARWIN) pthread_setspecific(tlsIndex, arenas[0]); #else arenas_map = arenas[0]; @@ -4628,12 +4628,12 @@ malloc_init_hard(void) malloc_initialized = true; -#if !defined(XP_WIN) && !defined(MOZ_MEMORY_DARWIN) +#if !defined(XP_WIN) && !defined(XP_DARWIN) /* Prevent potential deadlock on malloc locks after fork. */ pthread_atfork(_malloc_prefork, _malloc_postfork_parent, _malloc_postfork_child); #endif -#if defined(MOZ_MEMORY_DARWIN) +#if defined(XP_DARWIN) register_zone(); #endif @@ -4687,7 +4687,7 @@ malloc_impl(size_t size) */ #ifndef MOZ_REPLACE_MALLOC -#if defined(__GNUC__) && !defined(MOZ_MEMORY_DARWIN) +#if defined(__GNUC__) && !defined(XP_DARWIN) #define MOZ_MEMORY_ELF #endif #endif /* MOZ_REPLACE_MALLOC */ @@ -5169,7 +5169,7 @@ jemalloc_free_dirty_pages_impl(void) * is threaded here. */ -#ifndef MOZ_MEMORY_DARWIN +#ifndef XP_DARWIN static #endif void @@ -5190,7 +5190,7 @@ _malloc_prefork(void) malloc_mutex_lock(&huge_mtx); } -#ifndef MOZ_MEMORY_DARWIN +#ifndef XP_DARWIN static #endif void @@ -5211,7 +5211,7 @@ _malloc_postfork_parent(void) malloc_spin_unlock(&arenas_lock); } -#ifndef MOZ_MEMORY_DARWIN +#ifndef XP_DARWIN static #endif void @@ -5241,7 +5241,7 @@ _malloc_postfork_child(void) # include #endif -#if defined(MOZ_MEMORY_DARWIN) +#if defined(XP_DARWIN) __attribute__((constructor)) void @@ -5261,7 +5261,7 @@ jemalloc_darwin_init(void) #define is_malloc_(a) malloc_is_ ## a #define is_malloc(a) is_malloc_(a) -#if !defined(MOZ_MEMORY_DARWIN) && (is_malloc(malloc_impl) == 1) +#if !defined(XP_DARWIN) && (is_malloc(malloc_impl) == 1) # if defined(__GLIBC__) && !defined(__UCLIBC__) /* * glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible From 195fb01e17b70ee227970c2120524623e094520d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 16:55:30 +0900 Subject: [PATCH 07/31] Bug 1395070 - Replace MOZ_MEMORY_LINUX with XP_LINUX. r=njn --- memory/mozjemalloc/mozjemalloc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/memory/mozjemalloc/mozjemalloc.cpp b/memory/mozjemalloc/mozjemalloc.cpp index e068589d3cdc..c35771b450be 100644 --- a/memory/mozjemalloc/mozjemalloc.cpp +++ b/memory/mozjemalloc/mozjemalloc.cpp @@ -255,7 +255,7 @@ extern "C" void moz_abort(); * On Alpha, glibc has a bug that prevents syscall() to work for system * calls with 6 arguments */ -#if (defined(MOZ_MEMORY_LINUX) && !defined(__alpha__)) || \ +#if (defined(XP_LINUX) && !defined(__alpha__)) || \ (defined(MOZ_MEMORY_BSD) && defined(__GLIBC__)) #include #if defined(SYS_mmap) || defined(SYS_mmap2) @@ -427,7 +427,7 @@ static bool malloc_initialized = false; /* No init lock for Windows. */ #elif defined(XP_DARWIN) static malloc_mutex_t init_lock = {OS_SPINLOCK_INIT}; -#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID) +#elif defined(XP_LINUX) && !defined(MOZ_MEMORY_ANDROID) static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; #else static malloc_mutex_t init_lock = PTHREAD_MUTEX_INITIALIZER; @@ -1083,7 +1083,7 @@ malloc_mutex_init(malloc_mutex_t *mutex) return (true); #elif defined(XP_DARWIN) mutex->lock = OS_SPINLOCK_INIT; -#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID) +#elif defined(XP_LINUX) && !defined(MOZ_MEMORY_ANDROID) pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) return (true); @@ -1137,7 +1137,7 @@ malloc_spin_init(malloc_spinlock_t *lock) return (true); #elif defined(XP_DARWIN) lock->lock = OS_SPINLOCK_INIT; -#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID) +#elif defined(XP_LINUX) && !defined(MOZ_MEMORY_ANDROID) pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) return (true); @@ -1894,7 +1894,7 @@ pages_purge(void *addr, size_t length, bool force_zero) pages_decommit(addr, length); return true; #else -# ifndef MOZ_MEMORY_LINUX +# ifndef XP_LINUX if (force_zero) memset(addr, 0, length); # endif @@ -1915,7 +1915,7 @@ pages_purge(void *addr, size_t length, bool force_zero) } return force_zero; # else -# ifdef MOZ_MEMORY_LINUX +# ifdef XP_LINUX # define JEMALLOC_MADV_PURGE MADV_DONTNEED # define JEMALLOC_MADV_ZEROS true # else /* FreeBSD and Darwin. */ From 4734ffd7ad06741b971bfe9437f1b53ee7991d44 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 16:56:42 +0900 Subject: [PATCH 08/31] Bug 1395070 - Replace MOZ_MEMORY_ANDROID with ANDROID. r=njn For some reason, we don't have a XP_ macro for Android, and we generally use ANDROID or MOZ_WIDGET_ANDROID. The former is more appropriate. --- memory/mozjemalloc/mozjemalloc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/memory/mozjemalloc/mozjemalloc.cpp b/memory/mozjemalloc/mozjemalloc.cpp index c35771b450be..42df29d21619 100644 --- a/memory/mozjemalloc/mozjemalloc.cpp +++ b/memory/mozjemalloc/mozjemalloc.cpp @@ -103,7 +103,7 @@ #include "mozmemory_wrap.h" #include "mozilla/Sprintf.h" -#ifdef MOZ_MEMORY_ANDROID +#ifdef ANDROID #define NO_TLS #endif @@ -276,7 +276,7 @@ void *_mmap(void *addr, size_t length, int prot, int flags, } args = { addr, length, prot, flags, fd, offset }; return (void *) syscall(SYS_mmap, &args); #else -#if defined(MOZ_MEMORY_ANDROID) && defined(__aarch64__) && defined(SYS_mmap2) +#if defined(ANDROID) && defined(__aarch64__) && defined(SYS_mmap2) /* Android NDK defines SYS_mmap2 for AArch64 despite it not supporting mmap2 */ #undef SYS_mmap2 #endif @@ -427,7 +427,7 @@ static bool malloc_initialized = false; /* No init lock for Windows. */ #elif defined(XP_DARWIN) static malloc_mutex_t init_lock = {OS_SPINLOCK_INIT}; -#elif defined(XP_LINUX) && !defined(MOZ_MEMORY_ANDROID) +#elif defined(XP_LINUX) && !defined(ANDROID) static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; #else static malloc_mutex_t init_lock = PTHREAD_MUTEX_INITIALIZER; @@ -1062,7 +1062,7 @@ _malloc_message(const char *p, Args... args) // Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap // instead of the one defined here; use only MozTagAnonymousMemory(). -#ifdef MOZ_MEMORY_ANDROID +#ifdef ANDROID // Android's pthread.h does not declare pthread_atfork() until SDK 21. extern "C" MOZ_EXPORT int pthread_atfork(void (*)(void), void (*)(void), void(*)(void)); @@ -1083,7 +1083,7 @@ malloc_mutex_init(malloc_mutex_t *mutex) return (true); #elif defined(XP_DARWIN) mutex->lock = OS_SPINLOCK_INIT; -#elif defined(XP_LINUX) && !defined(MOZ_MEMORY_ANDROID) +#elif defined(XP_LINUX) && !defined(ANDROID) pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) return (true); @@ -1137,7 +1137,7 @@ malloc_spin_init(malloc_spinlock_t *lock) return (true); #elif defined(XP_DARWIN) lock->lock = OS_SPINLOCK_INIT; -#elif defined(XP_LINUX) && !defined(MOZ_MEMORY_ANDROID) +#elif defined(XP_LINUX) && !defined(ANDROID) pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) return (true); From 1e7ab26aa373f05ba4ec0a925a341b34ee0fb847 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 16:57:46 +0900 Subject: [PATCH 09/31] Bug 1395070 - Replace MOZ_MEMORY_SOLARIS with XP_SOLARIS. r=njn --- memory/mozjemalloc/mozjemalloc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory/mozjemalloc/mozjemalloc.cpp b/memory/mozjemalloc/mozjemalloc.cpp index 42df29d21619..e787065378c2 100644 --- a/memory/mozjemalloc/mozjemalloc.cpp +++ b/memory/mozjemalloc/mozjemalloc.cpp @@ -195,7 +195,7 @@ typedef long ssize_t; #endif #ifndef XP_WIN -#ifndef MOZ_MEMORY_SOLARIS +#ifndef XP_SOLARIS #include #endif #include From cf9a5fc0d1f15d53a36831f1a63a63ef9c026a56 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 16:58:42 +0900 Subject: [PATCH 10/31] Bug 1395070 - Replace MOZ_MEMORY_BSD with __FreeBSD_kernel__. r=njn While MOZ_MEMORY_BSD is set for kFreeBSD, FreeBSD and NetBSD, the only use of MOZ_MEMORY_BSD is along a check for __GLIBC__ which can only be true on GNU/kFreeBSD, which doesn't have a XP_ macro, but which we usually match with __FreeBSD_kernel__. --- memory/mozjemalloc/mozjemalloc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory/mozjemalloc/mozjemalloc.cpp b/memory/mozjemalloc/mozjemalloc.cpp index e787065378c2..076e64ecf817 100644 --- a/memory/mozjemalloc/mozjemalloc.cpp +++ b/memory/mozjemalloc/mozjemalloc.cpp @@ -256,7 +256,7 @@ extern "C" void moz_abort(); * calls with 6 arguments */ #if (defined(XP_LINUX) && !defined(__alpha__)) || \ - (defined(MOZ_MEMORY_BSD) && defined(__GLIBC__)) + (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) #include #if defined(SYS_mmap) || defined(SYS_mmap2) static inline From e2e84f2b605820297f04b61b8ca2f25d1790d7c0 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 30 Aug 2017 17:01:30 +0900 Subject: [PATCH 11/31] Bug 1395070 - Remove the MOZ_MEMORY_$platform defines. r=njn --- build/moz.configure/memory.configure | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure index 23d3cad8ebbe..05452ed20017 100644 --- a/build/moz.configure/memory.configure +++ b/build/moz.configure/memory.configure @@ -31,6 +31,10 @@ def jemalloc(value, target, build_project, c_compiler): if target.kernel == 'Linux': return True + if value and target.kernel not in ('WINNT', 'Linux', 'Darwin', 'kFreeBSD', + 'FreeBSD', 'NetBSD'): + die('--enable-jemalloc is not supported on %s', target.kernel) + set_config('MOZ_MEMORY', jemalloc) set_define('MOZ_MEMORY', jemalloc) @@ -47,29 +51,6 @@ def jemalloc_for_old_configure(jemalloc): add_old_configure_arg(jemalloc_for_old_configure) -@depends(jemalloc, target) -def jemalloc_os_define(jemalloc, target): - if jemalloc: - if target.kernel == 'WINNT': - return 'MOZ_MEMORY_WINDOWS' - if target.kernel == 'Linux': - return 'MOZ_MEMORY_LINUX' - if target.kernel == 'Darwin': - return 'MOZ_MEMORY_DARWIN' - if target.kernel in ('kFreeBSD', 'FreeBSD', 'NetBSD'): - return 'MOZ_MEMORY_BSD' - die('--enable-jemalloc is not supported on %s', target.kernel) - -set_define(jemalloc_os_define, '1') - -@depends(jemalloc, target) -def jemalloc_os_define_android(jemalloc, target): - if jemalloc and target.os == 'Android': - return 'MOZ_MEMORY_ANDROID' - -set_define(jemalloc_os_define_android, '1') - - option('--enable-replace-malloc', help='Enable ability to dynamically replace the malloc implementation') From d39d35bf2a90286f67b7c4a9c7899043957d2dd0 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Fri, 22 Sep 2017 12:26:42 -0500 Subject: [PATCH 12/31] Bug 1392643 Turn on c++14 for MinGW globally r=bagder,froydnj Technically this turns on gnu++14. I encountered a few errors when using c++14: 1) _USE_MATH_DEFINES needed to be defined for MinGW 2) MinGW did not define _finite under c++14 3) MinGW's float.h did not define Microsoft specific float functions under c++14 All of these were because c++14 defines _STRICT_ANSI_ which MinGW obeys and avoids defining certain functions. The first two could be patched around, but the third was a blocker, so we switched to gnu++14 --- build/moz.configure/toolchain.configure | 23 ++++++++---- .../configure/test_toolchain_configure.py | 36 ++++++++++++++++--- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index ca8d318c29d1..9cc6188f7043 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -475,13 +475,24 @@ def check_compiler(compiler, language, target): # Note: MSVC, while supporting C++11, still reports 199711L for __cplusplus. # Note: this is a strict version check because we used to always add # -std=gnu++11. + draft_cxx14_version = 201300 + cxx14_version = 201402 if info.language == 'C++': - if info.type in ('clang', 'gcc') and info.language_version != 201103: - append_flag('-std=gnu++11') - # MSVC 2015 headers include C++14 features, but don't guard them - # with appropriate checks. - if info.type == 'clang-cl' and info.language_version != 201402: - append_flag('-std=c++14') + if target.kernel != 'WINNT': + if info.type in ('clang', 'gcc') and info.language_version != 201103: + append_flag('-std=gnu++11') + else: + if info.type == 'clang' and info.language_version != 201103: + append_flag('-std=gnu++11') + # 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') + # GCC 4.9 indicates that it implements draft C++14 features + # instead of the full language. + elif info.type == 'gcc' and not \ + (info.language_version == draft_cxx14_version or info.language_version == cxx14_version): + append_flag('-std=gnu++14') # We force clang-cl to emulate Visual C++ 2017 version 15.4 if info.type == 'clang-cl' and info.version != '19.11.25547': diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py index 935f5e51e673..9089d6527cd1 100644 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py @@ -37,6 +37,10 @@ '__cplusplus': '201103L', } +DRAFT_CXX_14 = { + '__cplusplus': '201300L', +} + DEFAULT_CXX_14 = { '__cplusplus': '201402L', } @@ -49,6 +53,10 @@ '-std=gnu++11': DEFAULT_CXX_11, } +SUPPORTS_GNUXX14 = { + '-std=gnu++14': DEFAULT_CXX_14, +} + SUPPORTS_CXX14 = { '-std=c++14': DEFAULT_CXX_14, } @@ -76,13 +84,16 @@ def GCC(version): def GXX(version): return GCC_BASE(version) + DEFAULT_CXX_97 + SUPPORTS_GNUXX11 +SUPPORTS_DRAFT_CXX14_VERSION = { + '-std=gnu++14': DRAFT_CXX_14, +} GCC_4_7 = GCC('4.7.3') GXX_4_7 = GXX('4.7.3') GCC_4_9 = GCC('4.9.3') -GXX_4_9 = GXX('4.9.3') +GXX_4_9 = GXX('4.9.3') + SUPPORTS_DRAFT_CXX14_VERSION GCC_5 = GCC('5.2.1') + DEFAULT_C11 -GXX_5 = GXX('5.2.1') +GXX_5 = GXX('5.2.1') + SUPPORTS_GNUXX14 GCC_PLATFORM_LITTLE_ENDIAN = { '__BYTE_ORDER__': 1234, @@ -163,7 +174,7 @@ def CLANG(version): @memoize def CLANGXX(version): return (GCC_BASE('4.2.1') + CLANG_BASE(version) + DEFAULT_CXX_97 + - SUPPORTS_GNUXX11) + SUPPORTS_GNUXX11 + SUPPORTS_GNUXX14) CLANG_3_3 = CLANG('3.3.0') + DEFAULT_C99 @@ -173,6 +184,9 @@ def CLANGXX(version): '-std=gnu++11': { '__has_feature(cxx_alignof)': '1', }, + '-std=gnu++14': { + '__has_feature(cxx_alignof)': '1', + }, } @@ -901,9 +915,21 @@ class WindowsToolchainTest(BaseToolchainTest): CLANGXX_3_6_RESULT = LinuxToolchainTest.CLANGXX_3_6_RESULT GCC_4_7_RESULT = LinuxToolchainTest.GCC_4_7_RESULT GCC_4_9_RESULT = LinuxToolchainTest.GCC_4_9_RESULT - GXX_4_9_RESULT = LinuxToolchainTest.GXX_4_9_RESULT + GXX_4_9_RESULT = CompilerResult( + flags=['-std=gnu++14'], + version='4.9.3', + type='gcc', + compiler='/usr/bin/g++', + language='C++', + ) GCC_5_RESULT = LinuxToolchainTest.GCC_5_RESULT - GXX_5_RESULT = LinuxToolchainTest.GXX_5_RESULT + GXX_5_RESULT = CompilerResult( + flags=['-std=gnu++14'], + version='5.2.1', + type='gcc', + compiler='/usr/bin/g++-5', + language='C++', + ) # VS2015u3 or greater is required. def test_msvc(self): From 0b17fc029f74cdb102bd67b605d891a0254dff9a Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 7 Dec 2017 20:47:34 -0500 Subject: [PATCH 13/31] Bug 1423649 - Fix compiler errors that happen when building with VS2017 15.5. --- memory/mozalloc/mozalloc.h | 4 ++++ old-configure.in | 2 ++ 2 files changed, 6 insertions(+) diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index c7af9f5e75fd..d136f75c0df9 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -179,7 +179,11 @@ MFBT_API void* moz_xvalloc(size_t size) /* * Suppress build warning spam (bug 578546). */ +#if _MSC_VER < 1912 #define MOZALLOC_THROW_IF_HAS_EXCEPTIONS +#else +#define MOZALLOC_THROW_IF_HAS_EXCEPTIONS throw() +#endif #define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS #elif __cplusplus >= 201103 /* diff --git a/old-configure.in b/old-configure.in index 024521da2056..e5d7c39db3a2 100644 --- a/old-configure.in +++ b/old-configure.in @@ -988,6 +988,8 @@ case "$target" in # make 'foo == bar;' error out CFLAGS="$CFLAGS -we4553" CXXFLAGS="$CXXFLAGS -we4553" + # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions + CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib" MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' WARNINGS_AS_ERRORS='-WX' From b2eb83da3fd182eb734e4abb3d883af4bf69c859 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 2 Mar 2018 07:06:08 -0500 Subject: [PATCH 14/31] Bug 1442325 - remove some dead preprocessor logic; r=glandium We always compile with C++11 (er, C++14), so there's no need to include clauses that suggest otherwise. --- memory/mozalloc/mozalloc.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index d136f75c0df9..7ea59a299423 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -185,15 +185,12 @@ MFBT_API void* moz_xvalloc(size_t size) #define MOZALLOC_THROW_IF_HAS_EXCEPTIONS throw() #endif #define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS -#elif __cplusplus >= 201103 +#else /* * 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 -#define MOZALLOC_THROW_IF_HAS_EXCEPTIONS throw() -#define MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS throw(std::bad_alloc) #endif #define MOZALLOC_THROW_BAD_ALLOC MOZALLOC_THROW_BAD_ALLOC_IF_HAS_EXCEPTIONS From 36fb910cf2a6d706451334fa5008cfe4a002db08 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Tue, 10 Oct 2017 13:16:10 -0500 Subject: [PATCH 15/31] Bug 1406197 Declare sized deallocators (that ignore the size) to correct a MinGW warning r=glandium MozReview-Commit-ID: Dl4uu6evlbs --- memory/mozalloc/mozalloc.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index 7ea59a299423..152bec047f18 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -231,6 +231,14 @@ void operator delete(void* ptr) MOZALLOC_THROW_IF_HAS_EXCEPTIONS return free_impl(ptr); } +#if __cplusplus >= 201402L +MOZALLOC_EXPORT_NEW MOZALLOC_INLINE +void operator delete(void* ptr, size_t size) MOZALLOC_THROW_IF_HAS_EXCEPTIONS +{ + return free_impl(ptr); +} +#endif + MOZALLOC_EXPORT_NEW MOZALLOC_INLINE void operator delete(void* ptr, const std::nothrow_t&) MOZALLOC_THROW_IF_HAS_EXCEPTIONS { @@ -243,6 +251,14 @@ void operator delete[](void* ptr) MOZALLOC_THROW_IF_HAS_EXCEPTIONS return free_impl(ptr); } +#if __cplusplus >= 201402L +MOZALLOC_EXPORT_NEW MOZALLOC_INLINE +void operator delete[](void* ptr, size_t size) MOZALLOC_THROW_IF_HAS_EXCEPTIONS +{ + return free_impl(ptr); +} +#endif + MOZALLOC_EXPORT_NEW MOZALLOC_INLINE void operator delete[](void* ptr, const std::nothrow_t&) MOZALLOC_THROW_IF_HAS_EXCEPTIONS { From 63b4c1de0d3feceb1432893b551e924a52620add Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 21 Sep 2017 12:40:02 -0500 Subject: [PATCH 16/31] Bug 1325632 - part 1 - modify re-checking the compiler with flags; r=glandium toolchain.configure checks for information about the compilers we're using and accumulates additional flags that we might need to pass (e.g. switches for C/C++ versions, proper compiler targets, etc.), and then rechecks the compilers with those additional flags to verify that those flags are sufficient to configure the compiler properly. Only after we've checked for the proper flags do we move on to verifying the compiler versions are sufficient. It's possible, however, that the flags we try to add might not be supported by the compiler being tested, in which case we'd get an unfriendly error about an "unknown compiler", rather than something like "version X of Y not supported". In this case, we'd rather use the information we gathered from the first run to provide information messages. So we modify the second check to ignore any thrown exceptions during the check itself. This change results in another problem: the check for whether we had any extraneous flags is done prior to version checks for the compilers we support, which is also unhelpful. We choose to move this check after the version checks themselves. --- build/moz.configure/toolchain.configure | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 9cc6188f7043..b195e63b06f2 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -814,11 +814,17 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, host_or_target) # Check that the additional flags we got are enough to not require any - # more flags. - if info.flags: - flags += info.flags - info = check_compiler(wrapper + [compiler] + flags, language, - host_or_target) + # more flags. If we get an exception, just ignore it; it's liable to be + # invalid command-line flags, which means the compiler we're checking + # doesn't support those command-line flags and will fail one or more of + # the checks below. + try: + if info.flags: + flags += info.flags + info = check_compiler(wrapper + [compiler] + flags, language, + host_or_target) + except FatalCheckError: + pass if not info.target_cpu or info.target_cpu != host_or_target.cpu: raise FatalCheckError( @@ -844,10 +850,6 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, info.target_endianness or 'unknown', host_or_target_str, host_or_target.endianness)) - if info.flags: - raise FatalCheckError( - 'Unknown compiler or compiler not supported.') - # Compiler version checks # =================================================== # Check the compiler version here instead of in `compiler_version` so @@ -859,7 +861,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, % info.version) # If you want to bump the version check here search for - # __cpp_static_assert above, and see the associated comment. + # cxx_alignof above, and see the associated comment. if info.type == 'clang' and not info.version: raise FatalCheckError( 'Only clang/llvm 3.6 or newer is supported.') @@ -874,6 +876,10 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, 'See https://developer.mozilla.org/en/' 'Windows_Build_Prerequisites' % info.version) + if info.flags: + raise FatalCheckError( + 'Unknown compiler or compiler not supported.') + return namespace( wrapper=wrapper, compiler=compiler, From 3eee5e455aef1db71289e0dc0963b3afce1972dd Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 15 Nov 2017 14:53:17 -0400 Subject: [PATCH 17/31] Bug 1325632 - part 2 - don't warn about c++98/c++11 compatibility problems; r=ted.mielczarek We're going to compile with C++14 and we don't plan to go back. --- build/moz.configure/warnings.configure | 1 - 1 file changed, 1 deletion(-) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index b7df34ec93de..fa6cbb92c3f2 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -57,7 +57,6 @@ 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++11-compat-pedantic', cxx_compiler) check_and_add_gcc_warning('-Wc++14-compat', cxx_compiler) check_and_add_gcc_warning('-Wc++14-compat-pedantic', cxx_compiler) check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler) From be3aa2e4de2a5bca92292d6b201006f5014b5762 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 15 Nov 2017 14:53:17 -0400 Subject: [PATCH 18/31] Bug 1325632 - part 3 - compile rust bindings with -fno-sized-deallocation; r=ted.mielczarek This probably doesn't make a huge difference, as we're not generating any code here, but better safe than sorry. --- layout/style/ServoBindings.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index 1a0e55e88494..6a5c0d84dd92 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -1,6 +1,6 @@ [build] args = [ - "-x", "c++", "-std=c++14", + "-x", "c++", "-std=c++14", "-fno-sized-deallocation", "-DTRACING=1", "-DIMPL_LIBXUL", "-DMOZ_STYLO_BINDINGS=1", "-DMOZILLA_INTERNAL_API", "-DRUST_BINDGEN", "-DMOZ_STYLO" ] From 0f35e8ab0b8f7261250469b4fed3b709b2ec87f0 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 15 Nov 2017 13:53:16 -0500 Subject: [PATCH 19/31] Bug 1325632 - part 4 - split out framework for testing flags; r=chmanchester We have code to test whether particular flags are supported for the compiler we're using. Unfortunately, that code is tied up with checking for warning flags. We're about to add a separate facility for generic compilation flags, and we'd like to avoid cutting and pasting code if possible. Let's split the core code out into a separate, reusable function. --- build/moz.configure/compile-checks.configure | 100 ++++++++++++------- 1 file changed, 63 insertions(+), 37 deletions(-) diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure index 8ea4538d97a7..c16341154d12 100644 --- a/build/moz.configure/compile-checks.configure +++ b/build/moz.configure/compile-checks.configure @@ -76,28 +76,25 @@ def check_headers(*headers, **kwargs): return checks -@dependable -def warnings_cflags(): - return [] - -@dependable -def warnings_cxxflags(): - return [] - - -# Tests whether GCC or clang support the given warning flag, and if it is, -# add it to the list of warning flags for the build. -# - `warning` is the warning flag (e.g. -Wfoo) +# Determine whether to add a given flag to the given lists of flags for C or +# C++ compilation. +# - `flag` is the flag to test +# - `cflags` is a @depends function for the list of C compiler flags to add to +# - `cxxflags` is a @depends function for the list of C++ compiler flags to +# add to +# - `test_flags` is a list of flags to pass to the compiler instead of merely +# passing `flag`. This is especially useful for checking warning flags. If +# this list is empty, `flag` will be passed on its own. # - `compiler` (optional) is the compiler to test against (c_compiler or # cxx_compiler, from toolchain.configure). When omitted, both compilers -# are tested. +# are tested; the list of flags added to is dependent on the compiler tested. # - `when` (optional) is a @depends function or option name conditioning # when the warning flag is wanted. # - `check`, when not set, skips checking whether the flag is supported and -# adds it to the list of warning flags unconditionally. This is only meant -# for add_gcc_warning(). +# adds it to the list of flags unconditionally. @template -def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): +def check_and_add_flags(flag, cflags, cxxflags, test_flags, + compiler=None, when=None, check=True): if compiler is not None: compilers = (compiler,) else: @@ -106,26 +103,18 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): if when is None: when = always + if test_flags: + flags = test_flags + else: + flags = [flag] + for c in compilers: assert c in (c_compiler, cxx_compiler) - lang, warnings_flags = { - c_compiler: ('C', warnings_cflags), - cxx_compiler: ('C++', warnings_cxxflags), + lang, list_of_flags = { + c_compiler: ('C', cflags), + cxx_compiler: ('C++', cxxflags), }[c] - # GCC and clang will fail if given an unknown warning option like - # -Wfoobar. But later versions won't fail if given an unknown negated - # warning option like -Wno-foobar. So when we are checking for support - # of a negated warning option, we actually test the positive form, but - # add the negated form to the flags variable. - if (warning.startswith('-Wno-') and - not warning.startswith('-Wno-error=')): - flags = ['-Werror', '-W' + warning[5:]] - elif warning.startswith('-Werror='): - flags = [warning] - else: - flags = ['-Werror', warning] - @depends(c, when) def result(c, when): if when and c.type in ('clang', 'gcc'): @@ -134,13 +123,50 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): if check: result = c.try_compile( flags=flags, when=result, - check_msg='whether the %s compiler supports %s' % (lang, - warning)) + check_msg='whether the %s compiler supports %s' % (lang, flag)) - @depends(result, warnings_flags) - def maybe_add_flag(result, warnings_flags): + @depends(result, list_of_flags) + def maybe_add_flag(result, list_of_flags): if result: - warnings_flags.append(warning) + list_of_flags.append(flag) + + +@dependable +def warnings_cflags(): + return [] + +@dependable +def warnings_cxxflags(): + return [] + + +# Tests whether GCC or clang support the given warning flag, and if it is, +# add it to the list of warning flags for the build. +# - `warning` is the warning flag (e.g. -Wfoo) +# - `compiler` (optional) is the compiler to test against (c_compiler or +# cxx_compiler, from toolchain.configure). When omitted, both compilers +# are tested. +# - `when` (optional) is a @depends function or option name conditioning +# when the warning flag is wanted. +# - `check`, when not set, skips checking whether the flag is supported and +# adds it to the list of warning flags unconditionally. This is only meant +# for add_gcc_warning(). +@template +def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): + # GCC and clang will fail if given an unknown warning option like + # -Wfoobar. But later versions won't fail if given an unknown negated + # warning option like -Wno-foobar. So when we are checking for support + # of a negated warning option, we actually test the positive form, but + # add the negated form to the flags variable. + if warning.startswith('-Wno-') and not warning.startswith('-Wno-error='): + flags = ['-Werror', '-W' + warning[5:]] + elif warning.startswith('-Werror='): + flags = [warning] + else: + flags = ['-Werror', warning] + + check_and_add_flags(warning, warnings_cflags, warnings_cxxflags, + flags, compiler=compiler, when=when, check=check) # Add the given warning to the list of warning flags for the build. # - `warning` is the warning flag (e.g. -Wfoo) From 92e35f59e466d63ec2f87ccec0bde3025ce98d12 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 15 Nov 2017 14:53:16 -0400 Subject: [PATCH 20/31] Bug 1325632 - part 5 - ensure that we compile with -fno-sized-deallocation when possible; r=chmanchester We currently turn off the C++14 sized-deallocation facility on MSVC, and we'd like to ensure we do the same thing for clang and gcc. To do so, we add new functionality to moz.configure for checking and adding compilation flags, similar to the facility for checking and adding warning flags. The newly added facility is then used to add -fno-sized-deallocation to the compilation flags, when the option is supported. Once we do this, we can't define the sized deallocation functions in mozalloc.h; the compiler will complain that we are using -fno-sized-deallocation, yet defining these special functions that we'll never use. These functions were added for MinGW, where we needed to compile with C++14 ahead of other platforms to be compatible with MSVC headers. But they're no longer necessary, though they would be if we removed -fno-sized-deallocation; the compiler will complain if we do that and we'll add them back at that point. --- build/moz.configure/compile-checks.configure | 42 ++++++++++++++++++++ build/moz.configure/flags.configure | 13 ++++++ js/src/old-configure.in | 2 + memory/mozalloc/mozalloc.h | 16 -------- moz.configure | 2 + old-configure.in | 2 + 6 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 build/moz.configure/flags.configure diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure index c16341154d12..b6596ed8a44d 100644 --- a/build/moz.configure/compile-checks.configure +++ b/build/moz.configure/compile-checks.configure @@ -178,3 +178,45 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): @template def add_gcc_warning(warning, compiler=None, when=None): check_and_add_gcc_warning(warning, compiler, when, check=False) + + +# Like the warning checks above, but for general compilation flags. +@dependable +def compilation_cflags(): + return [] + + +@dependable +def compilation_cxxflags(): + return [] + + +# Tests whether GCC or clang support the given compilation flag; if the flag +# is supported, add it to the list of compilation flags for the build. +# - `flag` is the flag to test +# - `compiler` (optional) is the compiler to test against (c_compiler or +# cxx_compiler, from toolchain.configure). When omitted, both compilers +# are tested. +# - `when` (optional) is a @depends function or option name conditioning +# when the warning flag is wanted. +# - `check`, when not set, skips checking whether the flag is supported and +# adds it to the list of flags unconditionally. This is only meant for +# add_gcc_flag(). +@template +def check_and_add_gcc_flag(flag, compiler=None, when=None, check=True): + flags = ['-Werror', flag] + + check_and_add_flags(flag, compilation_cflags, compilation_cxxflags, + flags, compiler=compiler, when=when, check=check) + + +# Add the given flag to the list of flags for the build. +# - `flag` is the flag (e.g. -fno-sized-deallocation) +# - `compiler` (optional) is the compiler to add the flag for (c_compiler or +# cxx_compiler, from toolchain.configure). When omitted, the flag is added +# for both compilers. +# - `when` (optional) is a @depends function or option name conditioning +# when the flag is wanted. +@template +def add_gcc_flag(warning, compiler=None, when=None): + check_and_add_gcc_flag(warning, compiler, when, check=False) diff --git a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure new file mode 100644 index 000000000000..c98f5088db59 --- /dev/null +++ b/build/moz.configure/flags.configure @@ -0,0 +1,13 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# We support C++14, but we don't want to enable the sized deallocation +# facilities in C++14 yet. +check_and_add_gcc_flag('-fno-sized-deallocation', compiler=cxx_compiler) + +# Please keep these last in this file. +add_old_configure_assignment('_COMPILATION_CFLAGS', compilation_cflags) +add_old_configure_assignment('_COMPILATION_CXXFLAGS', compilation_cxxflags) diff --git a/js/src/old-configure.in b/js/src/old-configure.in index de9d08b3f580..09a3801b5f83 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -1982,10 +1982,12 @@ MOZ_CONFIG_ICU() dnl Echo the CFLAGS to remove extra whitespace. CFLAGS=`echo \ $_WARNINGS_CFLAGS \ + $_COMPILATION_CFLAGS \ $CFLAGS` CXXFLAGS=`echo \ $_WARNINGS_CXXFLAGS \ + $_COMPILATION_CXXFLAGS \ $CXXFLAGS` COMPILE_CFLAGS=`echo \ diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index 152bec047f18..7ea59a299423 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -231,14 +231,6 @@ void operator delete(void* ptr) MOZALLOC_THROW_IF_HAS_EXCEPTIONS return free_impl(ptr); } -#if __cplusplus >= 201402L -MOZALLOC_EXPORT_NEW MOZALLOC_INLINE -void operator delete(void* ptr, size_t size) MOZALLOC_THROW_IF_HAS_EXCEPTIONS -{ - return free_impl(ptr); -} -#endif - MOZALLOC_EXPORT_NEW MOZALLOC_INLINE void operator delete(void* ptr, const std::nothrow_t&) MOZALLOC_THROW_IF_HAS_EXCEPTIONS { @@ -251,14 +243,6 @@ void operator delete[](void* ptr) MOZALLOC_THROW_IF_HAS_EXCEPTIONS return free_impl(ptr); } -#if __cplusplus >= 201402L -MOZALLOC_EXPORT_NEW MOZALLOC_INLINE -void operator delete[](void* ptr, size_t size) MOZALLOC_THROW_IF_HAS_EXCEPTIONS -{ - return free_impl(ptr); -} -#endif - MOZALLOC_EXPORT_NEW MOZALLOC_INLINE void operator delete[](void* ptr, const std::nothrow_t&) MOZALLOC_THROW_IF_HAS_EXCEPTIONS { diff --git a/moz.configure b/moz.configure index 84f39f12127f..33fed7ec8a5b 100755 --- a/moz.configure +++ b/moz.configure @@ -146,6 +146,8 @@ include('build/moz.configure/headers.configure', when='--enable-compile-environment') include('build/moz.configure/warnings.configure', when='--enable-compile-environment') +include('build/moz.configure/flags.configure', + when='--enable-compile-environment') @depends(target, host) diff --git a/old-configure.in b/old-configure.in index e5d7c39db3a2..f773285d3ea8 100644 --- a/old-configure.in +++ b/old-configure.in @@ -4788,10 +4788,12 @@ MOZ_CONFIG_ICU() dnl Echo the CFLAGS to remove extra whitespace. CFLAGS=`echo \ $_WARNINGS_CFLAGS \ + $_COMPILATION_CFLAGS \ $CFLAGS` CXXFLAGS=`echo \ $_WARNINGS_CXXFLAGS \ + $_COMPILATION_CXXFLAGS \ $CXXFLAGS` COMPILE_CFLAGS=`echo \ From 374467344e52416b4b8dbfe87d0b6d5ff4602165 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 15 Nov 2017 13:53:16 -0500 Subject: [PATCH 21/31] Bug 1325632 - part 6 - compile with C++14 support; r=glandium --- build/moz.configure/toolchain.configure | 31 +++++++++---------- .../configure/test_toolchain_configure.py | 10 ++++-- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index b195e63b06f2..98b1ee65d0e9 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -472,27 +472,24 @@ def check_compiler(compiler, language, target): if info.type in ('clang-cl', 'clang', 'gcc'): append_flag('-std=gnu99') - # Note: MSVC, while supporting C++11, still reports 199711L for __cplusplus. + # Note: MSVC, while supporting C++14, still reports 199711L for __cplusplus. # Note: this is a strict version check because we used to always add - # -std=gnu++11. + # -std=gnu++14. draft_cxx14_version = 201300 cxx14_version = 201402 if info.language == 'C++': - if target.kernel != 'WINNT': - if info.type in ('clang', 'gcc') and info.language_version != 201103: - append_flag('-std=gnu++11') - else: - if info.type == 'clang' and info.language_version != 201103: - append_flag('-std=gnu++11') - # 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') - # GCC 4.9 indicates that it implements draft C++14 features - # instead of the full language. - elif info.type == 'gcc' and not \ - (info.language_version == draft_cxx14_version or info.language_version == cxx14_version): - append_flag('-std=gnu++14') + if info.type == 'clang' 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. + elif info.type == 'clang-cl' and info.language_version != cxx14_version: + append_flag('-std=c++14') + # GCC 4.9 indicates that it implements draft C++14 features + # instead of the full language. + elif info.type == 'gcc' and \ + info.language_version not in (draft_cxx14_version, + cxx14_version): + append_flag('-std=gnu++14') # We force clang-cl to emulate Visual C++ 2017 version 15.4 if info.type == 'clang-cl' and info.version != '19.11.25547': diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py index 9089d6527cd1..4a64d7193bc5 100644 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py @@ -88,6 +88,10 @@ def GXX(version): '-std=gnu++14': DRAFT_CXX_14, } +SUPPORTS_DRAFT_CXX14_VERSION = { + '-std=gnu++14': DRAFT_CXX_14, +} + GCC_4_7 = GCC('4.7.3') GXX_4_7 = GXX('4.7.3') GCC_4_9 = GCC('4.9.3') @@ -433,7 +437,7 @@ class LinuxToolchainTest(BaseToolchainTest): language='C', ) GXX_4_9_RESULT = CompilerResult( - flags=['-std=gnu++11'], + flags=['-std=gnu++14'], version='4.9.3', type='gcc', compiler='/usr/bin/g++', @@ -447,7 +451,7 @@ class LinuxToolchainTest(BaseToolchainTest): language='C', ) GXX_5_RESULT = CompilerResult( - flags=['-std=gnu++11'], + flags=['-std=gnu++14'], version='5.2.1', type='gcc', compiler='/usr/bin/g++-5', @@ -469,7 +473,7 @@ class LinuxToolchainTest(BaseToolchainTest): language='C', ) CLANGXX_3_6_RESULT = CompilerResult( - flags=['-std=gnu++11'], + flags=['-std=gnu++14'], version='3.6.2', type='clang', compiler='/usr/bin/clang++', From 9ebeb63172fb34bbd320464edc7881406ef292cf Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Fri, 17 Nov 2017 23:58:04 -0800 Subject: [PATCH 22/31] Bug 1418573 - Remove -Wc++14-compat flag because we now compile with -std=c++14. r=rillian -Wc++14-compat warns about code whose meaning differs between C++11 and C++14. We want the new C++14 meanings, so we don't need to warn about these differences. We still want -Wc++1z-compat because we want to know about C++14 code whose meaning will change in C++17 or C++20. MozReview-Commit-ID: 1CD11l2Fd86 --- build/moz.configure/warnings.configure | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index fa6cbb92c3f2..6e3b4472a427 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -57,8 +57,6 @@ 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++14-compat', cxx_compiler) -check_and_add_gcc_warning('-Wc++14-compat-pedantic', cxx_compiler) check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler) # catches possible misuse of the comma operator From a36bfe10950a89dd621fea3bd0d967aef5804052 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Wed, 23 Aug 2017 16:18:28 -0500 Subject: [PATCH 23/31] Bug 1393216 Disable unknown pragma warnings when compiling for Windows with gcc r=froydnj MozReview-Commit-ID: 6cZ96xe4h8C --- build/moz.configure/warnings.configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index 6e3b4472a427..e2c6050b7bf9 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -107,6 +107,11 @@ check_and_add_gcc_warning('-Wformat') check_and_add_gcc_warning('-Wno-format', when=depends(target)(lambda t: t.kernel == 'WINNT')) +# When compiling for Windows with gcc, we encounter lots of "#pragma warning"'s +# which is an MSVC-only pragma that GCC does not recognize. +check_and_add_gcc_warning('-Wno-unknown-pragmas', + when=depends(target)(lambda t: t.kernel == 'WINNT')) + # We hit this all over the place with the gtest INSTANTIATE_TEST_CASE_P macro check_and_add_gcc_warning('-Wno-gnu-zero-variadic-macro-arguments') From 1f090ab04405745bbafb2d083c94a436d5f577b9 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Wed, 23 Aug 2017 16:08:30 -0500 Subject: [PATCH 24/31] Bug 1393222 Disable the unused-function warning when compiling with gcc for Windows r=froydnj In some cases, they are false positives. In other cases, the callsite is #ifdef-ed out, so it's a true positive, but not one we would correct. MozReview-Commit-ID: 6ThZH3wEXTp --- build/moz.configure/warnings.configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index e2c6050b7bf9..4baa9230d330 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -112,6 +112,11 @@ check_and_add_gcc_warning('-Wno-format', check_and_add_gcc_warning('-Wno-unknown-pragmas', when=depends(target)(lambda t: t.kernel == 'WINNT')) +# When compiling for Windows with gcc, gcc throws false positives and true +# positives where the callsite is ifdef-ed out +check_and_add_gcc_warning('-Wno-unused-function', + when=depends(target)(lambda t: t.kernel == 'WINNT')) + # We hit this all over the place with the gtest INSTANTIATE_TEST_CASE_P macro check_and_add_gcc_warning('-Wno-gnu-zero-variadic-macro-arguments') From c3624fe3af57a73e8c1163cce025e35f0cf316a7 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Thu, 5 Oct 2017 23:14:02 -0700 Subject: [PATCH 25/31] Bug 1406618 - Enable gcc -Wduplicated-cond warnings. r=glandium Warn about duplicated conditions in if-else-if chains, which are unreachable code and likely copy/paste bugs. The -Wduplicated-cond flag is available in gcc 6 and later. int example(int a) { if (a == 0) a = 42; else if (a == 0) // -Wduplicated-cond warning! a = 43; return a; } MozReview-Commit-ID: F9hqxMCct74 --- build/moz.configure/warnings.configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index 4baa9230d330..16404b9e23b3 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -62,6 +62,9 @@ check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler) # catches possible misuse of the comma operator check_and_add_gcc_warning('-Wcomma', cxx_compiler) +# catches duplicated conditions in if-else-if chains +check_and_add_gcc_warning('-Wduplicated-cond') + # catches unintentional switch case fallthroughs check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler) From 17fcf9d6c1366a0e442ae395833d1b21dfe4a8c0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 11 Aug 2017 10:46:02 +0200 Subject: [PATCH 26/31] bug 1320656 - When exists, add -Wno-noexcept-type to the js build flags until we have a proper fix r=glandium MozReview-Commit-ID: HeDMTxopx9V --- build/moz.configure/warnings.configure | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index 16404b9e23b3..038f0c9c8b63 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -128,6 +128,15 @@ check_and_add_gcc_warning('-Wno-gnu-zero-variadic-macro-arguments') check_and_add_gcc_warning('-Wformat-security') check_and_add_gcc_warning('-Wformat-overflow=2') +# Disable a warning with gcc 7. See bug 1320656 +# We are far from using C++17 and the impact of the warning will be +# limited to a potential public ABI. +# Currently only affecting js/ +check_and_add_gcc_warning('-Wno-noexcept-type', cxx_compiler, + when=depends(build_project) + (lambda build_project: build_project == 'js')) + + # Please keep these last in this file add_old_configure_assignment('_WARNINGS_CFLAGS', warnings_cflags) add_old_configure_assignment('_WARNINGS_CXXFLAGS', warnings_cxxflags) From ecf1efa4dba29c60cc69f8894ee01c6fd7db1a8e Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Thu, 16 Nov 2017 12:36:33 -0600 Subject: [PATCH 27/31] Bug 1407343 Silence multiple classes of warnings for the MinGW build, including not enabling format warnings unless -Wformat is set r=froydnj,glandium MozReview-Commit-ID: ALmo1hbqVxC --- build/moz.configure/compile-checks.configure | 16 ++++-- build/moz.configure/warnings.configure | 54 ++++++++++++-------- dom/security/moz.build | 4 -- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure index b6596ed8a44d..194b21eb6669 100644 --- a/build/moz.configure/compile-checks.configure +++ b/build/moz.configure/compile-checks.configure @@ -103,6 +103,8 @@ def check_and_add_flags(flag, cflags, cxxflags, test_flags, if when is None: when = always + results = [] + if test_flags: flags = test_flags else: @@ -130,11 +132,16 @@ def check_and_add_flags(flag, cflags, cxxflags, test_flags, if result: list_of_flags.append(flag) + results.append(result) + + return tuple(results) + @dependable def warnings_cflags(): return [] + @dependable def warnings_cxxflags(): return [] @@ -165,8 +172,9 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): else: flags = ['-Werror', warning] - check_and_add_flags(warning, warnings_cflags, warnings_cxxflags, - flags, compiler=compiler, when=when, check=check) + return check_and_add_flags(warning, warnings_cflags, warnings_cxxflags, + flags, compiler=compiler, when=when, check=check) + # Add the given warning to the list of warning flags for the build. # - `warning` is the warning flag (e.g. -Wfoo) @@ -206,8 +214,8 @@ def compilation_cxxflags(): def check_and_add_gcc_flag(flag, compiler=None, when=None, check=True): flags = ['-Werror', flag] - check_and_add_flags(flag, compilation_cflags, compilation_cxxflags, - flags, compiler=compiler, when=when, check=check) + return check_and_add_flags(flag, compilation_cflags, compilation_cxxflags, + flags, compiler=compiler, when=when, check=check) # Add the given flag to the list of flags for the build. diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index 038f0c9c8b63..de088a71e0bc 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -103,31 +103,45 @@ check_and_add_gcc_warning('-Wno-error=coverage-mismatch', when='MOZ_PGO') check_and_add_gcc_warning('-Wno-error=free-nonheap-object') # catches format/argument mismatches with printf -check_and_add_gcc_warning('-Wformat') +c_format_warning, cxx_format_warning = check_and_add_gcc_warning( + '-Wformat', when=depends(target)(lambda t: t.kernel != 'WINNT')) -# We use mix of both POSIX and Win32 printf format across the tree, so format -# warnings are useless on mingw. -check_and_add_gcc_warning('-Wno-format', - when=depends(target)(lambda t: t.kernel == 'WINNT')) - -# When compiling for Windows with gcc, we encounter lots of "#pragma warning"'s -# which is an MSVC-only pragma that GCC does not recognize. -check_and_add_gcc_warning('-Wno-unknown-pragmas', - when=depends(target)(lambda t: t.kernel == 'WINNT')) - -# When compiling for Windows with gcc, gcc throws false positives and true -# positives where the callsite is ifdef-ed out -check_and_add_gcc_warning('-Wno-unused-function', - when=depends(target)(lambda t: t.kernel == 'WINNT')) +# Add compile-time warnings for unprotected functions and format functions +# that represent possible security problems. Enable this only when -Wformat +# is enabled, otherwise it is an error +check_and_add_gcc_warning('-Wformat-security', + when=c_format_warning & cxx_format_warning) +check_and_add_gcc_warning('-Wformat-overflow=2', + when=c_format_warning & cxx_format_warning) + +# Other MinGW specific things +with only_when(depends(target)(lambda t: t.kernel == 'WINNT')): + # When compiling for Windows with gcc, we encounter lots of "#pragma warning"'s + # which is an MSVC-only pragma that GCC does not recognize. + check_and_add_gcc_warning('-Wno-unknown-pragmas') + + # When compiling for Windows with gcc, gcc throws false positives and true + # positives where the callsite is ifdef-ed out + check_and_add_gcc_warning('-Wno-unused-function') + + # When compiling for Windows with gcc, gcc cannot produce this warning + # correctly: it mistakes DWORD_PTR and ULONG_PTR as types you cannot + # give NULL to. (You can in fact do that.) + check_and_add_gcc_warning('-Wno-conversion-null') + + # Throughout the codebase we regularly have switch statements off of enums + # without covering every value in the enum. We don't care about these warnings. + check_and_add_gcc_warning('-Wno-switch') + + # Another code pattern we have is using start and end constants in enums of + # different types. We do this for safety, but then when comparing it throws + # an error, which we would like to ignore. This seems to only affect the MinGW + # build, but we're not sure why. + check_and_add_gcc_warning('-Wno-enum-compare') # We hit this all over the place with the gtest INSTANTIATE_TEST_CASE_P macro check_and_add_gcc_warning('-Wno-gnu-zero-variadic-macro-arguments') -# Add compile-time warnings for unprotected functions and format functions -# that represent possible security problems -check_and_add_gcc_warning('-Wformat-security') -check_and_add_gcc_warning('-Wformat-overflow=2') - # Disable a warning with gcc 7. See bug 1320656 # We are far from using C++17 and the impact of the warning will be # limited to a potential public ABI. diff --git a/dom/security/moz.build b/dom/security/moz.build index 7f0473ceb230..f9d2133eda16 100644 --- a/dom/security/moz.build +++ b/dom/security/moz.build @@ -48,7 +48,3 @@ LOCAL_INCLUDES += [ '/docshell/base', # for nsDocShell.h '/netwerk/base', ] - -if CONFIG['GNU_CC']: - CFLAGS += ['-Wformat-security'] - CXXFLAGS += ['-Wformat-security'] From 69fcd28ba9ce02b997d8e6d7dcfc1d7e1ce711e4 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 16 Nov 2017 20:51:46 -0500 Subject: [PATCH 28/31] Bug 1418047 - remove -Wc++11-compat warning; r=rillian We live in a C++14 world now. --- build/moz.configure/warnings.configure | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index de088a71e0bc..150cf1de6b80 100644 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -19,9 +19,6 @@ add_old_configure_assignment( # lots of useful warnings add_gcc_warning('-Wall') -# catches C++ version forward-compat issues -add_gcc_warning('-Wc++11-compat', cxx_compiler) - # catches bugs, e.g. "if (c); foo();", few false positives add_gcc_warning('-Wempty-body') From 7952a50fcc91364355cc5751035751960b045af6 Mon Sep 17 00:00:00 2001 From: Carl Corcoran Date: Tue, 27 Mar 2018 14:42:17 +0200 Subject: [PATCH 29/31] Bug 1448546: Adding sized operator delete overloads on Windows builds; r=froydnj --- memory/mozalloc/mozalloc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index 7ea59a299423..9752422301c4 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -249,6 +249,21 @@ void operator delete[](void* ptr, const std::nothrow_t&) MOZALLOC_THROW_IF_HAS_E return free_impl(ptr); } +#if defined(XP_WIN) +// We provide the global sized delete overloads unconditionally because the +// MSVC runtime headers do, despite compiling with /Zc:sizedDealloc- +MOZALLOC_EXPORT_NEW MOZ_ALWAYS_INLINE_EVEN_DEBUG +void operator delete(void* ptr, size_t /*size*/) MOZALLOC_THROW_IF_HAS_EXCEPTIONS +{ + return free_impl(ptr); +} + +MOZALLOC_EXPORT_NEW MOZ_ALWAYS_INLINE_EVEN_DEBUG +void operator delete[](void* ptr, size_t /*size*/) MOZALLOC_THROW_IF_HAS_EXCEPTIONS +{ + return free_impl(ptr); +} +#endif /* * We also add a new allocator variant: "fallible operator new." From 7b89964942c7394b14707755bacc128d979ce61a Mon Sep 17 00:00:00 2001 From: hawkeye116477 Date: Fri, 13 Aug 2021 20:26:45 +0200 Subject: [PATCH 30/31] Remove unnecessary flag We always build in C++14 mode now. --- gfx/angle/targets/translator/moz.build | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gfx/angle/targets/translator/moz.build b/gfx/angle/targets/translator/moz.build index d07fcac6999b..c743b35d47c4 100644 --- a/gfx/angle/targets/translator/moz.build +++ b/gfx/angle/targets/translator/moz.build @@ -40,10 +40,6 @@ LOCAL_INCLUDES += [ "../../checkout/src/common/third_party/base/", ] -CXXFLAGS += [ - '-std=c++14', -] - SOURCES += [ "../../checkout/src/compiler/translator/ASTMetadataHLSL.cpp", "../../checkout/src/compiler/translator/AtomicCounterFunctionHLSL.cpp", From 152251aa85c8baa1a1fd42143a9d46f2fad83682 Mon Sep 17 00:00:00 2001 From: hawkeye116477 Date: Sun, 15 Aug 2021 20:32:41 +0200 Subject: [PATCH 31/31] Fix C++17 build with Clang --- memory/build/mozmemory_wrap.c | 1 - memory/build/mozmemory_wrap.h | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/memory/build/mozmemory_wrap.c b/memory/build/mozmemory_wrap.c index 78c02f28ca61..01015f0384ad 100644 --- a/memory/build/mozmemory_wrap.c +++ b/memory/build/mozmemory_wrap.c @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include #include "mozmemory_wrap.h" #include "mozilla/Types.h" diff --git a/memory/build/mozmemory_wrap.h b/memory/build/mozmemory_wrap.h index 40b7c44e9fae..fcc355f6febf 100644 --- a/memory/build/mozmemory_wrap.h +++ b/memory/build/mozmemory_wrap.h @@ -118,6 +118,13 @@ # define IMPL_MFBT #endif +#ifdef __cplusplus +# include +# include +#else +# include +# include +#endif #include "mozilla/Types.h" #ifndef MOZ_EXTERN_C