Prefer signed types, and remove -Wall -Wextra warnings#2723
Open
Prefer signed types, and remove -Wall -Wextra warnings#2723
Conversation
zcbenz
reviewed
Nov 2, 2025
| const Allocator& allocator = Allocator()) | ||
| : allocator_(allocator) { | ||
| if (init.size() > capacity()) { | ||
| if (static_cast<int>(init.size()) > capacity()) { |
Collaborator
There was a problem hiding this comment.
Should it use std:ssize to match the style of other code?
| // Get the value out of it: | ||
| auto s = x.item<float>(); | ||
| assert(s == 1.0); | ||
| (void)s; |
Collaborator
There was a problem hiding this comment.
C++17 has a [[maybe_unused]] for this purpose.
https://en.cppreference.com/w/cpp/language/attributes/maybe_unused.html
| @@ -443,18 +443,15 @@ class SmallVector { | |||
| private: | |||
| // Grows the backing store by a factor of two, and at least to {min_capacity}. | |||
| // TODO: Move to private after removing external code using this method. | |||
Collaborator
There was a problem hiding this comment.
Not related to this PR but since it is adjacent to your changes can you help delete this line? It is a finished TODO that I forgot to remove.
| VERSION ${MLX_PROJECT_VERSION}) | ||
|
|
||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") | ||
| add_compile_options(-Wall -Wextra) |
Collaborator
There was a problem hiding this comment.
This should be moved to the # ---- Lib ---- section below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
arrayclass prefersint64_tinstead ofsize_tSmallVectoris inherently small -- sizes are nowintChecklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes