summaryrefslogtreecommitdiffstats
path: root/src/gtest/bp_timer_gtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtest/bp_timer_gtest.cpp')
-rw-r--r--src/gtest/bp_timer_gtest.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gtest/bp_timer_gtest.cpp b/src/gtest/bp_timer_gtest.cpp
index 5185da87..07f0e214 100644
--- a/src/gtest/bp_timer_gtest.cpp
+++ b/src/gtest/bp_timer_gtest.cpp
@@ -22,6 +22,8 @@ limitations under the License.
#include <common/gtest.h>
#include <common/basic_utils.h>
#include "h_timer.h"
+#include <common/utl_gcc_diag.h>
+
class gt_r_timer : public testing::Test {
@@ -150,9 +152,9 @@ void my_test_on_tick_cb(void *userdata,CHTimerObj *tmr){
CHTimerWheel * lp=(CHTimerWheel *)userdata;
- #pragma GCC diagnostic ignored "-Winvalid-offsetof"
+ UNSAFE_CONTAINER_OF_PUSH
CMyTestObject *lpobj=(CMyTestObject *)((uint8_t*)tmr-offsetof (CMyTestObject,m_timer));
- #pragma GCC diagnostic pop
+ UNSAFE_CONTAINER_OF_POP
printf(" [event %d ]",lpobj->m_id);
lp->timer_start(tmr,2);
}
@@ -182,9 +184,9 @@ void my_test_on_tick_cb7(void *userdata,CHTimerObj *tmr){
CHTimerWheel * lp=(CHTimerWheel *)userdata;
- #pragma GCC diagnostic ignored "-Winvalid-offsetof"
+ UNSAFE_CONTAINER_OF_PUSH
CMyTestObject *lpobj=(CMyTestObject *)((uint8_t*)tmr-offsetof (CMyTestObject,m_timer));
- #pragma GCC diagnostic pop
+ UNSAFE_CONTAINER_OF_POP
printf(" [event %d ]",lpobj->m_id);
lp->timer_start(tmr,9);
}
@@ -193,9 +195,9 @@ void my_test_on_tick_cb_free(void *userdata,CHTimerObj *tmr){
//CHTimerWheel * lp=(CHTimerWheel *)userdata;
- #pragma GCC diagnostic ignored "-Winvalid-offsetof"
+ UNSAFE_CONTAINER_OF_PUSH
CMyTestObject *lpobj=(CMyTestObject *)((uint8_t*)tmr-offsetof (CMyTestObject,m_timer));
- #pragma GCC diagnostic pop
+ UNSAFE_CONTAINER_OF_POP
printf(" [event %d ]",lpobj->m_id);
delete lpobj;
}
@@ -262,9 +264,9 @@ private:
void my_test_on_tick_cb8(void *userdata,CHTimerObj *tmr){
CHTimerWheelBase * lp=(CHTimerWheelBase *)userdata;
- #pragma GCC diagnostic ignored "-Winvalid-offsetof"
+ UNSAFE_CONTAINER_OF_PUSH
CMyTestObject *lpobj=(CMyTestObject *)((uint8_t*)tmr-offsetof (CMyTestObject,m_timer));
- #pragma GCC diagnostic pop
+ UNSAFE_CONTAINER_OF_POP
lp->on_tick(lpobj);
}