зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1780010 - Part 9: Replace sizeof with std::size(). r=jandem
Depends on D152049 Differential Revision: https://phabricator.services.mozilla.com/D152051
This commit is contained in:
Родитель
8a41764bfe
Коммит
6dad1f49aa
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "jit/arm64/vixl/Instructions-vixl.h"
|
||||
#include "jit/shared/Architecture-shared.h"
|
||||
|
@ -159,8 +160,7 @@ class Registers {
|
|||
"x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
|
||||
"x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
|
||||
"x24", "x25", "x26", "x27", "x28", "x29", "lr", "sp"};
|
||||
static_assert(Total == sizeof(Names) / sizeof(Names[0]),
|
||||
"Table is the correct size");
|
||||
static_assert(Total == std::size(Names), "Table is the correct size");
|
||||
if (code >= Total) {
|
||||
return "invalid";
|
||||
}
|
||||
|
@ -453,8 +453,7 @@ class FloatRegisters {
|
|||
"v30", "v31",
|
||||
};
|
||||
// clang-format on
|
||||
static_assert(Total == sizeof(Names) / sizeof(Names[0]),
|
||||
"Table is the correct size");
|
||||
static_assert(Total == std::size(Names), "Table is the correct size");
|
||||
if (code >= Total) {
|
||||
return "invalid";
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "jit/shared/Architecture-shared.h"
|
||||
|
||||
|
@ -143,8 +144,7 @@ class Registers {
|
|||
"zero", "ra", "tp", "sp", "a0", "a1", "a2", "a3", "a4", "a5", "a6",
|
||||
"a7", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "rx",
|
||||
"fp", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8"};
|
||||
static_assert(Total == sizeof(Names) / sizeof(Names[0]),
|
||||
"Table is the correct size");
|
||||
static_assert(Total == std::size(Names), "Table is the correct size");
|
||||
if (code >= Total) {
|
||||
return "invalid";
|
||||
}
|
||||
|
@ -260,8 +260,7 @@ class FloatRegisters {
|
|||
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
|
||||
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
|
||||
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"};
|
||||
static_assert(TotalPhys == sizeof(Names) / sizeof(Names[0]),
|
||||
"Table is the correct size");
|
||||
static_assert(TotalPhys == std::size(Names), "Table is the correct size");
|
||||
if (code >= Total) {
|
||||
return "invalid";
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include "jit/ABIFunctions.h"
|
||||
#include "jit/IonAnalysis.h"
|
||||
#include "jit/Linker.h"
|
||||
|
@ -583,10 +585,10 @@ struct DefineCheckArgs<Res (*)(Args...)> {
|
|||
{ArgsFillBits::table, ArgsFillBits::size, CheckArgsFillBits},
|
||||
};
|
||||
const Test* tests = testsWithoutBoolArgs;
|
||||
size_t numTests = sizeof(testsWithoutBoolArgs) / sizeof(Test);
|
||||
size_t numTests = std::size(testsWithoutBoolArgs);
|
||||
if (AnyBool_v<Args...>) {
|
||||
tests = testsWithBoolArgs;
|
||||
numTests = sizeof(testsWithBoolArgs) / sizeof(Test);
|
||||
numTests = std::size(testsWithBoolArgs);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < numTests; i++) {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "xpcprivate.h"
|
||||
#include "nsError.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
/***************************************************************************/
|
||||
/* Quick and dirty mapping of well known result codes to strings. We only
|
||||
* call this when building an exception object, so iterating the short array
|
||||
|
@ -29,7 +31,7 @@ static const struct ResultMap {
|
|||
{NS_OK, 0, 0} // sentinel to mark end of array
|
||||
};
|
||||
|
||||
#define RESULT_COUNT ((sizeof(map) / sizeof(map[0])) - 1)
|
||||
#define RESULT_COUNT (std::size(map) - 1)
|
||||
|
||||
// static
|
||||
bool nsXPCException::NameAndFormatForNSResult(nsresult rv, const char** name,
|
||||
|
|
Загрузка…
Ссылка в новой задаче