Repository navigation
fix: warnings in maya build - #11
Merged
Merged
Conversation
A // comment whose last character is '\' is joined to the next line by line splicing (translation phase 2), before comments are recognised, and GCC reports -Wcomment. The joined line here was itself a comment, so no code was lost, but the warning showed up in every host build that compiles maya with its default flags, and any later edit that turned the next line into code would have silently commented it out. Rewrap the sentence so "ESC \" sits mid-line. Wording is unchanged.
"theme: a swap survives the fullscreen double-buffer too" ran the pipeline up to write_diff() and dropped the result. write_diff() is [[nodiscard]] because the Opened stage it returns is the frame that is still open, so GCC warned -Wunused-result at both call sites (lines 687 and 703), the only warnings in maya's own build. Finish each chain with close_frame(false), the same call render_fullscreen.cpp makes. sync_output=false matches open_frame(false), so the only bytes added are the SGR reset "\x1b[0m". It contains neither background SGR the test looks for, so all three asserts check what they checked before: the first frame has the old background, the second has the new one and not the old. -fsyntax-only with maya's own compile_commands flags: no warnings.
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.
Fix the two warnings in maya's build
test(style): close the frame in the double-buffer theme test
tests/test_style.cpp:687and:703stopped the render pipeline atwrite_diff()and threw away its result.write_diff()is[[nodiscard]]because that result is the still-open frame, so GCC warned
-Wunused-result. Each chain now ends withclose_frame(false), the samecall
render_fullscreen.cppmakes. The only bytes this adds are the\x1b[0mreset, so the test's three asserts check exactly what they checkedbefore.
input: keep a backslash off the end of a
//commentsrc/terminal/input.cpp:235ended a//comment withESC \. The compilerjoins a line ending in
\to the next one before it looks at comments,which is what GCC warns about with
-Wcomment, and the warning shows up inevery host build. The next line was also a comment, so nothing was lost
today. But if that line ever became code, it would be silently commented
out.
The fix rewraps the sentence so
ESC \sits in the middle of a line. Thewording does not change.
This is the only
//comment in maya that ends in a backslash. I greppedfor the pattern.
Verification
g++ -fsyntax-onlywith the flags from maya's ownbuild/compile_commands.jsonfor
tests/test_style.cpp: no warnings.g++ -fsyntax-only -Wall -Wextrawith agentty's flags forsrc/terminal/input.cpp:the
-Wcommentwarning is gone. The one warning left(
-Wmissing-field-initializersat line 255) is turned off by maya's ownCMake flags.