Skip to content

Commit c7a0e9d

Browse files
authored
Prevent unused parameter warnings
1 parent bc792a9 commit c7a0e9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: cores/arduino/new.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ void * operator new[](std::size_t size) {
5757
}
5858

5959
void * operator new(std::size_t size, const std::nothrow_t tag) noexcept {
60+
// Prevent an 'unused parameter' warning
61+
static_cast<void>(tag);
6062
#if defined(NEW_TERMINATES_ON_FAILURE)
6163
// Cannot call throwing operator new as standard suggests, so call
6264
// new_helper directly then
@@ -66,6 +68,8 @@ void * operator new(std::size_t size, const std::nothrow_t tag) noexcept {
6668
#endif
6769
}
6870
void * operator new[](std::size_t size, const std::nothrow_t& tag) noexcept {
71+
// Prevent an 'unused parameter' warning
72+
static_cast<void>(tag);
6973
#if defined(NEW_TERMINATES_ON_FAILURE)
7074
// Cannot call throwing operator new[] as standard suggests, so call
7175
// malloc directly then
@@ -101,9 +105,13 @@ void operator delete[](void * ptr, std::size_t size) noexcept {
101105
#endif // __cplusplus >= 201402L
102106

103107
void operator delete(void* ptr, const std::nothrow_t& tag) noexcept {
108+
// Prevent an 'unused parameter' warning
109+
static_cast<void>(tag);
104110
operator delete(ptr);
105111
}
106112
void operator delete[](void* ptr, const std::nothrow_t& tag) noexcept {
113+
// Prevent an 'unused parameter' warning
114+
static_cast<void>(tag);
107115
operator delete[](ptr);
108116
}
109117

0 commit comments

Comments
 (0)