mirror of
https://github.com/eclipse/upm.git
synced 2025-12-18 06:47:09 +03:00
Werror: Enable warnings as errors
Added C/CXX warning messages similar to MRAA (w/ -Werror).
* Added syslog warning for missing switch cases
* Cleaned up uint vs int usage
* Fixed redifinition errors for C structs
* Added virtual destructors for base classes
* Removed redundant CMAKE_CXX_FLAGS from COMPILE_FLAGS for all three
wrapper languages. The CMAKE_CXX_FLAGS were showing up twice in
the compile commands for the wrappers.
* Added CMake WERROR option to enable/disable warnings as errors for
all targets.
* Disable a handful of compiler warnings for the wrapper cxx files,
this minimizes the number of warnings from auto-generated code).
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@@ -157,7 +157,7 @@ upm_result_t tsl2561_compute_lux(const tsl2561_context dev, int *int_data) {
|
||||
uint16_t raw_lux_ch_0;
|
||||
uint16_t raw_lux_ch_1;
|
||||
uint8_t ch0_low, ch0_high, ch1_low, ch1_high;
|
||||
|
||||
|
||||
if (tsl2561_i2c_read_reg(dev, REGISTER_Channal0L, &ch0_low) != UPM_SUCCESS){
|
||||
return UPM_ERROR_OPERATION_FAILED;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ upm_result_t tsl2561_compute_lux(const tsl2561_context dev, int *int_data) {
|
||||
ratio_1 = (channel1 << (LUX_RATIOSCALE+1)) / channel0;
|
||||
|
||||
// round the ratio value
|
||||
unsigned long ratio = (ratio_1 + 1) >> 1;
|
||||
int64_t ratio = (ratio_1 + 1) >> 1;
|
||||
unsigned int b, m;
|
||||
|
||||
// CS package
|
||||
@@ -237,7 +237,7 @@ upm_result_t tsl2561_compute_lux(const tsl2561_context dev, int *int_data) {
|
||||
else if (ratio > LUX_K8C){
|
||||
b=LUX_B8C; m=LUX_M8C;
|
||||
}
|
||||
uint64_t temp_lux = 0;
|
||||
int64_t temp_lux = 0;
|
||||
temp_lux = ((channel0 * b) - (channel1 * m));
|
||||
// do not allow negative lux value
|
||||
if (temp_lux < 0) temp_lux = 0;
|
||||
|
||||
@@ -152,7 +152,7 @@ TSL2561::getLux()
|
||||
if (channel0 != 0) ratio1 = (channel1 << (LUX_RATIOSCALE+1)) / channel0;
|
||||
|
||||
// round the ratio value
|
||||
unsigned long ratio = (ratio1 + 1) >> 1;
|
||||
int64_t ratio = (ratio1 + 1) >> 1;
|
||||
|
||||
unsigned int b, m;
|
||||
|
||||
@@ -175,7 +175,7 @@ TSL2561::getLux()
|
||||
else if (ratio > LUX_K8C)
|
||||
{b=LUX_B8C; m=LUX_M8C;}
|
||||
|
||||
uint64_t tempLux = 0;
|
||||
int64_t tempLux = 0;
|
||||
tempLux = ((channel0 * b) - (channel1 * m));
|
||||
// do not allow negative lux value
|
||||
if (tempLux < 0) tempLux = 0;
|
||||
|
||||
Reference in New Issue
Block a user