Use casts to explicitely allow conversions from intptr_t to pointers.

One could note that the C standard doesn't allow you to store a function
pointer into an intptr_t.  It seems that most people don't care.
This commit is contained in:
jca 2023-01-27 18:34:33 +00:00
parent e57a96eea1
commit 505b0a6fbd
2 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,5 @@
V = 0.9.0
REVISION = 5
REVISION = 6
COMMENT-main = mysql driver for libdbi
COMMENT-pgsql = pgsql driver for libdbi
COMMENT-sqlite3 = sqlite3 driver for libdbi

View File

@ -0,0 +1,16 @@
clang 15 doesn't allow implicit conversions from intptr_t to pointer.
Index: tests/cgreen/src/constraint.c
--- tests/cgreen/src/constraint.c.orig
+++ tests/cgreen/src/constraint.c
@@ -164,8 +164,8 @@ static void test_want_double(Constraint *constraint, c
}
static int compare_using_matcher(Constraint *constraint, intptr_t actual) {
- int (*matches)(const void*) = constraint->expected;
- return matches(actual);
+ int (*matches)(const void*) = (int (*)(const void *))constraint->expected;
+ return matches((void *)actual);
}
static void test_with_matcher(Constraint *constraint, const char *function, const char* matcher_name, intptr_t matcher_function, const char *test_file, int test_line, TestReporter *reporter) {