Closed wdhongtw closed 4 months ago
Used features from C23
[[maybe_unused]]
: should be ok for both GCC and ClangGCC/Clang version in some Linux distributions:
Clang and GCC compliance page:
Attention: Patch coverage is 75.00000%
with 9 lines
in your changes missing coverage. Please review.
Project coverage is 60.07%. Comparing base (
2ffbf00
) to head (9485582
).
Files | Patch % | Lines |
---|---|---|
src/setup/ibus-setup-chewing-window.c | 20.00% | 4 Missing :warning: |
src/ibus-chewing-engine.c | 40.00% | 3 Missing :warning: |
src/IBusChewingPreEdit.c | 0.00% | 1 Missing :warning: |
src/main.c | 0.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Checks failed at ...
This may take longer than expected. I'm still trying to reproduce this failure locally.
Checks failed at ...
This may take longer than expected. I'm still trying to reproduce this failure locally.
The signature is defined like https://docs.gtk.org/gtk4/callback.WidgetActionActivateFunc.html
I'm confused why I can not reproduce this error in my local environment (Fedora 40, Clang version 18.1.6) It tooks the same as the state in CI container...
llvm-libs x86_64 18.1.6-2.fc40 updates 28 M
So it may trigger other compile error after I update the PR later. O_Q
I'm confused why I can not reproduce this error in my local environment (Fedora 40, Clang version 18.1.6) It tooks the same as the state in CI container...
llvm-libs x86_64 18.1.6-2.fc40 updates 28 M
So it may trigger other compile error after I update the PR later. O_Q
That's why Werror can be annoying at times : ðŸ¤
That's why Werror can be annoying at times : ðŸ¤
Now I known that...
It's may looks more natural to use the original (signed-integer) type to do comparision. And it should be safe to cast from unsigned-int to signed-int for the value ranges in these secenarios.
Maybe I should modify the PR again?
diff --git a/src/IBusChewingLookupTable.c b/src/IBusChewingLookupTable.c
index 99cec8b..0bdd552 100644
--- a/src/IBusChewingLookupTable.c
+++ b/src/IBusChewingLookupTable.c
@@ -58,8 +58,8 @@ guint ibus_chewing_lookup_table_update(
[[maybe_unused]] IBusChewingProperties *iProperties,
ChewingContext *context) {
IBusText *iText = NULL;
- guint i;
- guint choicePerPage = (guint)chewing_cand_ChoicePerPage(context);
+ gint i;
+ gint choicePerPage = chewing_cand_ChoicePerPage(context);
gint totalChoice = chewing_cand_TotalChoice(context);
gint currentPage = chewing_cand_CurrentPage(context);
diff --git a/src/ibus-chewing-engine.c b/src/ibus-chewing-engine.c
index 7307baf..091495b 100644
--- a/src/ibus-chewing-engine.c
+++ b/src/ibus-chewing-engine.c
@@ -989,7 +989,7 @@ void ibus_chewing_engine_candidate_clicked(IBusEngine *engine, guint index,
if (is_password(self))
return;
- if (index >= (guint)chewing_get_candPerPage(self->icPreEdit->context)) {
+ if ((gint)index >= chewing_get_candPerPage(self->icPreEdit->context)) {
IBUS_CHEWING_LOG(DEBUG, "candidate_clicked() index out of ranged");
return;
}
That's why Werror can be annoying at times : ðŸ¤
Now I known that...
It's may looks more natural to use the original (signed-integer) type to do comparision. And it should be safe to cast from unsigned-int to signed-int for the value ranges in these secenarios.
Maybe I should modify the PR again?
Sure, there are opinions that in C/C++ you rarely need to use unsigned integer and it might be dangerous. I'm not sure if the compiler has new warnings against them. It might still worth to follow the wisdom.
https://jacobegner.blogspot.com/2019/11/unsigned-integers-are-dangerous.html
Rebase and force pushed again.
-Werror
*-release-ci
to build the project with the option aboveThe default
and *-release
presets are not changed, to avoid potential troubles addressed by @yan12125 :smiley_cat:
LGTM
For motivation, see #206.
This PR contains commits for
-Wextra
and-Werror
compiler optionsIf desired, maybe I can extract the commit that upgrade to C23 as another PR. Since that it's a standalone change to this project.