-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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/clang10 linux #12837
Fix/clang10 linux #12837
Conversation
@ignacionr this... seems like an unfortunate change. What warnings does clang throw after passing the vector as a span? Fwiw, this path has been tread before, by the standards committee, so they agree we're doing the right thing here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used docker[1] to get a copy of clang 10 and didn't see a motivation (i.e. compiles without warnings) for two of the changes; otherwise, looks great!
[1] https://solarianprogrammer.com/2017/12/14/clang-in-docker-container-cpp-17-development/
I was able to reproduce this only for a minute on the Visual Studio Code messages. At some point, the messages just disappeared. It may have been related to whatever version of compiler/standard library the IDE was using before re-configuring. I will remove the changes (since they proved unnecessary), as I agree they don't look appealing to read. They were as follows.
But I will keep those that generate warnings (unused fn, unused params). |
updating use of Span<> after clang-format two changes undone
5d78466
to
959f675
Compare
@strega-nil @ras0219 this seems ready now. Care to merge? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
updating use of Span<> after clang-format two changes undone
updating use of Span<> after clang-format two changes undone
Describe the pull request
What does your PR fix?
Fixes warnings treated as errors on Clang 10.0.0 Linux. Also one unused fn.
Which triplets are supported/not supported? Have you updated the CI baseline?
Does not apply (this is a fix for the tool).
Does your PR follow the maintainer guide?
Yes.
Additional notice (so to understand some of these changes)
I like the idea of Span<> being a view into contiguous memory (it basically avoids going through abstracted iterators).
When initializing them with vectors, we are making a claim that will not necessarily last: std::vector may need to re-allocate at some point, so it will all move elsewhere. But while within a fn called with a temporary object, it's fairly safe.
Clang is wiser than other compilers and won't let us just go ahead and use vectors for that reason. So I changed it to the address of the first element, and the count (totally equivalent, and the potential risks made explicit).
Of course, I may have completely misunderstood something here, so comments and clarifications are very welcome.
Compiler Messages