Skip to content

Two format-string fixes.#19200

Open
jepler wants to merge 2 commits into
micropython:masterfrom
jepler:unix-coverage-size-fmt
Open

Two format-string fixes.#19200
jepler wants to merge 2 commits into
micropython:masterfrom
jepler:unix-coverage-size-fmt

Conversation

@jepler
Copy link
Copy Markdown
Contributor

@jepler jepler commented May 7, 2026

Summary

In a build for #17556, a new diagnostic occurred:

coverage.c: In function ‘extra_coverage’:
coverage.c:650:9: error: argument 3: Format ‘%d’ requires a ‘int’ or ‘unsigned int’ (32 bits), not ‘long unsigned int’ [size 64] [-Werror=format=]
  650 |         mp_printf(&mp_plat_print, "mp_obj_list_optional_arg new list len %d\n", as_ptr->len);

The preprocessor macro SIZE_FMT exists specifically for formatting objects of type size_t, use it.

Another diagnostic in machine_can.c was fixed through use of INT_FMT.

Testing

I built locally. The same change is at the top of #17556 and it will be CI tested there using the format string checker.

Generative AI

I did not use generative AI tools when creating this PR.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Code size report:

Reference:  py/emitinlinerv32: Fix UBsan diagnostics for left-shift of mp_int_t. [8ecd995]
Comparison: machine_can: Use INT_FMT. [merge of 3f837c3]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.47%. Comparing base (e496000) to head (3f837c3).
⚠️ Report is 26 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19200   +/-   ##
=======================================
  Coverage   98.47%   98.47%           
=======================================
  Files         176      176           
  Lines       22831    22831           
=======================================
  Hits        22483    22483           
  Misses        348      348           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jepler jepler changed the title unix: Use SIZE_FMT. Two format-string fixes. May 8, 2026
Comment thread extmod/machine_can.c Outdated
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
@jepler jepler force-pushed the unix-coverage-size-fmt branch from 570b903 to 3f837c3 Compare May 10, 2026 16:27
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