[clang] f9e2e85 - [Clang] Use const pointer to eliminate warning with libxml 2.12.0 (#76719)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 21 01:34:34 PST 2024
Author: FantasqueX
Date: 2024-01-21T10:34:29+01:00
New Revision: f9e2e85b07ee2c19bbef8fda50b3f664d6f5193e
URL: https://github.com/llvm/llvm-project/commit/f9e2e85b07ee2c19bbef8fda50b3f664d6f5193e
DIFF: https://github.com/llvm/llvm-project/commit/f9e2e85b07ee2c19bbef8fda50b3f664d6f5193e.diff
LOG: [Clang] Use const pointer to eliminate warning with libxml 2.12.0 (#76719)
Currently, if `CLANG_HAVE_LIBXML` is defined, and the version of libxml2
is above 2.12.0, there will be two warnings when building clang.
warning: initializing 'xmlErrorPtr' (aka 'struct _xmlError *') with an
expression of type 'const xmlError *' (aka 'const struct _xmlError *')
discards qualifiers
Since this commit
https://gitlab.gnome.org/GNOME/libxml2/-/commit/45470611b047db78106dcb2fdbd4164163c15ab7,
libxml2 makes cmlGetLastError return a const error. This patch follows
libxml2. Making the result a const pointer should be compatible with
versions before 2.12.0.
Tested on ArchLinux with libxml2 2.12.3 installed.
Added:
Modified:
clang/tools/c-index-test/c-index-test.c
Removed:
################################################################################
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 25235eb7f06d6b..21619888cfa5f3 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -707,7 +707,7 @@ static void ValidateCommentXML(const char *Str, const char *CommentSchemaFile) {
Doc = xmlParseDoc((const xmlChar *) Str);
if (!Doc) {
- xmlErrorPtr Error = xmlGetLastError();
+ const xmlError *Error = xmlGetLastError();
printf(" CommentXMLInvalid [not well-formed XML: %s]", Error->message);
return;
}
@@ -717,7 +717,7 @@ static void ValidateCommentXML(const char *Str, const char *CommentSchemaFile) {
if (!status)
printf(" CommentXMLValid");
else if (status > 0) {
- xmlErrorPtr Error = xmlGetLastError();
+ const xmlError *Error = xmlGetLastError();
printf(" CommentXMLInvalid [not valid XML: %s]", Error->message);
} else
printf(" libXMLError");
More information about the cfe-commits
mailing list