Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Werror is the default #672

Open
thiagomacieira opened this issue Oct 9, 2018 · 1 comment
Open

-Werror is the default #672

thiagomacieira opened this issue Oct 9, 2018 · 1 comment

Comments

@thiagomacieira
Copy link

-Werror should never be turned on by default for users. Maintainers of the software explicitly turn that on.

Biuild steps:

mkdir build
cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS:BOOL=ON -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DLIB_SUFFIX=64 -DCMAKE_AR=/usr/bin/gcc-ar -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_RANLIB=/usr/bin/gcc-ranlib ..
make

Result:

/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_check_digital_communication_reg_value':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:607:8: error: 'dcst_reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (dcst_reg != expected_val)
        ^
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_set_bits_with_mask':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:331:13: error: 'reg_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     reg_val &= ~bit_mask;
             ^~
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_set_bit_on':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:311:15: error: 'reg_value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     reg_value |= bit_mask;
     ~~~~~~~~~~^~~~~~~~~~~
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_set_bit_off':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:321:15: error: 'reg_value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     reg_value &= ~bit_mask;
               ^~
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_get_wakeup_motion_time':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:1024:17: error: 'motion_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     *out_time = (float)motion_count * dev->odr_in_sec_wakeup;
                 ^~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_get_wakeup_non_activity_time':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:1051:17: error: 'non_activity_reg_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     *out_time = (float)non_activity_reg_count * dev->odr_in_sec_wakeup;
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c: In function 'kxtj3_get_wakeup_threshold':
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:1092:60: error: 'reg_value_l' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     *out_threshold = (float)((uint16_t)((reg_value_h << 8) | reg_value_l) >> 4) / 256;
                                        ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/builddir/build/BUILD/upm-1.7.0/src/kxtj3/kxtj3.c:1092:54: error: 'reg_value_h' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     *out_threshold = (float)((uint16_t)((reg_value_h << 8) | reg_value_l) >> 4) / 256;
                                         ~~~~~~~~~~~~~^~~~~
/builddir/build/BUILD/upm-1.7.0/src/led/led.c:79:34: error: passing argument 1 of 'mraa_led_init' makes integer from pointer without a cast [-Werror=int-conversion]
     dev->gpioled = mraa_led_init(name);
                                  ^~~~
In file included from /builddir/build/BUILD/upm-1.7.0/src/led/led.h:36,
                 from /builddir/build/BUILD/upm-1.7.0/src/led/led.c:27:
/usr/include/mraa/led.h:55:36: note: expected 'int' but argument is of type 'const char *'
 mraa_led_context mraa_led_init(int led);
                                ~~~~^~~

In a related note, UPM produces warnings. It should not.

@Propanu
Copy link
Contributor

Propanu commented Oct 11, 2018

All patched on master now. I'll drop a 1.7.1 tag to go with it that can be paired with MRAA 2.0.

-Werror should never be turned on by default for users.

IMO most end-users install UPM in binary form through their native package manager and won't build it from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants