TextReader: fix naming clash with libxml macro#74
Merged
kjellahl merged 1 commit intolibxmlplusplus:masterfrom Sep 16, 2025
Merged
TextReader: fix naming clash with libxml macro#74kjellahl merged 1 commit intolibxmlplusplus:masterfrom
kjellahl merged 1 commit intolibxmlplusplus:masterfrom
Conversation
In the macOS 26 SDK, xmlFree is defined as a macro for free. This causes
issues where a same-named variable is used. Renaming the variable to
should_free resolves the issue.
See:
$ grep -B4 -A2 -n "#define xmlFree(" "Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.sdk/usr/include/libxml/globals.h"
261-#if defined(LIBXML_HAS_DEPRECATED_MEMORY_ALLOCATION_FUNCTIONS)
262-#define xmlMalloc(size) malloc(size)
263-#define xmlMallocAtomic(size) malloc(size)
264-#define xmlRealloc(ptr, size) realloc((ptr), (size))
265:#define xmlFree(ptr) free(ptr)
266-#define xmlMemStrdup(str) strdup(str)
267-#endif
Fixes:
FAILED: [code=1] libxml++/libxml++-2.6.2.dylib.p/parsers_textreader.cc.o
clang++ -Ilibxml++/libxml++-2.6.2.dylib.p -I. -I.. -I/opt/homebrew/Cellar/[email protected]/2.66.8/include/glibmm-2.4 -I/opt/homebrew/Cellar/[email protected]/2.66.8/lib/glibmm-2.4/include -I/opt/homebrew/Cellar/glib/2.86.0/include -I/opt/homebrew/Cellar/glib/2.86.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.86.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.46/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/ffi -I/opt/homebrew/Cellar/libsigc++@2/2.10.8/include/sigc++-2.0 -I/opt/homebrew/Cellar/libsigc++@2/2.10.8/lib/sigc++-2.0/include -fdiagnostics-color=always -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wall -Winvalid-pch -std=c++11 -O3 -DLIBXMLPP_BUILD=1 -MD -MQ libxml++/libxml++-2.6.2.dylib.p/parsers_textreader.cc.o -MF libxml++/libxml++-2.6.2.dylib.p/parsers_textreader.cc.o.d -o libxml++/libxml++-2.6.2.dylib.p/parsers_textreader.cc.o -c ../libxml++/parsers/textreader.cc
../libxml++/parsers/textreader.cc:416:5: error: called object type 'bool' is not a function or function pointer
416 | xmlFree(value);
| ^~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/libxml/globals.h:265:26: note: expanded from macro 'xmlFree'
265 | #define xmlFree(ptr) free(ptr)
| ~~~~^
1 error generated.
Signed-off-by: Ruoyu Zhong <[email protected]>
kjellahl
pushed a commit
that referenced
this pull request
Sep 16, 2025
In the macOS 26 SDK, xmlFree is defined as a macro for free. This causes issues where a same-named variable is used. Renaming the variable to should_free resolves the issue. See pull request #74
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the macOS 26 SDK, xmlFree is defined as a macro for free. This causes issues where a same-named variable is used. Renaming the variable to should_free resolves the issue.
See:
Fixes: