Skip to content

Fix some clang++ warnings - #610

Merged
biojppm merged 4 commits into
biojppm:masterfrom
TedLyngmo:clang_warn
May 28, 2026
Merged

biojppm merged 4 commits into
biojppm:masterfrom
TedLyngmo:clang_warn

Conversation

@TedLyngmo

Copy link
Copy Markdown
Contributor

Compiled with -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic and fixed some low hanging fruits.

Comment thread src/c4/yml/tree.cpp Fixed
Comment thread src/c4/yml/tree.cpp Fixed
@TedLyngmo
TedLyngmo force-pushed the clang_warn branch 3 times, most recently from c9db1e5 to 8a4c528 Compare May 27, 2026 05:27
Comment thread src/c4/yml/node.hpp Resolved

@biojppm biojppm left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, it is really appreciated.

First, some context: -Weverything is not actually advised by clang.

There are a couple of changeset remarks/questions above. Other than these, there are a few others:

  • the initial diff had a rather large part fixing leading underscores in some symbols; subsequently they're not here. Why the revert?
  • Also, on this same subject, I think suppressing the warning as needed with file-wide push/pop is not just lower effort, but might actually be preferable. IMO there's really low risk of having these symbols clash with any other symbol.
  • what are the final compile flags that you're looking to suppress? I think adding these to the CI is in order, but I'm a bit confused as to what the flags are based on the PR description and commit error messages.
  • related - were there no warnings coming from c4core code? I would really expect that to be the case, but there's no PR there.

Comment thread src/c4/yml/node.hpp Resolved
Comment thread src/c4/yml/node.hpp Resolved
Comment thread src/c4/yml/event_handler_tree.hpp Resolved
@TedLyngmo

TedLyngmo commented May 27, 2026 •

Copy link
Copy Markdown
Contributor Author

First, some context: -Weverything is not actually advised by clang. But I'm really inclined

Yes, using it means you have no control over the warnings that will be enabled. Every new version of clang++ will come with new warnings. I use it as a means to enable everything in the current version of clang++ that I have - and then remove it once I've fixed everything that popped up and looked interesting enough :) Shipping a library with -Weverything enabled is not a good idea.

There are a couple of changeset remarks/questions above. Other than these, there are a few others:

  • the initial diff had a rather large part fixing leading underscores in some symbols; subsequently they're not here. Why the revert?

I misunderstood the large impact and concentrated on just being able to compile the library clean. As it happens, CI showed that there is a lot more code that depends on those identifiers :-) I removed that commit from the set and was thinking of addressing that separately now that I have a better picture of how they are used.

  • Also, on this same subject, I think suppressing the warning as needed with file-wide push/pop is not just lower effort, but might actually be preferable. IMO there's really low risk of having these symbols clash with any other symbol.

True, but there are organizations that are sticklers when it comes to undefined behavior and they'd probably reject the library when noticing these identifiers. I have seen header guards and other reserved identifiers defined in libraries collide with the implementation's own identifiers after upgrading the toolchain. Not a nice surprise.

  • what are the final compile flags that you're looking to suppress? I think adding these to the CI is in order, but I'm a bit confused as to what the flags are based on the PR description and commit error messages.

I wasn't thinking of suppressing any. Possibly adding an explicit set of warnings after having fixed those specific issues.

  • related - were there no warnings coming from c4core code? I would really expect that to be the case, but there's no PR there.

Oh, there were tons. Since it's in a submodule, I left those untouched. It'd probably be a good idea to go through those separately.

@biojppm

biojppm commented May 27, 2026

Copy link
Copy Markdown
Owner

what are the final compile flags that you're looking to suppress? I think adding these to the CI is in order, but I'm a bit confused as to what the flags are based on the PR description and commit error messages.

I wasn't thinking of suppressing any. Possibly adding an explicit set of warnings after having fixed those specific issues.

My bad -- I meant fix instead of suppress. The question still stands. What are those warnings? The PR description says one thing but individual commits show another.

Comment thread src/c4/yml/parse_engine.def.hpp Resolved
@TedLyngmo

Copy link
Copy Markdown
Contributor Author

what are the final compile flags that you're looking to suppress? I think adding these to the CI is in order, but I'm a bit confused as to what the flags are based on the PR description and commit error messages.

I wasn't thinking of suppressing any. Possibly adding an explicit set of warnings after having fixed those specific issues.

My bad -- I meant fix instead of suppress. The question still stands. What are those warnings? The PR description says one thing but individual commits show another.

Each commit is supposed to only fix the warning(s) mentioned in the four individual commit messages. For the PR, it could say "Fix clang++ warnings: -Wmissing-noreturn, -Wextra-semi, -Wextra-semi-stmt, -Wimplicit-fallthrough and -Wnrvo" but that'd require updating the PR message if I pull anything out of the set (or add anything to it).

@biojppm

biojppm commented May 27, 2026

Copy link
Copy Markdown
Owner

Looking at the failing windows tests : the newly-added C4_NORETURN to the tree handler events now causes a warning C4702: unreachable code on MSVC.

This is triggered from an engine test that checks for an error (ie requires an error) in the specified sequence of event handler calls when using the tree handler. That test must remain.

IMO the way to tackle this is to work around it by suppressing that warning it in the offending test source code: adding C4_SUPPRESS_WARNING_MSVC_WITH_PUSH(4702) and corresponding _POP at the top/bottom of the files.

AFAICT these are the files where that would be needed:

  • test/test_engine_3_map_block_2.cpp
  • test/test_engine_3_map_flow_1.cpp
  • test/test_engine_4_anchor.cpp
  • test/test_engine_5_tag_1.cpp
  • test/test_engine_6_qmrk_1.cpp
  • test/test_engine_6_qmrk_2.cpp
  • test/test_engine_6_qmrk_3.cpp
  • test/test_engine_6_qmrk_4.cpp
  • test/test_engine_7_seqimap.cpp

HTH.

@biojppm

biojppm commented May 27, 2026 •

Copy link
Copy Markdown
Owner

The failure in the coverage workflows is unrelated with this PR, and can be ignored. It's a token access problem that must be fixed elsewhere.

The install singleheader failure is a flaky test ; also unrelated.

TedLyngmo added 4 commits May 27, 2026 20:45
This only fixes one simple case where named return value optimization
was prevented. The more complicated cases are still left.

Signed-off-by: Ted Lyngmo <[email protected]>
@biojppm

biojppm commented May 27, 2026

Copy link
Copy Markdown
Owner

I pushed a bunch of branches before approving this run. It's going to take a while.

@biojppm
biojppm merged commit d8be67a into biojppm:master May 28, 2026
290 of 298 checks passed
@biojppm

biojppm commented May 28, 2026

Copy link
Copy Markdown
Owner

Thanks!

Hancock33 added a commit to Hancock33/batocera.piboy that referenced this pull request Jun 7, 2026
-------------------------------------------------------------------------------------
azahar.mk 379649dbceaffc414311fb308d8427461683e640 # Version: Commits on Jun 05, 2026
-------------------------------------------------------------------------------------
cmake: Fix MoltenVK fetch order/library conflicts (#2183)

* [cmake] Fix MoltenVK fetch order/library conflicts

Rather than dealing with `find_library` shenanigans, just set the

library path directly (when using bundled MoltenVK). System MoltenVK

solely uses `find_library`.

Avoids cache nonsense that can cause system/bundled versions to get

mixed up, and overall makes the system/bundled mvk handling a lot more

consistent

```

cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=ON

-- Using MoltenVK at /opt/homebrew/lib/libMoltenVK.dylib.

cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=OFF

-- Using MoltenVK at /Users/crueter/code/azahar/build/externals/MoltenVK/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib.

cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=ON

-- Using MoltenVK at /opt/homebrew/lib/libMoltenVK.dylib.

```

Signed-off-by: crueter <[email protected]>

* remove old comment

Signed-off-by: crueter <[email protected]>

* Cleanup

---------

Signed-off-by: crueter <[email protected]>

Co-authored-by: OpenSauce04 <[email protected]>,

------------------------------------------------------------------------------------------
duckstation.mk 02a41fa0637df757519ba1e0da646de61f2fceab # Version: Commits on Jun 05, 2026
------------------------------------------------------------------------------------------
GameDB: Add metadata to `King's Field 3 - Pilot Style` (#3749),

-----------------------------------------------------------------------------------
eden.mk fb6330645a06a3e0d9e6fa42a4e6f875d9ee065e # Version: Commits on Jun 05, 2026
-----------------------------------------------------------------------------------
[file_sys] Avoid crash on empty NACP language entries (#4062)

--------------------------------------------------------------------------------------
flycast.mk 619082fe46577b2d99a20f2385c6d7b8dd68aed8 # Version: Commits on Jun 05, 2026
--------------------------------------------------------------------------------------
android: back to target sdk 35 (android 15)

Until we figure out this fucking android 16 Back key mess.

Revert 7fc81607e38de09a4be7c4b173d7adf834305826,

-----------------------------------------------------------------------------------
play.mk 919f73a919a756859da1451145d89000d96540b6 # Version: Commits on Jun 01, 2026
-----------------------------------------------------------------------------------
Only split block on T/D bits if we're not on a branch.

Fixes missing poly regression in Wild Arms: Alter Code F.,

-------------------------------------------------------------------------------------
ppsspp.mk 84677d4cb582aebb36c6541a0f1bad66a36d6647 # Version: Commits on Jun 05, 2026
-------------------------------------------------------------------------------------
Merge pull request #21788 from hrydgard/more-work

GTA sprite fix: Detect sprites, clip them slightly to avoid filtering artifacts,

------------------------------------------------------------------------------------
rpcs3.mk 8112c7cc19c3a4d6ddef10572ce9f42bd928bfd7 # Version: Commits on Jun 04, 2026
------------------------------------------------------------------------------------
Initialize rtmidi async

On my system this opening the settings takes 10 seconds on a cold boot.

Letting it initialize async during boot reduces this delay drastically.,

--------------------------------------------------------------------------------------
tsugaru.mk 177bc1a509ce8577f59abc36fdaa76a2d47814ea # Version: Commits on Jun 04, 2026
--------------------------------------------------------------------------------------
Fixed.  On writing 01h to I/O 0020h (Hardware reset), only CPU was reset.,

-------------------------------------------------------------------------------------------
xenia-canary.mk 99fd19d02598e45121a665053c56fa46b2e06f09 # Version: Commits on Jun 05, 2026
-------------------------------------------------------------------------------------------
[XAM] Limit XContentQueryVolumeDeviceType to XContent packages

- Changed mount path for XContent packages from Cdrom to Package_0

Normally it should generate specific value instead of 0, but for now 0 is enough,

-----------------------------------------------------------------------------------
ymir.mk b4d9fb8d7c91421d49e9cafe7b749e0cd9920324 # Version: Commits on Jun 05, 2026
-----------------------------------------------------------------------------------
Merge pull request #892 from mmkzer0/feat/headless-dbg

feat(headless): portable env, cascading dbg cfg parser and tests,

-------------------------------------------------------------------------------------
ikemen.mk 843f7327efda98f6d47edbf38f45420b88cee3c8 # Version: Commits on Jun 05, 2026
-------------------------------------------------------------------------------------
style: fix code style issues with gofmt,

---------------------------------------------------------------
ruffle.mk nightly-2026-06-05 # Version: Commits on Jun 05, 2026
---------------------------------------------------------------
## What's Changed

* core: Do not dispatch clip events not present in allEventFlags by @kjarosh in ruffle-rs/ruffle#23869

* Fix panic on writeback from empty CPU dirty region (prevalent in Earn to Die) by @n-raine in ruffle-rs/ruffle#23898

* avm2: Implement most of the version gating for `flash.events` classes by @Lord-McSweeney in ruffle-rs/ruffle#23836

* avm2: More minor crossbridge performance improvements by @Lord-McSweeney in ruffle-rs/ruffle#23849

* tests: add `known_failure` support to audio assertions by @moulins in ruffle-rs/ruffle#23861

* avm2: Fix setProgramConstantsFromByteArray implementation by @SuchAFuriousDeath in ruffle-rs/ruffle#23901

**Full Changelog**: ruffle-rs/ruffle@nightly-2026-06-04...nightly-2026-06-05,

-----------------------------------------------------------------------------------------
rpi-eeprom.mk 114e49b9088cda026b35e5d44f7248ddedc309b2 # Version: Commits on Jun 04, 2026
-----------------------------------------------------------------------------------------
rpi-sign-bootcode: debug: Extract signature block fields

For test/debug and options to extract and parse the signature

blocks.

Usage:

Take the signed pieeprom.bin from secure-boot-recovery5

rpi-eeprom-config -x pieeprom.bin

rpi-sign-bootcode -c 2712 -e bootcode.bin,

-----------------------------------------------------
ecm.mk v6.27.0-rc1 # Version: Commits on Jun 02, 2026
-----------------------------------------------------
Set INTERFACE_LINK_LIBRARIES if the found library is a static library,

-------------------------------------------------------
rapidyaml.mk v0.14.0 # Version: Commits on Jun 05, 2026
-------------------------------------------------------
- [PR#607](biojppm/rapidyaml#607): add file utilities:

  - `file_put_contents()`

  - `file_get_contents()`

  - `stdin_get_contents()`

- [PR#609](biojppm/rapidyaml#609): fix misbuild in gcc 16.

- [PR#610](biojppm/rapidyaml#610): fix clang warnings: `-Weverything`. Thanks @TedLyngmo !

- [PR#613](biojppm/rapidyaml#613): fix [#612](biojppm/rapidyaml#612): parse error on whitespace-only after block scalar indicators `|` or `>`:

  ```yaml

  space after: >\\space

  tag after: >\\t

  ```

- [PR#614](biojppm/rapidyaml#614) improve base64 serialization facilities:

  ```c++

  std::string decoded;

  tree[

ode\] >> fmt::base64(decoded); // now possible

  // also can now obtain the size explicitly:

  substr buf = ...;

  size_t required = 0;

  tree[

ode\] >> fmt::base64(buf, &required);

  ```

- Update c4core to [0.4.0](https://github.com/biojppm/c4core/releases/tag/v0.4.0).

### Thanks

- @TedLyngmo

,

------------------------------------------------------------------------------------------
devilutionx.mk bd4ed470a82434ee1ca0e4e6c7092e414795a63e # Version: Commits on Jun 03, 2026
------------------------------------------------------------------------------------------
Mark stash as dirty after identify/repair/recharge/oil,

------------------------------------------------------
fastfetch.mk 2.64.2 # Version: Commits on Jun 05, 2026
------------------------------------------------------
Merge pull request #2375 from fastfetch-cli/dev

Release v2.64.2,

----------------------------------------------------------------------------------------
retroarch.mk 1d5b6e0d4691682555993e9692d2909ac450cbd7 # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------
Fetch translations from Crowdin,

------------------------------------------------------------------------------------------
openbor7530.mk 41fb897d4e886542173ddd6d33f3c5245e4b628d # Version: Commits on Jun 05, 2026
------------------------------------------------------------------------------------------
Add 64-bit integer literal support to script.

Consume full integer suffixes in the preprocessor lexer and parse integer constants through strtoull instead of atoi/htoi. Select VT_INTEGER, VT_INTEGER64, or VT_UINTEGER64 based on suffix and range, including signed minimum edge cases and large hexadecimal bitmasks.

Update htoi as a legacy int-width helper with suffix validation and defined overflow behavior.

Next step: Handling calculations.,

---------------------------------------------------------------------------------------
vpinball.mk 452646bbe8ee561172270583db78d96fcca0089a # Version: Commits on Jun 05, 2026
---------------------------------------------------------------------------------------
optimize SRGB565 to SRGBA path,

----------------------------------------------------------------------------------------
doomretro.mk 120ef7fc714e5fc416b0c8a5b2fac779ae18aa8f # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------
Several fixes reported by Cppcheck,

------------------------------------------------------------------------------------------
xash3d-fwgs.mk 4cd6d25ee680dfc128d2817625f5e3db228248d4 # Version: Commits on Jun 05, 2026
------------------------------------------------------------------------------------------
engine: common: account for header size when sending first file fragment (which contains filename + compressor on goldsrc),

----------------------------------------------------------------------------------------------
libretro-azahar.mk 379649dbceaffc414311fb308d8427461683e640 # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------------
cmake: Fix MoltenVK fetch order/library conflicts (#2183)

* [cmake] Fix MoltenVK fetch order/library conflicts

Rather than dealing with `find_library` shenanigans, just set the

library path directly (when using bundled MoltenVK). System MoltenVK

solely uses `find_library`.

Avoids cache nonsense that can cause system/bundled versions to get

mixed up, and overall makes the system/bundled mvk handling a lot more

consistent

```

cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=ON

-- Using MoltenVK at /opt/homebrew/lib/libMoltenVK.dylib.

cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=OFF

-- Using MoltenVK at /Users/crueter/code/azahar/build/externals/MoltenVK/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib.

cmake -S . -B build -DUSE_SYSTEM_MOLTENVK=ON

-- Using MoltenVK at /opt/homebrew/lib/libMoltenVK.dylib.

```

Signed-off-by: crueter <[email protected]>

* remove old comment

Signed-off-by: crueter <[email protected]>

* Cleanup

---------

Signed-off-by: crueter <[email protected]>

Co-authored-by: OpenSauce04 <[email protected]>,

----------------------------------------------------------------------------------------------
libretro-brimir.mk 50b4083ef06a17d453ddc7a5a1caa853d80697be # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------------
gitignore: add codewhale directory,

--------------------------------------------------------------------------------------------
libretro-dice.mk d9cc6c4867453cab45f397cd17a217d988de4864 # Version: Commits on Jun 05, 2026
--------------------------------------------------------------------------------------------
Fetch translations & Recreate libretro_core_options_intl.h,

----------------------------------------------------------------------------------------------
libretro-ecwolf.mk af987aaa88284a3184413810eb0dd11b070a20de # Version: Commits on Jun 04, 2026
----------------------------------------------------------------------------------------------
thingdef: declare backported actions as native (fixes halo lighting)

The backported DECORATE actions had C++ implementations registered via

ACTION_FUNCTION, but no matching 'action native' declarations in the

base Actor class (actors/native.txt). FindFunction only resolves actions

that were declared native on a class (or its parents), so for these

functions it returned NULL: the parser silently dropped the action call,

leaving the frame's action pointer null. A_EnableHaloLight therefore

never ran, haloLightMask stayed 0, no halos were ever activated, and the

LZWolf halo lighting never rendered despite the halolight properties

parsing correctly.

Declare the seven backported actions in the base Actor native block:

A_EnableHaloLight, A_EnableZoneLight, A_MirrorPosition, A_ResetPosition,

A_SelectWeapon, A_SetHealth, A_StartMusic. Signatures and defaults match

the ACTION_PARAM usage in each implementation.

native.txt lives in the embedded base data (ecwolf.pk3), so regenerate

ecwolf_pk3_data.c from the rebuilt pk3 (only actors/native.txt changed;

all other entries byte-identical).

Verified with a headless libretro harness driving the real core into the

HD mod's first map: the lamp actors go from haloLightMask=0 / 0 active

halos to all 38 masked with 240 active halo instances populated each

frame, so the glow now renders.,

-----------------------------------------------------------------------------------------------
libretro-flycast.mk 619082fe46577b2d99a20f2385c6d7b8dd68aed8 # Version: Commits on Jun 05, 2026
-----------------------------------------------------------------------------------------------
android: back to target sdk 35 (android 15)

Until we figure out this fucking android 16 Back key mess.

Revert 7fc81607e38de09a4be7c4b173d7adf834305826,

------------------------------------------------------------------------------------------------
libretro-gambatte.mk 6716e6ee39c2abd3ea325f66fb26e7f866f4c5dc # Version: Commits on Jun 05, 2026
------------------------------------------------------------------------------------------------
Fetch translations & Recreate libretro_core_options_intl.h,

----------------------------------------------------------------------------------------------------
libretro-parallel-n64.mk 35ad6a20a7bc12976e0297307b9b4e76ac643ee4 # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------------------
rom_luts: fix the in-game save freeze in Super Mario 64 60fps V2

Selecting 'SAVE & CONTINUE' after collecting a star froze the hack on

every CPU core: video stopped, input died, audio kept playing.  The

save thread wrote its EEPROM status-probe block to the PIF (the lone

SI write DMA in the whole trace) and then slept in osRecvMesg forever,

while the rest of the OS - audio, VI, the per-frame controller polls -

carried on normally.

The hack's 60fps controller polling bypasses libultra's SI access

arbitration: read-only PIF polls keep flowing every frame even while

another thread has an EEPROM transaction in flight, which stock

osContStartReadData/__osSiGetAccess serialization would never allow.

With g_delay_si's delayed completion there is a window between the

EEPROM write DMA and its SI interrupt in which a poll can interleave,

and the save thread's completion event is lost to the racing poller.

Real hardware resolves the same race in the game's favor.

Deliver SI DMA completion immediately for this title, the same

lut_delaysi treatment the Banjo games already get, which closes the

window; the hack's CRC also joins the older 60fps hack in lut_ee4k.

Verified from the savestate at the save prompt: the save completes and

the game proceeds to the post-star dialog on ari64, hacktarux and the

pure interpreter, the hack still boots from power-on to the file

select screen, and vanilla SM64's 240-frame RAM-hash trace is

unchanged.,

----------------------------------------------------------------------------------------------
libretro-ppsspp.mk 9506f5c4700352408c8728f7800a534e13321b0e # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------------
Merge pull request #21791 from hrydgard/compat-info

Add a debug window to check active compat flags,

----------------------------------------------------------------------------------------------
libretro-prboom.mk 88cdd7787f6af75776090a2ff2fc03f5c5b66af9 # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------------
heretic: per-sound concurrent channel cap

Vanilla heretic limits how many instances of one sound type may

play at once -- most sounds to two, ambients to one -- via the

sfxinfo numchannels field, evicting the least important running

instance at the cap or dropping the new sound when every running

instance outranks it (heretic priorities ascend).  The fork's

reduced sfxinfo dropped the field entirely, so a burst of one

sound, a crowd of gargoyles or a volley of wand hits, stacked

without limit where vanilla collapses it to the cap.

sfxinfo_t regains numchannels as a trailing member, so the doom and

hexen tables' initializers leave it zero, meaning uncapped, and

nothing else changes for those games.  The heretic table's values

are ported per sound from dsda-doom by name: 108 sounds cap at two,

16 at one, the rest unlimited.  S_StartSoundAtVolume applies

vanilla's check before channel allocation, comparing raw table

priorities among instances of the same sound, and each claimed

engine channel now records its priority for that comparison.

Verified in a headless harness on retail HERETIC.WAD: a burst of

six simultaneous gold-wand hits from six distinct origins allocates

two channels and logs four cap evictions, holding the vanilla

steady state of two concurrent instances.  2500-frame chaos-input

soaks of both raven games complete under valgrind with zero

errors.,

----------------------------------------------------------------------------------------------
libretro-stella.mk 3dc82887963087dccb69ec77ec91d025879176d0 # Version: Commits on Jun 05, 2026
----------------------------------------------------------------------------------------------
Tentative fix for #548,

---------------------------------------------------------------------------------------------
libretro-wasm4.mk 5b05a016c19a94047294cc927ffff0df2d68e1fe # Version: Commits on Jun 05, 2026
---------------------------------------------------------------------------------------------
Merge pull request #865 from yamt/toywasm-75

bump toywasm to v76,
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.

3 participants