Repository navigation
fix: make MUNI_NODISCARD the attribute under GCC 14's C23 too - #271
Merged
Merged
Conversation
siracozmen01
commented
Nov 4, 2026
siracozmen01
left a comment
Contributor
Author
There was a problem hiding this comment.
Review at a9a85fd: ready. I read the change and did not run it. CI is pending.
The block in include/maul-unicode/base.h matches maul-locale's include/maul-locale/base.h at c346644 byte for byte apart from the prefix:
- the comment's six lines;
- the C++ branch;
- the
#elifwith its continuation and the backslash at the same column; - the nested
#if __has_c_attribute(nodiscard)and both#else/#endifpairs.
They are the same line for line, with MUNI_ in place of MLOC_. My review of maul-locale #484 holds for this copy. test/test_base.c takes the same TEXT/EXPANDED static_assert, with the prefix, after its existing includes, and its header comment now names the result attribute. fix without ! is right at 1.x: a program gets a warning where the attribute was always meant to apply. The body has no column-0 name( lines and no em dash.
Merged
siracozmen01
pushed a commit
that referenced
this pull request
Nov 5, 2026
🤖 I have created a release *beep* *boop* --- ## [1.1.1](v1.1.0...v1.1.1) (2026-11-04) ### Fixed - `MUNI_NODISCARD` was empty under GCC 14 in C23, since GCC 14 reports its C23 as `__STDC_VERSION__` 202000L and the macro waited for 202311L, so a program built with GCC 14 could drop any status the library returns without a warning. In C the macro now takes `[[nodiscard]]` in any dialect after C17 whose compiler has the attribute. A program that drops a status now gets `-Wunused-result` from GCC 14 too, which `-Werror` makes an error ([#271](#271)). 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.0 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_NODISCARDis meant to make every function that returns a status warn when its result is dropped. In C it expanded to[[nodiscard]]only when__STDC_VERSION__ >= 202311L. GCC 14 has the attribute in its C23 mode but reports__STDC_VERSION__as202000Lthere, under-std=c23and-std=c2xalike. So under GCC the macro was empty:Clang 20 reports
202311L, which is why the clang cells never showed this. maul-locale found the same bug (Rawframe-Project/maul-locale#483) and fixed it in Rawframe-Project/maul-locale#484.Change
In C,
include/maul-unicode/base.hnow takes the attribute in any dialect after C17 (__STDC_VERSION__ > 201710L) whose compiler defines__has_c_attributeand reportsnodiscard. The__has_c_attributetest is nested underdefined(__has_c_attribute), so a compiler without the operator never parses it. C17 and older dialects keep the empty expansion, and the C++ branch is unchanged. A comment explains GCC 14's202000L. The block is maul-locale's at c346644, byte for byte except the prefix.test/test_base.casserts at compile time that the macro expands to something. Every suite builds as C23 with a compiler that has the attribute, so if the macro goes empty again, the build fails.Verification
base.h,test_basefails to build under GCC 14 with "static assertion failed: MUNI_NODISCARD is the attribute in C23". With this change it builds.muniValidateUtf8gets-Wunused-resultfrom GCC 14 (-std=c23) with this change and nothing with main's header; Clang 20 warns with both.-Werrorincluded: library, tools, samples, benchmarks and tests. No status is dropped anywhere, and all 13 tests pass.ci-cpp:2026.10.7) builds the HarfBuzz adapter and its suites the same way, and all 16 tests pass.tools/check.sh changedpasses: rules, format, clang-tidy in Release and Debug, and the base and results suites under linux-clang-20-asan.Closes #270