Skip to content

Fixes a warning when building btree with cmake - #19644

Open
hoedur wants to merge 1 commit into
micropython:masterfrom
tonberry-pico:fix/cmake-suppress-btree-old-style-definition
Open

Fixes a warning when building btree with cmake#19644
hoedur wants to merge 1 commit into
micropython:masterfrom
tonberry-pico:fix/cmake-suppress-btree-old-style-definition

Conversation

@hoedur

@hoedur hoedur commented Aug 20, 2026

Copy link
Copy Markdown

The extmod.mk suppresses some more warnings. Those ones are not applied since they do not pop up with gcc 16.2.0.

Summary

Fixes #19643

Testing

Building RP_PICO_W with this fix does no longer yield warnings about old-style function definitions.

Generative AI

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

@agatti

agatti commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR!

While you're at it, you may also want to add -Wno-deprecated-non-prototype to also make life easier for some versions of Clang as well, see

CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter
CFLAGS += -Wno-deprecated-non-prototype

BTree's codebase is still clinging onto old standards and newer compilers tend to like that kind of stuff less and less as time goes on (there's also a PR for enabling compilation with MUSL, but that's still in the review queue).

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.55%. Comparing base (1c3c201) to head (7193279).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19644      +/-   ##
==========================================
- Coverage   98.58%   98.55%   -0.04%     
==========================================
  Files         182      182              
  Lines       23322    23322              
  Branches        5        5              
==========================================
- Hits        22993    22986       -7     
- Misses        328      335       +7     
  Partials        1        1              
Flag Coverage Δ
unix-coverage-32bit 98.56% <ø> (-0.04%) ⬇️
unix-coverage-64bit 98.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Code size report:

Reference:  extmod: Add USB Network (NCM) driver implementation. [1c3c201]
Comparison: extmod/extmod.cmake: Fixes a warning when building btree with cmake. [merge of 7193279]
  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

@hoedur

hoedur commented Aug 21, 2026

Copy link
Copy Markdown
Author

Then it would be probably better to use the exact same flags as we do in extmod/extmod.mk:
https://github.com/micropython/micropython/blob/master/extmod/extmod.mk#L449

Then both .cmake and .mk would be consistent, and the suppressions are consistent with the ones from micropython/examples/natmod/btree/Makefile.

Agree?

@agatti

agatti commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

That makes sense, feel free to update the PR (keeping it a single commit if possible).

With gcc 16.2.0, warnings about old-style function definitions popped
up when building with cmake. This fix suppresses these warnings for gcc,
and reportedly also helps with certain versions of clang as well. See
also micropython#19644.

Signed-off-by: Stefan Kratochwil <Kratochwil-LA@gmx.de>
@hoedur
hoedur force-pushed the fix/cmake-suppress-btree-old-style-definition branch from 53883f4 to 7193279 Compare August 21, 2026 12:53
@hoedur

hoedur commented Aug 21, 2026

Copy link
Copy Markdown
Author

Done. Please double-check with your clang setup if possible, I only verified the gcc build.

We got a failed test for qemu_arm (thread/stress_heap.py), currently trying to reproduce this locally.
We also lost 0.04% of coverage somewhere along the way?!

@hoedur

hoedur commented Aug 21, 2026

Copy link
Copy Markdown
Author

I am a bit time constrained right now, but as far as I can see the qemu_arm build does not even use cmake. Is this maybe a flaky test @agatti ?

@agatti

agatti commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I'd say the changes look good.

For the rest, coverage check is obviously mistaken here (that happens sometimes) and that specific test for qemu_arm has been flaky for some time. There's a PR to skip the AES stress test on QEMU-based jobs, hopefully will be up for merging in v1.30.

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extmod Relates to extmod/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Building with cmake and MICROPY_PY_BTREE=1 yields warnings about old-style function definitions

3 participants