Skip to content

Commit 5a87cd3

Browse files
committed
update ovbase/ovutil for clang19
1 parent f5c5e25 commit 5a87cd3

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed

src/c/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ add_custom_target(copy_related_files
9494
set(is_clang "$<C_COMPILER_ID:Clang>")
9595
set(v16_or_later "$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,16>")
9696
set(v18_or_later "$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,18>")
97+
set(v19_or_later "$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,19>")
9798
add_library(gcmzdrops_intf INTERFACE)
9899
target_include_directories(gcmzdrops_intf INTERFACE
99100
"${CMAKE_CURRENT_BINARY_DIR}" # for version.h
@@ -119,6 +120,7 @@ target_compile_options(gcmzdrops_intf INTERFACE
119120
-Wno-padded
120121
$<$<AND:${is_clang},${v16_or_later}>:-Wno-unsafe-buffer-usage>
121122
$<$<AND:${is_clang},${v18_or_later}>:-Wno-switch-default>
123+
$<$<AND:${is_clang},${v19_or_later}>:-Wno-pre-c11-compat>
122124
-ffunction-sections
123125
-fdata-sections
124126
$<$<CONFIG:Debug>:-O0>
@@ -130,7 +132,6 @@ target_link_options(gcmzdrops_intf INTERFACE
130132
-Wl,--gc-sections
131133
# -Wl,--print-gc-sections
132134
--rtlib=compiler-rt
133-
-no-pthread
134135
-static
135136
-Wl,--kill-at
136137
$<$<CONFIG:Release>:-s>

src/c/datauri_test.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void test_base64_decode(void) {
8181
size_t n = sizeof(test_data) / sizeof(test_data[0]);
8282
for (size_t i = 0; i < n; ++i) {
8383
struct test_data const *const td = test_data + i;
84-
TEST_CASE_("test #%d %ls", i, td->input);
84+
TEST_CASE_("test #%zu %ls", i, td->input);
8585

8686
size_t decoded_len = 0;
8787
TEST_EISG_F(base64_decoded_len(td->input, wcslen(td->input), &decoded_len), td->code);
@@ -91,8 +91,8 @@ static void test_base64_decode(void) {
9191

9292
size_t expected_len = strlen(td->output);
9393
TEST_CHECK(decoded_len == expected_len);
94-
TEST_MSG("expected %d", expected_len);
95-
TEST_MSG("got %d", decoded_len);
94+
TEST_MSG("expected %zu", expected_len);
95+
TEST_MSG("got %zu", decoded_len);
9696

9797
void *p = malloc(expected_len);
9898
TEST_ASSERT(p != NULL);
@@ -186,7 +186,7 @@ static void test_percent_decode(void) {
186186
size_t n = sizeof(test_data) / sizeof(test_data[0]);
187187
for (size_t i = 0; i < n; ++i) {
188188
struct test_data const *const td = test_data + i;
189-
TEST_CASE_("test #%d %ls", i, td->input);
189+
TEST_CASE_("test #%zu %ls", i, td->input);
190190

191191
size_t decoded_len = 0;
192192
TEST_EISG_F(percent_decoded_len(td->input, wcslen(td->input), &decoded_len), td->code);
@@ -196,8 +196,8 @@ static void test_percent_decode(void) {
196196

197197
size_t expected_len = strlen(td->output);
198198
TEST_CHECK(decoded_len == expected_len);
199-
TEST_MSG("expected %d", expected_len);
200-
TEST_MSG("got %d", decoded_len);
199+
TEST_MSG("expected %zu", expected_len);
200+
TEST_MSG("got %zu", decoded_len);
201201

202202
void *p = malloc(expected_len);
203203
TEST_ASSERT(p != NULL);
@@ -316,7 +316,7 @@ static void test_parse_decode(void) {
316316
size_t n = sizeof(test_data) / sizeof(test_data[0]);
317317
for (size_t i = 0; i < n; ++i) {
318318
struct test_data const *const td = test_data + i;
319-
TEST_CASE_("test #%d \"%ls\"", i, td->input);
319+
TEST_CASE_("test #%zu \"%ls\"", i, td->input);
320320

321321
struct data_uri d = {0};
322322
TEST_EISG_F(data_uri_parse(td->input, wcslen(td->input), &d), td->code);
@@ -333,8 +333,8 @@ static void test_parse_decode(void) {
333333
TEST_MSG("got %ls", d.charset);
334334

335335
TEST_CHECK(wcscmp(td->output.ext_filename, d.ext_filename) == 0);
336-
TEST_MSG("expected %ls(%d)", td->output.ext_filename, wcslen(td->output.ext_filename));
337-
TEST_MSG("got %ls(%d)", d.ext_filename, wcslen(d.ext_filename));
336+
TEST_MSG("expected %ls(%zu)", td->output.ext_filename, wcslen(td->output.ext_filename));
337+
TEST_MSG("got %ls(%zu)", d.ext_filename, wcslen(d.ext_filename));
338338

339339
TEST_CHECK(td->output.encoding == d.encoding);
340340
TEST_MSG("expected %d", td->output.encoding);
@@ -358,8 +358,8 @@ static void test_parse_decode(void) {
358358
struct wstr fn = {0};
359359
if (TEST_SUCCEEDED_F(data_uri_suggest_filename(&d, &fn))) {
360360
TEST_CHECK(wcscmp(fn.ptr, td->suggest_filename) == 0);
361-
TEST_MSG("expected %ls(%d)", td->suggest_filename, wcslen(td->suggest_filename));
362-
TEST_MSG("got %ls(%d)", fn.ptr, fn.len);
361+
TEST_MSG("expected %ls(%zu)", td->suggest_filename, wcslen(td->suggest_filename));
362+
TEST_MSG("got %ls(%zu)", fn.ptr, fn.len);
363363
}
364364
ereport(sfree(&fn));
365365

src/c/gcmzfuncs_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void test_gcmz_is_need_copy(void) {
187187
size_t n = sizeof(test_data) / sizeof(test_data[0]);
188188
for (size_t i = 0; i < n; ++i) {
189189
struct test_data const *const td = test_data + i;
190-
TEST_CASE_("test #%d mode = %d \"%ls\"", i, td->mode, td->input);
190+
TEST_CASE_("test #%zu mode = %d \"%ls\"", i, td->mode, td->input);
191191
g_gui_mode = td->mode;
192192
if (!TEST_SUCCEEDED_F(scpy(&tmp, td->input))) {
193193
goto cleanup;
@@ -444,7 +444,7 @@ static void test_analyse_exedit_window_image(void) {
444444
size_t n = sizeof(test_data) / sizeof(test_data[0]);
445445
for (size_t i = 0; i < n; ++i) {
446446
struct test_data const *const td = test_data + i;
447-
TEST_CASE_("test #%d \"%ls\"", i, td->filename);
447+
TEST_CASE_("test #%zu \"%ls\"", i, td->filename);
448448
if (!TEST_SUCCEEDED_F(scpy(&bmppath, testdir.ptr))) {
449449
continue;
450450
}

src/c/gui.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,7 @@ error gui_init(HWND const window) {
225225

226226
int y = (save_mode_height > save_dir_height ? save_mode_height : save_dir_height) + padding;
227227
{
228-
enum {
229-
button_width = 128,
230-
};
228+
static int const button_width = 128;
231229
mo_snprintf_wchar(buf, buf_size, NULL, "%1$s", gettext("Revert to initial"));
232230
HWND h = CreateWindowExW(0,
233231
L"BUTTON",

src/c/luafuncs_test.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static void test_hashtostring(void) {
345345
size_t n = sizeof(test_data) / sizeof(test_data[0]);
346346
for (size_t i = 0; i < n; ++i) {
347347
struct test_data const *const td = test_data + i;
348-
TEST_CASE_("test #%d \"%ls\"", i, td->output);
348+
TEST_CASE_("test #%zu \"%ls\"", i, td->output);
349349
if (TEST_EISG_F(luafn_hashtostring_core(td->input, &tmp), td->code) && td->code) {
350350
TEST_CHECK(tmp.len > 0);
351351
TEST_CHECK(wcscmp(tmp.ptr, td->output) == 0);
@@ -367,7 +367,7 @@ static void test_encode_exo_text(void) {
367367
TEST_CHECK(strncmp(expected, got.ptr, strlen(expected)) == 0);
368368
TEST_CHECK(got.len == 4096);
369369
TEST_MSG("expected %d", 4096);
370-
TEST_MSG("got %d", got.len);
370+
TEST_MSG("got %zu", got.len);
371371

372372
cleanup:
373373
ereport(sfree(&got));
@@ -559,7 +559,7 @@ static void test_convertencoding(void) {
559559
size_t n = sizeof(test_data) / sizeof(test_data[0]);
560560
for (size_t i = 0; i < n; ++i) {
561561
struct test_data const *const td = test_data + i;
562-
TEST_CASE_("test #%d %d -> %d", i, td->input_cp, td->output_cp);
562+
TEST_CASE_("test #%zu %u -> %u", i, td->input_cp, td->output_cp);
563563
size_t input_len = (td->input_cp == 1200 || td->input_cp == 1201) ? wcslen(td->input) * 2 : strlen(td->input);
564564
error err = luafn_convertencoding_core(td->input, input_len, td->input_cp, td->output_cp, &tmp);
565565
if (TEST_SUCCEEDED_F(err)) {
@@ -609,7 +609,7 @@ static void test_choose_language(void) {
609609
size_t n = sizeof(test_data) / sizeof(test_data[0]);
610610
for (size_t i = 0; i < n; ++i) {
611611
struct test_data const *const td = test_data + i;
612-
TEST_CASE_("test #%d", i);
612+
TEST_CASE_("test #%zu", i);
613613
int r = luaL_dostring(L, td->script);
614614
if (!TEST_CHECK((td->ret == 0 && r != 0) || (td->ret != 0 && r == 0))) {
615615
continue;

0 commit comments

Comments
 (0)