Skip to content

Commit 0ecdaa7

Browse files
committed
address feedback
1 parent bc2716c commit 0ecdaa7

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

xpti/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (XPTI_ENABLE_WERROR)
1414
if(MSVC)
1515
set(CMAKE_CXX_FLAGS "/WX ${CMAKE_CXX_FLAGS}")
1616
else()
17-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
17+
set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
1818
endif()
1919
endif()
2020

xptifw/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (XPTI_ENABLE_WERROR)
1919
if(MSVC)
2020
set(CMAKE_CXX_FLAGS "/WX ${CMAKE_CXX_FLAGS}")
2121
else()
22-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
22+
set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
2323
endif()
2424
endif()
2525

xptifw/unit_test/xpti_api_tests.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
#include <vector>
1212

1313
static int func_callback_update = 0;
14-
static bool TPCB2Called = false;
15-
14+
static int TPCB2Called = 0;
1615
class xptiApiTest : public ::testing::Test {
1716
protected:
1817
void SetUp() override {
19-
TPCB2Called = false;
18+
TPCB2Called = 0;
2019
func_callback_update = 0;
2120
}
2221

@@ -220,8 +219,8 @@ void trace_point_callback(uint16_t /*trace_type*/,
220219
void trace_point_callback2(uint16_t /*trace_type*/,
221220
xpti::trace_event_data_t * /*parent*/,
222221
xpti::trace_event_data_t * /*event*/,
223-
uint64_t /*instance*/, const void * /*user_data*/) {
224-
TPCB2Called = true;
222+
uint64_t /*instance*/, const void *user_data) {
223+
TPCB2Called = *static_cast<const int *>(user_data);
225224
}
226225

227226
void fn_callback(uint16_t /*trace_type*/, xpti::trace_event_data_t * /*parent*/,
@@ -307,13 +306,12 @@ TEST_F(xptiApiTest, xptiNotifySubscribersGoodInput) {
307306

308307
uint8_t StreamID = xptiRegisterStream("foo");
309308
xptiForceSetTraceEnabled(true);
310-
int foo_return = 0;
309+
int FooUserData = 42;
311310
auto Result = xptiRegisterCallback(StreamID, 1, trace_point_callback2);
312311
EXPECT_EQ(Result, xpti::result_t::XPTI_RESULT_SUCCESS);
313-
Result = xptiNotifySubscribers(StreamID, 1, nullptr, Event, 0,
314-
(void *)(&foo_return));
312+
Result = xptiNotifySubscribers(StreamID, 1, nullptr, Event, 0, &FooUserData);
315313
EXPECT_EQ(Result, xpti::result_t::XPTI_RESULT_SUCCESS);
316-
EXPECT_TRUE(TPCB2Called);
314+
EXPECT_EQ(TPCB2Called, FooUserData);
317315
int tmp = func_callback_update;
318316
Result = xptiRegisterCallback(
319317
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::function_begin),

0 commit comments

Comments
 (0)