Skip to content

use const char * for string literals #41

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

Merged
merged 1 commit into from
Mar 18, 2022

Conversation

QuietMisdreavus
Copy link

When building swift-cmark as part of LLVM on Windows, the /Zc:strictStrings flag is added, which forbids converting string literals to a non-const char *. This PR updates a couple test functions in api_test to change their arguments to const char * when they're used with string literals. These functions were added to verify swift-cmark-specific functionality, so this fix is specific to our fork.

Copy link

@daniel-grumberg daniel-grumberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. I assume this wouldn't build if someone was trying to feed these regular char *.

@QuietMisdreavus
Copy link
Author

Right, all these const char * arguments are only being fed string literals, so it was an easy change to make.

@QuietMisdreavus QuietMisdreavus merged commit d1e2b26 into gfm Mar 18, 2022
@QuietMisdreavus QuietMisdreavus deleted the QuietMisdreavus/strict-strings branch March 18, 2022 16:02
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.

2 participants