summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2022-04-15 08:30:05 -0500
committertrav90 <travawine@palemoon.org>2022-04-15 08:30:05 -0500
commitd430c6398bf6bd1122f401aec7937a2ad0df99a5 (patch)
treed95ca61959104562efc0012c93873f1b92e276a7
parent39ba93e1d72e3e88633a13a31abbaa1035fe7ee5 (diff)
downloaduxp-d430c6398bf6bd1122f401aec7937a2ad0df99a5.tar.gz
Issue #1818 - Part 1: remove a number of old GCC hacks.
-rw-r--r--build/autoconf/compiler-opts.m45
-rwxr-xr-xbuild/unix/build-gcc/build-gcc.sh2
-rw-r--r--dom/media/GraphDriver.cpp5
-rw-r--r--dom/media/MediaManager.cpp31
-rw-r--r--dom/media/MediaManager.h1
-rw-r--r--dom/plugins/base/npfunctions.h4
-rw-r--r--dom/plugins/base/nptypes.h19
-rw-r--r--layout/style/nsCSSParser.cpp39
-rw-r--r--python/pyyaml/ext/_yaml.c10
-rw-r--r--xpcom/base/nscore.h8
-rw-r--r--xpcom/glue/nsCOMPtr.h6
-rw-r--r--xpcom/string/nsTSubstring.h1
12 files changed, 52 insertions, 79 deletions
diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
index 077a3e6f19..99990332f9 100644
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -16,7 +16,7 @@ dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-s
DEVELOPER_OPTIONS=,
DEVELOPER_OPTIONS=1)
-dnl Default to MSVC for win32 and gcc-4.2 for darwin
+dnl Default to MSVC for win32
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
@@ -186,7 +186,8 @@ if test "$GNU_CC"; then
if test -z "$CLANG_CC"; then
case "$CC_VERSION" in
- 4.* | 5.*)
+ 4.* | 5.* | 6.*)
+ AC_MSG_ERROR([Unsupported GCC version.])
;;
*)
# Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko.
diff --git a/build/unix/build-gcc/build-gcc.sh b/build/unix/build-gcc/build-gcc.sh
index df3bc5dfd3..2c4d7b323d 100755
--- a/build/unix/build-gcc/build-gcc.sh
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-gcc_version=4.8.5
+gcc_version=7.1.0
binutils_version=2.25.1
this_path=$(readlink -f $(dirname $0))
make_flags='-j12'
diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp
index 90680d8c69..daf1ccc989 100644
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -32,11 +32,6 @@ StaticRefPtr<nsIThreadPool> AsyncCubebTask::sThreadPool;
struct AutoProfilerUnregisterThread
{
- // The empty ctor is used to silence a pre-4.8.0 GCC unused variable warning.
- AutoProfilerUnregisterThread()
- {
- }
-
~AutoProfilerUnregisterThread()
{
profiler_unregister_thread();
diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp
index 54b09e6447..7fd11f1715 100644
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1277,13 +1277,6 @@ GetSources(MediaEngine *engine, MediaSourceEnum aSrcType,
}
}
-// TODO: Remove once upgraded to GCC 4.8+ on linux. Bogus error on static func:
-// error: 'this' was not captured for this lambda function
-
-static auto& MediaManager_GetInstance = MediaManager::GetInstance;
-static auto& MediaManager_ToJSArray = MediaManager::ToJSArray;
-static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices;
-
already_AddRefed<MediaManager::PledgeChar>
MediaManager::SelectSettings(
MediaStreamConstraints& aConstraints,
@@ -1343,7 +1336,7 @@ MediaManager::SelectSettings(
}
}
NS_DispatchToMainThread(NewRunnableFrom([id, badConstraint]() mutable {
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
RefPtr<PledgeChar> p = mgr->mOutstandingCharPledges.Remove(id);
if (p) {
p->Resolve(badConstraint);
@@ -1608,7 +1601,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
fakeBackend = new MediaEngineDefault();
}
if ((!fakeCams && hasVideo) || (!fakeMics && hasAudio)) {
- RefPtr<MediaManager> manager = MediaManager_GetInstance();
+ RefPtr<MediaManager> manager = MediaManager::GetInstance();
realBackend = manager->GetBackend(aWindowId);
}
@@ -1633,7 +1626,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
SourceSet* handoff = result.release();
NS_DispatchToMainThread(NewRunnableFrom([id, handoff]() mutable {
UniquePtr<SourceSet> result(handoff); // grab result
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
if (!mgr) {
return NS_OK;
}
@@ -1922,7 +1915,7 @@ int MediaManager::AddDeviceChangeCallback(DeviceChangeCallback* aCallback)
{
bool fakeDeviceChangeEventOn = mPrefs.mFakeDeviceChangeEventOn;
MediaManager::PostTask(NewTaskFrom([fakeDeviceChangeEventOn]() {
- RefPtr<MediaManager> manager = MediaManager_GetInstance();
+ RefPtr<MediaManager> manager = MediaManager::GetInstance();
manager->GetBackend(0)->AddDeviceChangeCallback(manager);
if (fakeDeviceChangeEventOn)
manager->GetBackend(0)->SetFakeDeviceChangeEvents();
@@ -2445,7 +2438,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
p->Then([id, aWindowId, aVideoType, aAudioType,
aFake](const nsCString& aOriginKey) mutable {
MOZ_ASSERT(NS_IsMainThread());
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
RefPtr<PledgeSourceSet> p = mgr->EnumerateRawDevices(aWindowId, aVideoType,
aAudioType, aFake);
@@ -2453,7 +2446,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
UniquePtr<SourceSet> devices(aDevices); // secondary result
// Only run if window is still on our active list.
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
if (!mgr) {
return NS_OK;
}
@@ -2461,7 +2454,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
if (!p || !mgr->IsWindowStillActive(aWindowId)) {
return NS_OK;
}
- MediaManager_AnonymizeDevices(*devices, aOriginKey);
+ MediaManager::AnonymizeDevices(*devices, aOriginKey);
p->Resolve(devices.release());
return NS_OK;
});
@@ -2500,12 +2493,12 @@ MediaManager::EnumerateDevices(nsPIDOMWindowInner* aWindow,
fake);
p->Then([onSuccess, windowId, listener](SourceSet*& aDevices) mutable {
UniquePtr<SourceSet> devices(aDevices); // grab result
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
mgr->RemoveFromWindowList(windowId, listener);
- nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*devices);
+ nsCOMPtr<nsIWritableVariant> array = MediaManager::ToJSArray(*devices);
onSuccess->OnSuccess(array);
}, [onFailure, windowId, listener](MediaStreamError*& reason) mutable {
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
mgr->RemoveFromWindowList(windowId, listener);
onFailure->OnError(reason);
});
@@ -2542,7 +2535,7 @@ MediaManager::GetUserMediaDevices(nsPIDOMWindowInner* aWindow,
RefPtr<GetUserMediaTask> task;
if (!aCallID.Length() || aCallID == callID) {
if (mActiveCallbacks.Get(callID, getter_AddRefs(task))) {
- nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*task->mSourceSet);
+ nsCOMPtr<nsIWritableVariant> array = MediaManager::ToJSArray(*task->mSourceSet);
onSuccess->OnSuccess(array);
return NS_OK;
}
@@ -3356,7 +3349,7 @@ GetUserMediaCallbackMediaStreamListener::ApplyConstraintsToTrack(
NS_DispatchToMainThread(NewRunnableFrom([id, windowId, rv,
badConstraint]() mutable {
MOZ_ASSERT(NS_IsMainThread());
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
if (!mgr) {
return NS_OK;
}
diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h
index 1255f6c90b..1ee61f1196 100644
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -268,7 +268,6 @@ private:
static nsresult GenerateUUID(nsAString& aResult);
static nsresult AnonymizeId(nsAString& aId, const nsACString& aOriginKey);
-public: // TODO: make private once we upgrade to GCC 4.8+ on linux.
static void AnonymizeDevices(SourceSet& aDevices, const nsACString& aOriginKey);
static already_AddRefed<nsIWritableVariant> ToJSArray(SourceSet& aDevices);
private:
diff --git a/dom/plugins/base/npfunctions.h b/dom/plugins/base/npfunctions.h
index 7638a64882..83c8a9762c 100644
--- a/dom/plugins/base/npfunctions.h
+++ b/dom/plugins/base/npfunctions.h
@@ -189,8 +189,8 @@ typedef struct _NPNetscapeFuncs {
#endif
#if defined(XP_UNIX)
-/* GCC 3.3 and later support the visibility attribute. */
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
+/* GCC supports the visibility attribute. */
+#if defined(__GNUC__)
#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define NP_VISIBILITY_DEFAULT __global
diff --git a/dom/plugins/base/nptypes.h b/dom/plugins/base/nptypes.h
index d0cef65406..1f8eba3c53 100644
--- a/dom/plugins/base/nptypes.h
+++ b/dom/plugins/base/nptypes.h
@@ -13,7 +13,7 @@
#if defined(WIN32)
/*
- * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
+ * Win32 doesn't know C99, so define [u]int_16/32/64 here. The bool
* is predefined tho, both in C and C++.
*/
typedef short int16_t;
@@ -61,28 +61,15 @@
#include <inttypes.h>
#include <stdbool.h>
#endif
-#elif defined(BEOS)
- #include <inttypes.h>
#else
/*
* For those that ship a standard C99 stdint.h header file, include
- * it. Can't do the same for stdbool.h tho, since some systems ship
- * with a stdbool.h file that doesn't compile!
+ * it.
*/
#include <stdint.h>
#ifndef __cplusplus
- #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
- #include <stdbool.h>
- #else
- /*
- * GCC 2.91 can't deal with a typedef for bool, but a #define
- * works.
- */
- #define bool int
- #define true 1
- #define false 0
- #endif
+ #include <stdbool.h>
#endif
#endif
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index b409bfed7e..720a123d51 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -9843,7 +9843,22 @@ CSSParserImpl::ParseGridLine(nsCSSValue& aValue)
// Make the contained value be defined even though we really want a
// Nothing here. This works around an otherwise difficult to avoid
// Memcheck false positive when this is compiled by gcc-5.3 -O2.
- // See bug 1301856.
+ // The problem is that gcc 5.4 and later, when using high
+ // optimization, inline Maybe::{isSome,ref} here
+ //
+ // if (integer.isSome() && integer.ref() < 0) {
+ //
+ // and then proceed to evaluate the expression right-to-left, as if it
+ // had been written
+ //
+ // integer.ref() < 0 && integer.isSome()
+ //
+ // This is a legitimate transformation because gcc presumably can prove
+ // via dataflow analysis that integer.isSome() is false whenever integer.ref()
+ // is undefined, so the overall expression result is still defined.
+ // Valgrind/Memcheck assumes that all conditional branches in the program
+ // are important, and that assumption is deeply wired in, so there is no
+ // easy way to avoid the warning apart from to force-initialise |integer|.
integer.emplace(0);
integer.reset();
#endif
@@ -15314,17 +15329,17 @@ CSSParserImpl::ParseFontFeatureSettings(nsCSSValue& aValue)
return true;
}
-bool
-CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue)
-{
- // TODO: Actually implement this.
-
- // This stub is here because websites insist on considering this
- // very hardware-dependent and O.S.-variable low-level font-control
- // as a "critical feature" which it isn't as there is 0 guarantee
- // that font variation settings are supported or honored by any
- // operating system used by the client.
- return true;
+bool
+CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue)
+{
+ // TODO: Actually implement this.
+
+ // This stub is here because websites insist on considering this
+ // very hardware-dependent and O.S.-variable low-level font-control
+ // as a "critical feature" which it isn't as there is 0 guarantee
+ // that font variation settings are supported or honored by any
+ // operating system used by the client.
+ return true;
}
bool
diff --git a/python/pyyaml/ext/_yaml.c b/python/pyyaml/ext/_yaml.c
index f4a5bc5242..8a66c0fd3e 100644
--- a/python/pyyaml/ext/_yaml.c
+++ b/python/pyyaml/ext/_yaml.c
@@ -501,14 +501,8 @@ bad:
#ifdef __GNUC__
- /* Test for GCC > 2.95 */
- #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- #else /* __GNUC__ > 2 ... */
- #define likely(x) (x)
- #define unlikely(x) (x)
- #endif /* __GNUC__ > 2 ... */
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h
index c667a8ae31..6300099ef6 100644
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -134,18 +134,10 @@
*
* where nsIFoo::typeFunc is any method declared as
* NS_IMETHOD typeFunc(nsISupports*);
- *
- * XXX this can be simplified to always use the non-typeof implementation
- * when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11893 is fixed.
*/
-#ifdef __GNUC__
-#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
- typeof(&class::func) name
-#else
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
ret (NS_STDCALL class::*name) args
-#endif
/**
* Deprecated declarations.
diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h
index 7ab6a143c5..3b1833c359 100644
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -59,10 +59,8 @@
#ifdef __GNUC__
// Our use of nsCOMPtr_base::mRawPtr violates the C++ standard's aliasing
- // rules. Mark it with the may_alias attribute so that gcc 3.3 and higher
- // don't reorder instructions based on aliasing assumptions for
- // this variable. Fortunately, gcc versions < 3.3 do not do any
- // optimizations that break nsCOMPtr.
+ // rules. Mark it with the may_alias attribute so that gcc doesn't reorder
+ // instructions based on aliasing assumptions for this variable.
#define NS_MAY_ALIAS_PTR(t) t* __attribute__((__may_alias__))
#else
diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h
index 8e3b417441..a1c1264193 100644
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -991,7 +991,6 @@ protected:
friend class nsTObsoleteAStringThunk_CharT;
friend class nsTSubstringTuple_CharT;
- // XXX GCC 3.4 needs this :-(
friend class nsTPromiseFlatString_CharT;
char_type* mData;