Repository navigation
fix: mark every internal bool function nodiscard and check it - #276
Merged
Merged
Conversation
siracozmen01
commented
Nov 5, 2026
siracozmen01
left a comment
Contributor
Author
There was a problem hiding this comment.
Review at 69fd004: ready. Read, not run.
The family files match .github v0.0.54 byte for byte. I fetched maul/files/tools/check_nodiscard.py, maul/files/cmake/Testing.cmake and maul/files/docs/internals/maul-conventions.md at the v0.0.54 tag and compared each with this head. diff finds no difference in any of the three. Testing.cmake goes 144bbe4..68163e3, the v0.0.52 blob pair. Its C23 check reads the column-0 #define MUNI_NODISCARD [[nodiscard]] at include/maul-unicode/base.h:72 and :76.
The marks.
- The diff adds 57
MUNI_NODISCARDlines. Each replaces one removedbooldeclaration line, apart from the second line ofmuniCursorValid's wrapped parameters. - I read the shapes the family check has to parse:
static MUNI_ALWAYS_INLINE bool RulesValid(andLoad(match as the library's macros.- The parameter line
bool waiting)is neither a declaration nor a refusal. - The
static inlineheader helpers (muniCursorValid,muniNormalizerAdd,muniWriterFits,muniOverlaps,In,IsWideand the rest) are all marked.
overlap.handwriter.hnow includemaul-unicode/base.h, the only way they reach the macro.- The check fails closed on any shape it does not read. Both
check.shand CI's family checks step run it with its self-test, so a declaration it missed would fail CI rather than pass.
No (void) sites. A plain fix (no !) is right at 1.x: no result changes.
Merged
siracozmen01
pushed a commit
that referenced
this pull request
Nov 5, 2026
🤖 I have created a release *beep* *boop* --- ## [1.1.2](v1.1.1...v1.1.2) (2026-11-05) ### Fixed - Every internal function that returns `bool` now carries `MUNI_NODISCARD`, so a compiler warns where the library would drop one of their answers, and `tools/check_nodiscard.py` keeps new ones marked. No call dropped one, so nothing a caller sees changes: same API, same behavior. The header tests now also check that `MUNI_NODISCARD` is not empty in C23 ([#276](#276)). No results change: the Unicode data is still 18.0.0 and `MUNI_RESULTS_VERSION` stays 2, so stored normalized keys, skeletons and verdicts from 1.1.1 stay valid.
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.
Problem
MUNI_NODISCARDmarked every public function that returns a status, but no internal function returningbool. Many of those refuse something or give an answer the caller must act on:Load,RulesValid,muniCursorValid);muniWriterFitsandmuniNormalizerAdd;falseleaves an out value unset.A call that dropped one of these results went on past a refusal, and no compiler warned. Nothing kept a new
boolfunction from being added unmarked either. The organization's.githubv0.0.53 makes the family rule uniform and adds a check for it; this repository also still had the v0.0.51 copies ofcmake/Testing.cmakeanddocs/internals/maul-conventions.md(#273).Change
family_sync.py --writefrom.githubv0.0.54 (b52e9f7), the latest, which for this repository equals v0.0.53. It writestools/check_nodiscard.pyand the v0.0.52 and v0.0.53 changes tocmake/Testing.cmake(the C23 check thatMUNI_NODISCARDis not empty) anddocs/internals/maul-conventions.md. This takes in ci: sync the family files to v0.0.52 #274, which this pull request replaces.boolthat is declared in a header undersrc/, and everystaticone in a source file undersrc/, carriesMUNI_NODISCARD: 57 declarations in 26 files, plain answers and lookups as well as refusals. None is insrc/generated/.src/overlap.handsrc/writer.hreached no public header, so they now includemaul-unicode/base.hfor the macro.tools/modules.txtallows any public header.tools/check.shrunspython3 tools/check_nodiscard.py --self-testandpython3 tools/check_nodiscard.pyin its rules step, and CI's family checks step runs both too, since that step lists each check itself.The deliberate drops
None. With every
boolmarked, the linux-gcc-14 and linux-clang-20-asan builds (library, tools, samples, benchmarks and tests, with-Werror) report no dropped result, and the tree held no(void)cast on a call to any of these functions. The HarfBuzz adapter calls only the public API.Verification
python3 tools/check_nodiscard.pypasses, and its--self-testpasses. In a copy of the tree, with the mark removed frommuniWriterFitsit namessrc/writer.h:72and exits 1, and an indentedbooldeclaration added tosrc/overlap.his reported as one it does not read.family_sync.py --checkfrom v0.0.54: 0 differences.tools/check.sh changedpasses: the rules with the new check, format, clang-tidy in Release and Debug, and all 13 suites under linux-clang-20-asan.Closes #275
Closes #273