Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around 'unreferenced function' warnings in NO_STL builds #620

Merged
merged 1 commit into from
Jul 6, 2024

Conversation

zeux
Copy link
Owner

@zeux zeux commented Jul 5, 2024

Normally, as_utf8_begin et al are used in STL functions but when STL is disabled, these are only used if the target platform lacks first class support for wchar_t FILE* APIs. With some warning levels we consequently can get warnings about these functions not being referenced; this affects MSVC (when using aggressive /Wall warning setup) and MinGW (when using -Wall which should work on gcc without warnings, hence the fix).

Not defining these in the first place is difficult because of the complexity of the selection logic for open_file_wide so for now just mark these as unused. The strange (void)& syntax is needed for MSVC to not trigger another warning...

The workaround is narrowly scoped to avoid unforeseen compatibility issues.

Fixes #619.

Normally, as_utf8_begin et al are used in STL functions but when STL is
disabled, these are only used if the target platform lacks first class
support for wchar_t FILE* APIs. With some warning levels we consequently
can get warnings about these functions not being referenced.

Not defining these in the first place is difficult because of the
complexity of the selection logic for open_file_wide so for now just
mark these as unused. The strange (void)& syntax is needed for MSVC to
not trigger another warning...

The workaround is narrowly scoped to avoid unforeseen compatibility issues.

Fixes #619.
@zeux
Copy link
Owner Author

zeux commented Jul 5, 2024

(one other way to work around this is to mark these inline instead of PUGI_IMPL_FN, which we can do if this workaround ends up being problematic)

@zeux zeux merged commit 2d42114 into master Jul 6, 2024
22 checks passed
@zeux zeux deleted the nostl-warnfix branch July 6, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warnings (C5245) when having PUGIXML_NO_STL and PUGIXML_API defined
1 participant