Conversation
… tests
Replace size_t{N} with NU in test assertions for clarity. Update
CircularBuffer to use size_t for capacity and index types. Use
unsigned int instead of size_t for string substring counts.
Contributor
|
size_t is for object sizes and memory offsets; test/check counts are plain unsigned integers.
int is only guaranteed 16 bits; __LINE__ can reach INT_MAX (2147483647), which requires 32 bits. int_least32_t is the smallest signed type guaranteed to hold any valid line number.
- Update get_line_number(), get_failure_line_number(), and get_test_line_number() return types from int to int_least32_t - Fix int /*line_number*/ and int line parameter types missed by the earlier sed pass - Use PRIdLEAST32 from <inttypes.h> in printf-style format strings instead of %d, which is only correct when int is 32 bits
repeat_ and shuffle_seed_ changed from size_t to unsigned int. The repeat_ parse sites were still using strtol (signed); switch them to strtoul to match the unsigned type and the existing shuffle_seed_ parsing. strtol had no remaining call sites, so remove the declaration, implementation, and tests.
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.
Description
Replace
size_twith semantically appropriate integer types throughout the framework:size_t→int(prior PR) →int_least32_t.size_tis for object sizes/memory offsets.intis the type of__LINE__, but is only guaranteed 16 bits —__LINE__can reachINT_MAX(2147483647), requiring 32 bits.int_least32_tis the smallest signed type guaranteed to hold any valid line number.size_t→unsigned int. These are plain counts, not memory quantities.StringCollection:size_t→unsigned int.CircularBufferexample:int→size_tfor capacity and index fields, which are genuine sizes/offsets into an allocated buffer.Adds
#include <stdint.h>to public headers that now exposeint_least32_t.Related Issues
Fixes # (issue number)
Type of Change
Manual Verification (Optional)
If you have verified this change on hardware or a simulator not covered by CI (e.g., a specific ARM target), please describe it here:
Checklist
docs/for any user-facing changes.mu::tinynamespace,INCLUDED_MU_TINY_guards,mutiny_C-prefix)..hand.c.cpp) is required for parity.CONTRIBUTING.mdfile to ensure compliance with architectural guidelines.