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:
Noel Eck
2016-10-13 12:18:52 -07:00
parent 58dfa9d95a
commit 6be7012987
26 changed files with 185 additions and 40 deletions

View File

@ -22,11 +22,13 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <errno.h>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
#include <t6713.hpp>
#define T6713_ADDR 0x15
@ -103,6 +105,7 @@ uint16_t T6713::getSensorData (MODBUS_COMMANDS cmd)
//printf("\nRS485 mode set\n ");
break;
case I2C:
{
//printf("\nI2C mode set\n");
data = 0;
runCommand(cmd);
@ -113,7 +116,7 @@ uint16_t T6713::getSensorData (MODBUS_COMMANDS cmd)
// TODO: need to handle this
}
RESPONSE * response = new RESPONSE ;
if(readBytes = i2c->read((uint8_t*)(response), sizeof(RESPONSE) ) != sizeof(RESPONSE))
if((readBytes = i2c->read((uint8_t*)(response), sizeof(RESPONSE) ) != sizeof(RESPONSE)))
{
UPM_THROW("I2C read failed");
// TODO
@ -128,6 +131,10 @@ uint16_t T6713::getSensorData (MODBUS_COMMANDS cmd)
delete(response); response=NULL;
return(data);
break;
}
default:
syslog(LOG_WARNING, "%s: switch case not defined",
std::string(__FUNCTION__).c_str());
}
return 0;
@ -218,7 +225,7 @@ STATUS T6713::getStatus()
UPM_THROW ("I2C error setting slave address");
//need to handle tnis
}
if(readBytes = i2c->read((uint8_t*) (response), sizeof(RESPONSE)) != sizeof(RESPONSE))
if((readBytes = i2c->read((uint8_t*) (response), sizeof(RESPONSE)) != sizeof(RESPONSE)))
{
UPM_THROW("I2C read failed");