Rename demangle to mat_demangle to avoid boost name conflict#1479
Open
bmehta001 wants to merge 1 commit into
Open
Rename demangle to mat_demangle to avoid boost name conflict#1479bmehta001 wants to merge 1 commit into
bmehta001 wants to merge 1 commit into
Conversation
typename.hpp defined both a global `demangle` function and a function-like macro `#define demangle(name) (name)`. The macro rewrites any `demangle` token in translation units that include this header -- including `boost::core::demangle` from boost/core/demangle.hpp -- producing a compile error when the SDK is integrated alongside boost. Rename the SDK helper (function + macro) to `mat_demangle` and update its sole external caller (print_backtrace in Utils.cpp). TYPENAME() is updated to match. No behavior change. Verified: a TU that includes typename.hpp and defines a namespaced `demangle` (as boost does) fails to compile with the old header and compiles cleanly after the rename (clang++ -std=c++17 -fsyntax-only). Files: lib/pal/typename.hpp, lib/utils/Utils.cpp Resolves microsoft#1048. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request renames the SDK’s global demangle helper (both the inline function and the fallback function-like macro) to mat_demangle to prevent macro expansion from clobbering boost::core::demangle in downstream integrations.
Changes:
- Renamed
demangle→mat_demangleinlib/pal/typename.hpp(function, macro, andTYPENAME()usage). - Updated the only in-repo external usage in
print_backtraceto callmat_demangle.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/pal/typename.hpp | Renames the demangling helper and updates TYPENAME() to use mat_demangle, avoiding Boost symbol breakage from a demangle(...) macro. |
| lib/utils/Utils.cpp | Updates print_backtrace to call the renamed helper (mat_demangle). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
Rename the SDK's
demanglehelper (both the function and the function-like macro) inlib/pal/typename.hpptomat_demangle, and update its sole external caller inlib/utils/Utils.cpp.Why
typename.hppdefined a global symbol nameddemanglein two forms:The fallback function-like macro
demangle(name)rewrites everydemangletoken in any translation unit that includes this header. When the SDK is integrated alongside boost, this clobbersboost::core::demangle(fromboost/core/demangle.hpp):This is exactly the build failure reported in #1048.
Fix
Rename the helper to the SDK-scoped
mat_demangle(function + macro), updateTYPENAME()to use it, and update the single caller (print_backtrace). No behavior change — only the identifier changes.The only repo-owned references to
demangleare the three lines intypename.hppand one line inUtils.cpp; all are updated.Validation
A translation unit that includes
typename.hpp, usesTYPENAME(int), and defines a namespaceddemangle(mimicking boost):error: expected unqualified-idat the namespaceddemangledefinition (the macro clobber).clang++ -std=c++17 -fsyntax-only, exit 0).Files
lib/pal/typename.hpplib/utils/Utils.cppResolves #1048.