ueno / libkkc

Japanese Kana Kanji conversion input method library
GNU General Public License v3.0
106 stars 15 forks source link

Suppress vala generated code warnings temporarily #38

Open kinichiro opened 3 years ago

kinichiro commented 3 years ago

It appears that vala-0.48 generated code causes many compilation warnings. Temporarily, suppress these warnings with the compiler switches.

I thought suppress these warnings with compiler switch is better for now, rather than overlook other important messages. This should be removed after the vala solves these issues in the future. Instead of this pull request, we can do the same thing with make CFLAGS="-Wno-... -Wno-... -Wno-... -Wno-...", but it is too long ! This will propagate to the warning of tests/lib if #36 is merged.

ueno commented 3 years ago

Is this still the case if compiled with the latest Vala release (e.g., 0.54)? I heard that several improvements have been added to suppress C compiler warnings; @ricotz any suggestions?

ricotz commented 3 years ago

To silence warnings then passing -Wno-discarded-qualifiers -Wno-incompatible-pointer-types is reasonable. I can not recommend suppressing other warnings though.

So doing -Wno-int-conversion is bad, while is points to an existing problem.

--- a/libkkc/system-segment-dictionary.vala
+++ b/libkkc/system-segment-dictionary.vala
@@ -70,7 +70,7 @@ namespace Kkc {
         // Skip until the first occurrence of line.  This moves offset
         // at the beginning of the next line.
         bool read_until (ref long offset, string line) {
-            return_val_if_fail (offset < mmap.get_length (), null);
+            return_val_if_fail (offset < mmap.get_length (), false);
             while (offset + line.length < mmap.get_length ()) {
                 char *p = ((char *)mmap.get_contents () + offset);
                 if (*p == '\n' &&
kinichiro commented 3 years ago

Thanks for your comments. I dropped -Wno-deprecated-declarations and -Wno-int-conversion.

kinichiro commented 3 years ago

I had built and installed Vala 0.54.1 on my local environment, and set PATH and PKG_CONFIG_PATH to it and tried to build libkkc again. It still shows the warnings discarded-qualifiers and incompatible-pointer-types. Vala release note says it fixed some C compiler warnings, but that might not for the case of libkkc.

Fixing for system-segment-dictionary.vala in @ricotz comment is good and I think it should be imported.