diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-07 13:25:36 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-07 14:33:26 -0400 |
| commit | cc95f28f648ee56a189f733f25efcb986d9f205a (patch) | |
| tree | 7f48f2308f87e1c69b4ca997ca373964a67ae65a /test | |
| parent | 86b9b350c6344e78f0d22bcd054e568130a40b08 (diff) | |
pk.h: compiler warnings
Diffstat (limited to 'test')
| -rw-r--r-- | test/pkbktarr.c | 1 | ||||
| -rw-r--r-- | test/pkev.cpp | 20 | ||||
| -rw-r--r-- | test/pkuuid.c | 10 | ||||
| -rw-r--r-- | test/pkuuid.cpp | 14 |
4 files changed, 25 insertions, 20 deletions
diff --git a/test/pkbktarr.c b/test/pkbktarr.c index 2a00807..8bcb3e3 100644 --- a/test/pkbktarr.c +++ b/test/pkbktarr.c @@ -304,6 +304,7 @@ int main(int argc, char *argv[]) limits.b = 2; limits.i = 8; struct pk_bkt_arr_handle handles[limits.b][limits.i]; + (void)handles; expected_exit = false; caught = false; diff --git a/test/pkev.cpp b/test/pkev.cpp index a34b7d5..ed62803 100644 --- a/test/pkev.cpp +++ b/test/pkev.cpp @@ -4,9 +4,7 @@ #include "../pkmacros.h" #include <csetjmp> -#include <cstdio> #include <future> -#include <thread> static bool expected_exit = false; static bool caught = false; @@ -37,8 +35,14 @@ struct ev ev_two = {}; pk_ev_mgr_id_T test_setup() { - memset(&ev_one, 0, sizeof(struct ev)); - memset(&ev_two, 0, sizeof(struct ev)); + ev_one.evmgr = {}; + ev_one.evid = {}; + ev_one.count = {}; + ev_one.handled = {}; + ev_two.evmgr = {}; + ev_two.evid = {}; + ev_two.count = {}; + ev_two.handled = {}; pk_ev_init(); const pk_ev_mgr_id_T evmgr = pk_ev_create_mgr(); if (evmgr >= 64) { @@ -100,8 +104,12 @@ int main(int argc, char *argv[]) ev_two.evid = pk_ev_register_ev(evmgr, NULL); pk_ev_register_cb(evmgr, ev_one.evid, &invoke_packged_task, NULL); pk_ev_register_cb(evmgr, ev_two.evid, &invoke_packged_task, NULL); - auto t1 = std::thread([&handle_ev_one]() { pk_ev_emit(ev_one.evmgr, ev_one.evid, &handle_ev_one); }); - auto t2 = std::thread([&handle_ev_two]() { pk_ev_emit(ev_two.evmgr, ev_two.evid, &handle_ev_two); }); + std::thread t1 = std::thread([&]() { + pk_ev_emit(ev_one.evmgr, ev_one.evid, &handle_ev_one); + }); + std::thread t2 = std::thread([&]() { + pk_ev_emit(ev_two.evmgr, ev_two.evid, &handle_ev_two); + }); t1.join(); t2.join(); PK_LOGV_INF("%s: ev_one: %s, ev_two: %s\n", __FILE__, ev_one.handled ? "true" : "false", ev_two.handled ? "true" : "false"); diff --git a/test/pkuuid.c b/test/pkuuid.c index 3491ea3..3ea66b0 100644 --- a/test/pkuuid.c +++ b/test/pkuuid.c @@ -1,6 +1,4 @@ -#define PK_IMPL_UUID -#define PK_IMPL_TMR // #define PK_UUID_CLOCK CLOCK_REALTIME_ALARM #include "../pkmacros.h" @@ -35,13 +33,13 @@ print_uuid_v7_breakdown(FILE *f, struct pk_uuid id) fprintf(f, "\n"); fprintf(f, "var 2 0b"); - fprintf(f, "%.c", (id.uuid[8] & 0x80) ? '1' : '0'); - fprintf(f, "%.c", (id.uuid[8] & 0x40) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x80) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x40) ? '1' : '0'); fprintf(f, "\n"); fprintf(f, "rand_b 62 0b"); - fprintf(f, "%.c", (id.uuid[8] & 0x20) ? '1' : '0'); - fprintf(f, "%.c", (id.uuid[8] & 0x10) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x20) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x10) ? '1' : '0'); fprintf(f, ", 0x"); fprintf(f, "%.x", (id.uuid[8] & 0x0F)); fprintf(f, "%.2x", id.uuid[9]); diff --git a/test/pkuuid.cpp b/test/pkuuid.cpp index 35c099f..5755c54 100644 --- a/test/pkuuid.cpp +++ b/test/pkuuid.cpp @@ -1,6 +1,4 @@ -#define PK_IMPL_UUID -#define PK_IMPL_TMR // #define PK_UUID_CLOCK CLOCK_REALTIME_ALARM #include "../pkmacros.h" @@ -37,13 +35,13 @@ print_uuid_v7_breakdown(FILE *f, struct pk_uuid id) fprintf(f, "\n"); fprintf(f, "var 2 0b"); - fprintf(f, "%.c", (id.uuid[8] & 0x80) ? '1' : '0'); - fprintf(f, "%.c", (id.uuid[8] & 0x40) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x80) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x40) ? '1' : '0'); fprintf(f, "\n"); fprintf(f, "rand_b 62 0b"); - fprintf(f, "%.c", (id.uuid[8] & 0x20) ? '1' : '0'); - fprintf(f, "%.c", (id.uuid[8] & 0x10) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x20) ? '1' : '0'); + fprintf(f, "%c", (id.uuid[8] & 0x10) ? '1' : '0'); fprintf(f, ", 0x"); fprintf(f, "%.x", (id.uuid[8] & 0x0F)); fprintf(f, "%.2x", id.uuid[9]); @@ -85,12 +83,12 @@ main(int argc, char *argv[]) id1 = pk_uuid_zed; id2 = pk_uuid_zed; equals = id1 == id2; - fprintf(stdout, "[%s] equals (zed, zed): %b\n", __FILE__, equals); + fprintf(stdout, "[%s] equals (zed, zed): %c\n", __FILE__, equals ? '1' : '0'); if (equals != true) exit(1); id1 = pk_uuid_new_v7(); id2 = pk_uuid_new_v7(); equals = id1 == id2; - fprintf(stdout, "[%s] equals (rand, rand): %b\n", __FILE__, equals); + fprintf(stdout, "[%s] equals (rand, rand): %c\n", __FILE__, equals ? '1' : '0'); if (equals != false) exit(1); } |
