-Werror is the default
thiagomacieira opened this issue · 1 comments
thiagomacieira commented
-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 commented
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.