summaryrefslogtreecommitdiff
blob: 9269349726d5747ed03bea86537aedf55ee8de63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From e1da090da24f5620784daf853eb1353aa164583f Mon Sep 17 00:00:00 2001
From: Sebastian Pipping <sebastian@pipping.org>
Date: Wed, 27 Mar 2024 23:25:39 +0100
Subject: [PATCH] Address -Wincompatible-function-pointer-types for Clang 17
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Also showed with -Werror=incompatible-pointer-types with GCC.

Bug: https://bugs.gentoo.org/927838

Symptom with GCC was:
> src/xml.c: In function ‘main’:
> src/xml.c:300:43: error: passing argument 2 of ‘xmlSetStructuredErrorFunc’ from incompatible pointer type [-Werror=incompatible-pointer-types]
>   300 |     xmlSetStructuredErrorFunc(&errorInfo, reportError);
>       |                                           ^~~~~~~~~~~
>       |                                           |
>       |                                           void (*)(void *, xmlError *) {aka void (*)(void *, struct _xmlError *)}
> In file included from /usr/include/libxml2/libxml/valid.h:15,
>                  from /usr/include/libxml2/libxml/parser.h:19,
>                  from /usr/include/libxml2/libxml/tree.h:17,
>                  from /usr/include/libxslt/xslt.h:13,
>                  from src/xml.c:37:
> /usr/include/libxml2/libxml/xmlerror.h:898:57: note: expected ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void *, const struct _xmlError *)’} but argument is of type ‘void (*)(void *, xmlError *)’ {aka ‘void (*)(void *, struct _xmlError *)’}
---
 src/xml.c     | 2 +-
 src/xmlstar.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xml.c b/src/xml.c
index cf47cc2..e6f19c1 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -104,7 +104,7 @@ void reportGenericError(void* ctx, const char * msg, ...) {
 /* by default all errors are reported */
 static ErrorInfo errorInfo = { NULL, NULL, VERBOSE, CONTINUE };
 
-void reportError(void *ptr, xmlErrorPtr error)
+void reportError(void *ptr, const xmlError *error)
 {
     ErrorInfo *errorInfo = (ErrorInfo*) ptr;
     assert(errorInfo);
diff --git a/src/xmlstar.h b/src/xmlstar.h
index 3e1eed3..e8d7177 100644
--- a/src/xmlstar.h
+++ b/src/xmlstar.h
@@ -32,7 +32,7 @@ typedef struct _errorInfo {
     ErrorStop stop;
 } ErrorInfo;
 
-void reportError(void *ptr, xmlErrorPtr error);
+void reportError(void *ptr, const xmlError *error);
 void suppressErrors(void);
 
 typedef struct _gOptions {
-- 
2.44.0