Skip to content

<string_view>: suppress warning about annotation 'NullTerminated' #3032

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 3 commits into from
Aug 18, 2022

Conversation

fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Aug 14, 2022

Fixes warning C6510: Invalid annotation: 'NullTerminated' property may only be used on buffers whose elements are of integral or pointer type: Function '{ctor}' _Param_(1).

https://gcc.godbolt.org/z/bPqs167he

Can we do something else and don't remove the annotation but fix the warning?
Found in one of LLVM tests.

@fsb4000 fsb4000 requested a review from a team as a code owner August 14, 2022 09:03
@frederick-vs-ja
Copy link
Contributor

Perhaps we can use requires to separate this ctor into two overloads, one of which only accepts raw pointers and is annotated with _In_z.
(I don't want to templatize this ctor, but it seems that templatization is a feasible way when requires is absent.)

@CaseyCarter CaseyCarter added the bug Something isn't working label Aug 14, 2022
Co-authored-by: Casey Carter <[email protected]>
@fsb4000 fsb4000 changed the title remove annotation 'NullTerminated' suppress warning about annotation 'NullTerminated' Aug 14, 2022
@fsb4000 fsb4000 changed the title suppress warning about annotation 'NullTerminated' <string_view>: suppress warning about annotation 'NullTerminated' Aug 14, 2022
Copy link
Contributor

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

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

Just a few extraneous std::-qualifications, I'll apply changes.

@StephanTLavavej StephanTLavavej self-assigned this Aug 18, 2022
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit ed0e3e5 into microsoft:main Aug 18, 2022
@StephanTLavavej
Copy link
Member

Thanks for nulling out this warning! ⚠️ ✅ 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants