Skip to content

Commit

Permalink
Backed out 5 changesets (bug 1690167) for failing xpcshell at bootstr…
Browse files Browse the repository at this point in the history
…apSvc.js on a CLOSED TREE

Backed out changeset d28c0f11743f (bug 1690167)
Backed out changeset 3b2bebed9128 (bug 1690167)
Backed out changeset 7e925e90a251 (bug 1690167)
Backed out changeset f85934a2b7ad (bug 1690167)
Backed out changeset 6d83474e81bb (bug 1690167)
  • Loading branch information
AndreeaPavel committed Feb 17, 2021
1 parent d9de5c2 commit 6428905
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 117 deletions.
2 changes: 1 addition & 1 deletion media/gmp-clearkey/0.1/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
with Files("**"):
BUG_COMPONENT = ("Core", "Audio/Video: GMP")

GeckoSharedLibrary("clearkey", linkage=None)
SharedLibrary("clearkey")

FINAL_TARGET = "dist/bin/gmp-clearkey/0.1"

Expand Down
14 changes: 1 addition & 13 deletions memory/replace/logalloc/replay/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,7 @@ if CONFIG["MOZ_DMD"] or CONFIG["MOZ_PHC"]:
"/mozglue/misc/StackWalk.h",
]

if CONFIG["MOZ_REPLACE_MALLOC_STATIC"]:
UNIFIED_SOURCES += [
"/mfbt/double-conversion/double-conversion/bignum-dtoa.cc",
"/mfbt/double-conversion/double-conversion/bignum.cc",
"/mfbt/double-conversion/double-conversion/cached-powers.cc",
"/mfbt/double-conversion/double-conversion/double-to-string.cc",
"/mfbt/double-conversion/double-conversion/fast-dtoa.cc",
"/mfbt/double-conversion/double-conversion/fixed-dtoa.cc",
"/mfbt/double-conversion/double-conversion/string-to-double.cc",
"/mfbt/double-conversion/double-conversion/strtod.cc",
"/mozglue/misc/Printf.cpp",
]
else:
if not CONFIG["MOZ_REPLACE_MALLOC_STATIC"]:
SOURCES += [
"../FdPrintf.cpp",
]
Expand Down
File renamed without changes.
39 changes: 3 additions & 36 deletions mozglue/misc/Sprintf.h → mfbt/Sprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,19 @@

#include <stdio.h>
#include <stdarg.h>
#include <algorithm>

#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/Printf.h"

#ifdef __cplusplus

namespace mozilla {
namespace detail {

struct MOZ_STACK_CLASS SprintfAppend final : public mozilla::PrintfTarget {
template <size_t N>
explicit SprintfAppend(char (&aBuf)[N]) : mBuf(aBuf), mBufLen(N) {}

bool append(const char* aStr, size_t aLen) override {
if (aLen == 0) {
return true;
}
// Don't copy more than what's left to use.
size_t copy = std::min(mBufLen, aLen);
if (copy > 0) {
memcpy(mBuf, aStr, copy);
mBuf += copy;
mBufLen -= copy;
}
return true;
}

private:
char* mBuf;
size_t mBufLen;
};

} // namespace detail
} // namespace mozilla

template <size_t N>
MOZ_FORMAT_PRINTF(2, 0)
int VsprintfLiteral(char (&buffer)[N], const char* format, va_list args) {
MOZ_ASSERT(format != buffer);
mozilla::detail::SprintfAppend ss(buffer);
ss.vprint(format, args);
size_t len = ss.emitted();
buffer[std::min(len, N - 1)] = '\0';
return len;
int result = vsnprintf(buffer, N, format, args);
buffer[N - 1] = '\0';
return result;
}

template <size_t N>
Expand Down
2 changes: 2 additions & 0 deletions mfbt/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ EXPORTS.mozilla = [
"HashTable.h",
"HelperMacros.h",
"InitializedOnce.h",
"IntegerPrintfMacros.h",
"IntegerRange.h",
"IntegerTypeTraits.h",
"JSONWriter.h",
Expand Down Expand Up @@ -99,6 +100,7 @@ EXPORTS.mozilla = [
"SmallPointerArray.h",
"Span.h",
"SplayTree.h",
"Sprintf.h",
"SPSCQueue.h",
"StaticAnalysisFunctions.h",
"TaggedAnonymousMemory.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1116,12 +1116,7 @@ static void TestScan() {

#endif /* SHOULD_TEST_SCANF_MACROS */

#if defined(XP_WIN)
int wmain()
#else
int main()
#endif // defined(XP_WIN)
{
int main() {
TestPrint();
#if SHOULD_TEST_SCANF_MACROS
TestScan();
Expand Down
13 changes: 4 additions & 9 deletions mfbt/tests/TestRandomNum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "mozilla/RandomNum.h"
#include <vector>

/*
Expand Down Expand Up @@ -38,20 +37,16 @@ static uint64_t getRandomUint64OrDie() {
}

static void TestRandomUint64() {
// The allocator uses RandomNum.h too, but its initialization path allocates
// memory. While the allocator itself handles the situation, we can't, so
// we make sure to use an allocation before getting a Random number ourselves.
std::vector<uint64_t> randomsList;
randomsList.reserve(NUM_RANDOMS_TO_GENERATE);
uint64_t randomsList[NUM_RANDOMS_TO_GENERATE];

for (uint8_t i = 0; i < NUM_RANDOMS_TO_GENERATE; ++i) {
uint64_t randomNum = getRandomUint64OrDie();

for (uint64_t num : randomsList) {
MOZ_RELEASE_ASSERT(randomNum != num);
for (uint8_t j = 0; j < i; ++j) {
MOZ_RELEASE_ASSERT(randomNum != randomsList[j]);
}

randomsList.push_back(randomNum);
randomsList[i] = randomNum;
}
}

Expand Down
6 changes: 5 additions & 1 deletion mfbt/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ CppUnitTests(
"TestFunctionRef",
"TestFunctionTypeTraits",
"TestHashTable",
"TestIntegerPrintfMacros",
"TestIntegerRange",
"TestJSONWriter",
"TestLinkedList",
Expand Down Expand Up @@ -91,6 +92,9 @@ if not CONFIG["MOZ_ASAN"]:
]
)

# Since we link directly with MFBT object files, define IMPL_MFBT
DEFINES["IMPL_MFBT"] = True

DisableStlWrapping()

if CONFIG["CC_TYPE"] == "clang-cl":
Expand All @@ -100,7 +104,7 @@ if CONFIG["CC_TYPE"] == "clang-cl":
]

USE_LIBS += [
"mozglue",
"mfbt",
]

if CONFIG["CC_TYPE"] in ("clang", "gcc"):
Expand Down
44 changes: 1 addition & 43 deletions mozglue/misc/Printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ using NumArgStateVector =
#if defined(XP_WIN)
# define TYPE_WSTRING 12
#endif
#define TYPE_SCHAR 14
#define TYPE_UCHAR 15
#define TYPE_UNKNOWN 20

#define FLAG_LEFT 0x1
Expand Down Expand Up @@ -536,10 +534,6 @@ static bool BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas) {
if (c == 'h') {
nas[cn].type = TYPE_SHORT;
c = *p++;
if (c == 'h') {
nas[cn].type = TYPE_SCHAR;
c = *p++;
}
} else if (c == 'L') {
nas[cn].type = TYPE_LONGLONG;
c = *p++;
Expand Down Expand Up @@ -568,15 +562,6 @@ static bool BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas) {
: sizeof(ptrdiff_t) == sizeof(long) ? TYPE_LONG
: TYPE_LONGLONG;
c = *p++;
} else if (c == 'j') {
static_assert(sizeof(intmax_t) == sizeof(int) ||
sizeof(intmax_t) == sizeof(long) ||
sizeof(intmax_t) == sizeof(long long),
"intmax_t is not one of the expected sizes");
nas[cn].type = sizeof(intmax_t) == sizeof(int) ? TYPE_INTN
: sizeof(intmax_t) == sizeof(long) ? TYPE_LONG
: TYPE_LONGLONG;
c = *p++;
}

// format
Expand Down Expand Up @@ -657,8 +642,6 @@ static bool BuildArgArray(const char* fmt, va_list ap, NumArgStateVector& nas) {
VARARGS_ASSIGN(nas[cn].ap, ap);

switch (nas[cn].type) {
case TYPE_SCHAR:
case TYPE_UCHAR:
case TYPE_SHORT:
case TYPE_USHORT:
case TYPE_INTN:
Expand Down Expand Up @@ -838,10 +821,6 @@ bool mozilla::PrintfTarget::vprint(const char* fmt, va_list ap) {
if (c == 'h') {
type = TYPE_SHORT;
c = *fmt++;
if (c == 'h') {
type = TYPE_SCHAR;
c = *fmt++;
}
} else if (c == 'L') {
type = TYPE_LONGLONG;
c = *fmt++;
Expand Down Expand Up @@ -870,15 +849,6 @@ bool mozilla::PrintfTarget::vprint(const char* fmt, va_list ap) {
: sizeof(ptrdiff_t) == sizeof(long) ? TYPE_LONG
: TYPE_LONGLONG;
c = *fmt++;
} else if (c == 'j') {
static_assert(sizeof(intmax_t) == sizeof(int) ||
sizeof(intmax_t) == sizeof(long) ||
sizeof(intmax_t) == sizeof(long long),
"intmax_t is not one of the expected sizes");
type = sizeof(intmax_t) == sizeof(int) ? TYPE_INTN
: sizeof(intmax_t) == sizeof(long) ? TYPE_LONG
: TYPE_LONGLONG;
c = *fmt++;
}

// format
Expand Down Expand Up @@ -912,18 +882,8 @@ bool mozilla::PrintfTarget::vprint(const char* fmt, va_list ap) {

fetch_and_convert:
switch (type) {
case TYPE_SCHAR:
u.l = (signed char)va_arg(ap, int);
if (u.l < 0) {
u.l = -u.l;
flags |= FLAG_NEG;
}
goto do_long;
case TYPE_UCHAR:
u.l = (unsigned char)va_arg(ap, unsigned int);
goto do_long;
case TYPE_SHORT:
u.l = (short)va_arg(ap, int);
u.l = va_arg(ap, int);
if (u.l < 0) {
u.l = -u.l;
flags |= FLAG_NEG;
Expand Down Expand Up @@ -1109,8 +1069,6 @@ bool mozilla::PrintfTarget::print(const char* format, ...) {
#undef TYPE_POINTER
#undef TYPE_WSTRING
#undef TYPE_UNKNOWN
#undef TYPE_SCHAR
#undef TYPE_UCHAR

#undef FLAG_LEFT
#undef FLAG_SIGNED
Expand Down
2 changes: 0 additions & 2 deletions mozglue/misc/Printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ class PrintfTarget {
bool MFBT_API appendIntOct(uint64_t);
bool MFBT_API appendIntHex(uint64_t);

inline size_t emitted() { return mEmitted; }

protected:
MFBT_API PrintfTarget();
virtual ~PrintfTarget() = default;
Expand Down
2 changes: 0 additions & 2 deletions mozglue/misc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ EXPORTS.mozilla += [
"AutoProfilerLabel.h",
"decimal/Decimal.h",
"decimal/DoubleConversion.h",
"IntegerPrintfMacros.h",
"MmapFaultHandler.h",
"PlatformConditionVariable.h",
"PlatformMutex.h",
"Printf.h",
"Sprintf.h",
"StackWalk.h",
"TimeStamp.h",
"Uptime.h",
Expand Down
1 change: 0 additions & 1 deletion mozglue/tests/TestPrintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ static void TestPrintfFormats() {
MOZ_RELEASE_ASSERT(print_one("0xF0F0", "0x%llX", 0xf0f0ull));
MOZ_RELEASE_ASSERT(print_one("27270", "%zu", (size_t)27270));
MOZ_RELEASE_ASSERT(print_one("27270", "%tu", (ptrdiff_t)27270));
MOZ_RELEASE_ASSERT(print_one("27270", "%ju", (intmax_t)27270));
MOZ_RELEASE_ASSERT(print_one("hello", "he%so", "ll"));
MOZ_RELEASE_ASSERT(print_one("hello ", "%-8s", "hello"));
MOZ_RELEASE_ASSERT(print_one(" hello", "%8s", "hello"));
Expand Down
1 change: 0 additions & 1 deletion mozglue/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ GeckoCppUnitTests(
CppUnitTests(
[
"TestBaseProfiler",
"TestIntegerPrintfMacros",
"TestPrintf",
]
)
Expand Down
23 changes: 23 additions & 0 deletions toolkit/mozapps/update/updater/TsanOptions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#include "mozilla/Attributes.h"
#include "mozilla/TsanOptions.h"

#ifndef _MSC_VER // Not supported by clang-cl yet

// See also mozglue/build/TsanOptions.cpp before modifying this
extern "C" const char* __tsan_default_suppressions() {
// clang-format off
return "# Add your suppressions below\n"

// External uninstrumented libraries
MOZ_TSAN_DEFAULT_EXTLIB_SUPPRESSIONS

// End of suppressions.
; // Please keep this semicolon.
// clang-format on
}
#endif // _MSC_VER
8 changes: 7 additions & 1 deletion toolkit/mozapps/update/updater/updater-common.build
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ if CONFIG["OS_ARCH"] == "WINNT":
USE_LIBS += [
"bspatch",
"mar",
"mozglue",
"updatecommon",
"xz-embedded",
]
Expand Down Expand Up @@ -79,6 +78,13 @@ if have_progressui == 0:

SOURCES += sorted(srcs)

if CONFIG["MOZ_TSAN"]:
# Since mozglue is not linked to the updater,
# we need to include our own TSan suppression list.
SOURCES += [
"TsanOptions.cpp",
]

DEFINES["NS_NO_XPCOM"] = True
DisableStlWrapping()
for var in ("MAR_CHANNEL_ID", "MOZ_APP_VERSION"):
Expand Down
2 changes: 1 addition & 1 deletion xpcom/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test_progs = [
]
SimplePrograms(test_progs)

USE_LIBS += ["mozglue"]
USE_LIBS += ["mfbt"]

XPCSHELL_TESTS_MANIFESTS += ["unit/xpcshell.ini"]

Expand Down

0 comments on commit 6428905

Please sign in to comment.