Skip to content

Commit

Permalink
Remove a bunch of unused parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
grojo-ea committed Aug 16, 2024
1 parent c9bfe37 commit 4b788cd
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
14 changes: 7 additions & 7 deletions include/EASTL/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ namespace eastl

// We intentionally provide no constructor, destructor, or assignment operator.

void fill(const value_type& value) {}
void fill(const value_type&) {}

// Unlike the swap function for other containers, array::swap takes linear time,
// may exit via an exception, and does not cause iterators to become associated with the other container.
void swap(this_type& x) EA_NOEXCEPT {}
void swap(this_type&) EA_NOEXCEPT {}

EA_CPP14_CONSTEXPR iterator begin() EA_NOEXCEPT { return nullptr; }
EA_CPP14_CONSTEXPR const_iterator begin() const EA_NOEXCEPT { return nullptr; }
Expand All @@ -184,11 +184,11 @@ namespace eastl
EA_CPP14_CONSTEXPR T* data() EA_NOEXCEPT { return nullptr; }
EA_CPP14_CONSTEXPR const T* data() const EA_NOEXCEPT { return nullptr; }

EA_CPP14_CONSTEXPR reference operator[](size_type i) { return *data(); }
EA_CPP14_CONSTEXPR const_reference operator[](size_type i) const { return *data(); }
EA_CPP14_CONSTEXPR reference operator[](size_type) { return *data(); }
EA_CPP14_CONSTEXPR const_reference operator[](size_type) const { return *data(); }

EA_DISABLE_VC_WARNING(4702); // unreachable code
EA_CPP14_CONSTEXPR const_reference at(size_type i) const
EA_CPP14_CONSTEXPR const_reference at(size_type) const
{
#if EASTL_EXCEPTIONS_ENABLED
throw std::out_of_range("array::at -- out of range");
Expand All @@ -200,7 +200,7 @@ namespace eastl
EA_RESTORE_VC_WARNING();

EA_DISABLE_VC_WARNING(4702); // unreachable code
EA_CPP14_CONSTEXPR reference at(size_type i)
EA_CPP14_CONSTEXPR reference at(size_type)
{
#if EASTL_EXCEPTIONS_ENABLED
throw std::out_of_range("array::at -- out of range");
Expand All @@ -218,7 +218,7 @@ namespace eastl
EA_CPP14_CONSTEXPR const_reference back() const { return *data(); }

bool validate() const { return true; }
int validate_iterator(const_iterator i) const { return isf_none; }
int validate_iterator(const_iterator) const { return isf_none; }

}; // class array

Expand Down
1 change: 1 addition & 0 deletions include/EASTL/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ namespace eastl
EA_CONSTEXPR SpanStorage(T* ptr, eastl_size_t size)
: mpData(ptr)
{
EA_UNUSED(size);
EASTL_ASSERT_MSG(Extent == size, "impossible to create a span with a fixed Extent different than the size of the supplied buffer");
}
};
Expand Down
1 change: 1 addition & 0 deletions include/EASTL/string_hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ template <class... Args>
typename string_hash_map<T, Hash, Predicate, Allocator>::iterator
string_hash_map<T, Hash, Predicate, Allocator>::try_emplace(typename string_hash_map<T, Hash, Predicate, Allocator>::const_iterator hint, const char* key, Args&&...valArgs)
{
EA_UNUSED(hint);
// The hint is currently ignored in all our implementations :(
auto ret = try_emplace(key, eastl::forward<Args>(valArgs)...);
return base::base_type::DoGetResultIterator(true_type(), ret);
Expand Down
8 changes: 4 additions & 4 deletions test/source/TestAtomicBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,15 +1277,15 @@ void AtomicPointerBasicTest::TestAtomicPointerStandalone()
{
AtomicType atomic;

PtrType ret = atomic_load_cond(&atomic, [](PtrType val) { return true; });
PtrType ret = atomic_load_cond(&atomic, [](PtrType) { return true; });

VERIFY(ret == (PtrType)0x0);
}

{
AtomicType atomic;

PtrType ret = atomic_load_cond_explicit(&atomic, [](PtrType val) { return true; }, eastl::memory_order_relaxed);
PtrType ret = atomic_load_cond_explicit(&atomic, [](PtrType) { return true; }, eastl::memory_order_relaxed);

VERIFY(ret == (PtrType)0x0);
}
Expand Down Expand Up @@ -3750,15 +3750,15 @@ void AtomicIntegralBasicTest<T>::TestAtomicStandalone()
{
AtomicType atomic;

IntegralType ret = atomic_load_cond(&atomic, [](IntegralType val) { return true; });
IntegralType ret = atomic_load_cond(&atomic, [](IntegralType) { return true; });

VERIFY(ret == 0);
}

{
AtomicType atomic;

IntegralType ret = atomic_load_cond_explicit(&atomic, [](IntegralType val) { return true; }, eastl::memory_order_relaxed);
IntegralType ret = atomic_load_cond_explicit(&atomic, [](IntegralType) { return true; }, eastl::memory_order_relaxed);

VERIFY(ret == 0);
}
Expand Down
2 changes: 1 addition & 1 deletion test/source/TestBitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int TestBitsetWithWord()
};

auto verifyToUlongThrowsIf32bit = [&nErrorCount](const auto& bs, unsigned long truncatedValue) {
if (sizeof(unsigned long) < 8)
if constexpr (sizeof(unsigned long) < 8)
{
unsigned long(*convert)(const decltype(bs)&) = [](const auto& bs) { return bs.to_ulong_no_assert_convertible(); };
nErrorCount += VerifyBitsetConversionThrows(bs, convert, truncatedValue);
Expand Down
2 changes: 1 addition & 1 deletion test/source/TestConcepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct From;

struct To
{
To(const From& f)
To(const From&)
{}

To(const int&) // To can be implicitly constructed from int, but int cannot be explicitly converted to To.
Expand Down
6 changes: 3 additions & 3 deletions test/source/TestFunctional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ int TestFunctional()
void Add(int addAmount) { value += addAmount; }
int GetValue() { return value; }
int& GetValueReference() { return value; }
void NoThrow(int inValue) EA_NOEXCEPT {}
void NoThrow(int) EA_NOEXCEPT {}
int value;
};

Expand Down Expand Up @@ -685,8 +685,8 @@ int TestFunctional()
{
struct TestInvokeConstAccess
{
void ConstMemberFunc(int i) const {}
void ConstVolatileMemberFunc(int i) const volatile {}
void ConstMemberFunc(int) const {}
void ConstVolatileMemberFunc(int) const volatile {}

int mI;
};
Expand Down
4 changes: 2 additions & 2 deletions test/source/TestIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ int TestIterator_moveIterator()
FakeProxyIterator& operator++() { return *this; }
FakeProxyIterator operator++(int) { return {}; }

bool operator==(const FakeProxyIterator& rhs) { return true; };
bool operator!=(const FakeProxyIterator& rhs) { return false; };
bool operator==(const FakeProxyIterator&) { return true; };
bool operator!=(const FakeProxyIterator&) { return false; };
};

FakeProxyIterator it = {};
Expand Down
10 changes: 5 additions & 5 deletions test/source/TestOptional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static int TestOptional_MonadicOperations()

{
const optional<int> o{42};
auto result = o.and_then([](const int& x) -> optional<string> { return nullopt; });
auto result = o.and_then([](const int&) -> optional<string> { return nullopt; });
VERIFY(!result.has_value());
VERIFY(o.has_value());
VERIFY(*o == 42);
Expand Down Expand Up @@ -282,7 +282,7 @@ static int TestOptional_MonadicOperations()
{
const optional<unique_ptr<int>> o = eastl::make_unique<int>(42);
auto result =
eastl::move(o).and_then([](const unique_ptr<int>&& ptr) -> optional<string> { return nullopt; });
eastl::move(o).and_then([](const unique_ptr<int>&&) -> optional<string> { return nullopt; });
VERIFY(!result.has_value());
VERIFY(o.has_value());
VERIFY(o.value() != nullptr);
Expand Down Expand Up @@ -325,7 +325,7 @@ static int TestOptional_MonadicOperations()
eastl::string externalString = "Jean Guegant was here";

optional<int> o{42};
auto result = o.transform([&externalString](int& x) -> const eastl::string& { return externalString; });
auto result = o.transform([&externalString](int&) -> const eastl::string& { return externalString; });

static_assert(eastl::is_same_v<decltype(result), optional<eastl::string>>,
"Wrong return type for transform.");
Expand Down Expand Up @@ -365,7 +365,7 @@ static int TestOptional_MonadicOperations()

const optional<int> o{42};
auto result =
o.transform([&externalString](const int& x) -> const eastl::string& { return externalString; });
o.transform([&externalString](const int&) -> const eastl::string& { return externalString; });

static_assert(eastl::is_same_v<decltype(result), optional<eastl::string>>,
"Wrong return type for transform.");
Expand Down Expand Up @@ -447,7 +447,7 @@ static int TestOptional_MonadicOperations()

const optional<unique_ptr<int>> o = eastl::make_unique<int>(42);
auto result = eastl::move(o).transform(
[&externalString](const unique_ptr<int>&& ptr) -> const eastl::string& { return externalString; });
[&externalString](const unique_ptr<int>&&) -> const eastl::string& { return externalString; });

static_assert(eastl::is_same_v<decltype(result), optional<eastl::string>>,
"Wrong return type for transform.");
Expand Down

0 comments on commit 4b788cd

Please sign in to comment.