From cdc33ceb9fd592e82c1eb940dbac5cb0fbfeded2 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Tue, 8 Nov 2016 16:26:16 -0800 Subject: [PATCH] bitbake: Fix for pthreads C test w/yocto Fixed a problem where the C/CXX compile flags were getting overwritten. Fixed warnings in a few sensor drivers. This commit fixes #485 Signed-off-by: Noel Eck --- CMakeLists.txt | 5 +++-- src/htu21d/htu21d.cpp | 2 +- src/t6713/t6713.cxx | 2 +- src/wt5001/wt5001.cxx | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96509bce..24a89ef4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,7 @@ include (CheckCXXCompilerFlag) # This function checks to see if each flag is supported # by the compiler before setting the compile option. function (upm_add_compile_flags compiler) + set (_TMP_COMPILER_FLAGS "") # Iterate the flags, check if supported foreach (flag ${ARGN}) # Check if this compile flag is supported @@ -85,7 +86,7 @@ function (upm_add_compile_flags compiler) endforeach (flag ${ARGN}) # Set the variable in the parent scope - set (CMAKE_${compiler}_FLAGS ${_TMP_COMPILER_FLAGS} PARENT_SCOPE) + set (CMAKE_${compiler}_FLAGS "${CMAKE_${compiler}_FLAGS} ${_TMP_COMPILER_FLAGS}" PARENT_SCOPE) endfunction () # Compiler flags common to both C and CXX @@ -95,7 +96,7 @@ set (C_CXX_WARNING_FLAGS -Wall -Wno-misleading-indentation) # Warnings as errors? if (WERROR) - list (APPEND C_CXX_WARNING_FLAGS -Werror) + set (C_CXX_WARNING_FLAGS "-Werror ${C_CXX_WARNING_FLAGS}") message (STATUS "Warnings as errors enabled (-Werror), disable with -DWERROR=off") endif (WERROR) diff --git a/src/htu21d/htu21d.cpp b/src/htu21d/htu21d.cpp index c7e4683a..607e8f4e 100644 --- a/src/htu21d/htu21d.cpp +++ b/src/htu21d/htu21d.cpp @@ -202,7 +202,7 @@ HTU21D::testSensor(void) int iError = 0; float fTemp, fHum; float fTempMax, fTempMin; - float fHumMax, fHumMin; + float fHumMax = 0.0, fHumMin = 0.0; float fTempFirst; fprintf(stdout, "Executing Sensor Test\n" ); diff --git a/src/t6713/t6713.cxx b/src/t6713/t6713.cxx index 10ac08d2..65c850e6 100644 --- a/src/t6713/t6713.cxx +++ b/src/t6713/t6713.cxx @@ -145,7 +145,7 @@ mraa::Result T6713::runCommand(MODBUS_COMMANDS cmd) { COMMAND * cmdPacket = new COMMAND ; - mraa::Result ret; + mraa::Result ret = mraa::SUCCESS; switch(cmd) { diff --git a/src/wt5001/wt5001.cxx b/src/wt5001/wt5001.cxx index 09f16359..4e50a23f 100644 --- a/src/wt5001/wt5001.cxx +++ b/src/wt5001/wt5001.cxx @@ -493,7 +493,7 @@ uint8_t WT5001::getPlayState() bool WT5001::getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf) { char pkt[4]; - WT5001_OPCODE_T opcode; + WT5001_OPCODE_T opcode = NONE; pkt[0] = WT5001_START; pkt[1] = 0x02; // length