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

Fix Xcode 14 sprintf deprecation warning #530

Merged
merged 3 commits into from
Nov 6, 2022
Merged

Fix Xcode 14 sprintf deprecation warning #530

merged 3 commits into from
Nov 6, 2022

Conversation

zeux
Copy link
Owner

@zeux zeux commented Nov 6, 2022

We use snprintf when stdc is set to C++11, however in C++98 mode we can't use variadic macros, and Xcode 14 complains about the use of sprintf.

It should be safe however to use variadic macros on any remotely recent version of clang on Apple, unless -pedantic is defined which warns against the use of variadic macros in C++98 mode...

This change fixes the problem for the builds that don't specify -pedantic, which is a problem for another day.

We use snprintf when stdc is set to C++11, however in C++98 mode we can't use variadic macros,
and Xcode 14 complains about the use of sprintf.

It should be safe however to use variadic macros on any remotely recent version of clang on Apple,
unless -pedantic is defined which warns against the use of variadic macros in C++98 mode...

This change fixes the problem for the builds that don't specify -pedantic, which is a problem for
another day.
@zeux
Copy link
Owner Author

zeux commented Nov 6, 2022

I guess technically PUGI__SNPRINTF is only ever used with 4 arguments so we could use a 4-arg version for Xcode 14+ in C++98 mode to work around the problems with -pedantic... It's fragile wrt future changes but it's unlikely that we'll expand the set of calls to snprintf.

@zeux zeux merged commit cb217f5 into master Nov 6, 2022
@zeux zeux deleted the snprintf branch November 6, 2022 23:09
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.

None yet

1 participant