Skip to content

Commit 160be7e

Browse files
committed
Wrapped Ticker functions with #pragma disabling -Wcast-function-type
1 parent 41a83c4 commit 160be7e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: libraries/Ticker/src/Ticker.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class Ticker
4747
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), 0);
4848
}
4949

50+
#pragma GCC diagnostic push
51+
#pragma GCC diagnostic ignored "-Wcast-function-type"
5052
template<typename TArg>
5153
void attach(float seconds, void (*callback)(TArg), TArg arg)
5254
{
@@ -65,6 +67,7 @@ class Ticker
6567
uint32_t arg32 = (uint32_t)arg;
6668
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), arg32);
6769
}
70+
#pragma GCC diagnostic pop
6871

6972
void once(float seconds, callback_t callback)
7073
{
@@ -73,9 +76,11 @@ class Ticker
7376

7477
void once_ms(uint32_t milliseconds, callback_t callback)
7578
{
76-
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
79+
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
7780
}
7881

82+
#pragma GCC diagnostic push
83+
#pragma GCC diagnostic ignored "-Wcast-function-type"
7984
template<typename TArg>
8085
void once(float seconds, void (*callback)(TArg), TArg arg)
8186
{
@@ -91,11 +96,12 @@ class Ticker
9196
uint32_t arg32 = (uint32_t)(arg);
9297
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), arg32);
9398
}
99+
#pragma GCC diagnostic pop
94100

95101
void detach();
96102
bool active();
97103

98-
protected:
104+
protected:
99105
void _attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, uint32_t arg);
100106

101107

0 commit comments

Comments
 (0)