Fix a few compiler warnings#534
Merged
arch1t3cht merged 5 commits intoTypesettingTools:masterfrom Feb 6, 2026
Merged
Conversation
Fixes the following warning:
../src/hotkey.cpp: In function ‘void {anonymous}::migrate_hotkeys(const char* (*)[3])’:
../src/hotkey.cpp:61:43: warning: comparing the result of pointer addition ‘(added + ((sizetype)(i * 24)))’ and NULL [-Waddress]
61 | for (size_t i = 0; added[i] && added[i][0]; ++i) {
| ^
Fixes the following warnings:
../libaegisub/common/cajun/reader.cpp: In member function ‘json::UnknownElement json::Reader::ParseObject(TokenStream&)’:
../libaegisub/common/cajun/reader.cpp:282:25: warning: redundant move in return statement [-Wredundant-move]
282 | return std::move(object);
| ~~~~~~~~~^~~~~~~~
../libaegisub/common/cajun/reader.cpp:282:25: note: remove ‘std::move’ call
../libaegisub/common/cajun/reader.cpp: In member function ‘json::UnknownElement json::Reader::ParseArray(TokenStream&)’:
../libaegisub/common/cajun/reader.cpp:299:25: warning: redundant move in return statement [-Wredundant-move]
299 | return std::move(array);
| ~~~~~~~~~^~~~~~~
../libaegisub/common/cajun/reader.cpp:299:25: note: remove ‘std::move’ call
Fixes the following warning:
../tests/tests/iconv.cpp: In member function ‘virtual void lagi_iconv_Buffer_Test::TestBody()’:
../tests/tests/iconv.cpp:91:19: warning: overflow in conversion from ‘int’ to ‘std::array<char, 4>::value_type’ {aka ‘char’} changes value from ‘255’ to ‘-1’ [-Woverflow]
91 | buff.fill(0xFF);
| ^~~~
Fixes the following warnings:
../src/resolution_resampler.cpp: In function ‘void ResampleResolution(AssFile*, ResampleSettings)’:
../src/resolution_resampler.cpp:242:45: warning: this statement may fall through [-Wimplicit-fallthrough=]
242 | border_horizontally = !border_horizontally;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
../src/resolution_resampler.cpp:243:17: note: here
243 | case ResampleARMode::AddBorder:
| ^~~~
../src/dialog_video_properties.cpp: In function ‘bool {anonymous}::update_video_properties(AssFile*, const AsyncVideoProvider*, wxWindow*)’:
../src/dialog_video_properties.cpp:139:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
139 | if (!ar_changed) {
| ^~
../src/dialog_video_properties.cpp:149:9: note: here
149 | case MISMATCH_PROMPT:
| ^~~~
We cannot use [[fallthrough]] attribute because that requires C23, but
actually just adding a comment silences the warnings too.
Fixes the following warnings:
../src/MatroskaParser.c: In function ‘myvsnprintf’:
../src/MatroskaParser.c:333:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
333 | state = 2;
| ~~~~~~^~~
../src/MatroskaParser.c:334:7: note: here
334 | case 2:
| ^~~~
../src/MatroskaParser.c:339:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
339 | state = 3;
| ~~~~~~^~~
../src/MatroskaParser.c:340:7: note: here
340 | case 3:
| ^~~~
../src/MatroskaParser.c:346:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
346 | state = 4;
| ~~~~~~^~~
../src/MatroskaParser.c:347:7: note: here
347 | case 4:
| ^~~~
../src/MatroskaParser.c: In function ‘parseBlockGroup’:
../src/MatroskaParser.c:2145:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
2145 | len = tmplen = toplen;
| ~~~~^~~~~~~~~~~~~~~~~
../src/MatroskaParser.c:2146:5: note: here
2146 | case 0xa1: // Block
| ^~~~
Member
|
Thanks! Repeating what I wrote on discord for posterity: Yes, |
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.
See the commit messages for the warnings that are fixed.
(I also decided to replace a few
// fallthroughcomments in C++ by[[fallthrough]];attributes. The comments suppress the warnings too, so whether it is an improvement is subjective.)