New issue
Advanced search Search tips

Issue 876142 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 876106
Owner:
Closed: Aug 21
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Mosys: Enable -Wall

Project Member Reported by teravest@chromium.org, Aug 21

Issue description

This was probably dropped in the conversion away from Kconfig.

Having -Wall enabled would have caught the bug raised at https://issuetracker.google.com/112319097:

../mosys-9999/platform/glados/glados.c:120:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        if (!cros_config_smbios_platform_name_match(intf, "Nautilus")) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../mosys-9999/platform/glados/glados.c:141:9: note: uninitialized use occurs here
        return ret;
               ^~~
../mosys-9999/platform/glados/glados.c:120:2: note: remove the 'if' if its condition is always true
        if (!cros_config_smbios_platform_name_match(intf, "Nautilus")) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../mosys-9999/platform/glados/glados.c:108:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0
1 error generated.

It's straightfoward enough to turn this back on, and we should if only to keep from encountering these bugs.

I hit the above warning with this patch:
teravest@teravest5:~/cros/src/platform/mosys$ git diff
diff --git a/meson.build b/meson.build
index 4068d06..ab6206f 100644
--- a/meson.build
+++ b/meson.build
@@ -39,6 +39,7 @@ cc = meson.get_compiler('c')
 if (cc.has_argument('-Wno-address-of-packed-member'))
   add_global_arguments(['-Wno-address-of-packed-member'], language: 'c')
 endif
+add_global_arguments('-Wall', language : 'c')
 add_global_arguments('-Werror', language : 'c')
 
 # External libs used by Mosys
 
Mergedinto: 876106
Status: Duplicate (was: Untriaged)
There are already a few CLs against the duplicate bug to fix the issue.

Sign in to add a comment