Fixing pedantics and using RTTI for command name

Change-Id: I16dc33faa229bc83af21ecf55011108245f67141
This commit is contained in:
Patrick Plenefisch
2014-09-21 16:54:39 -04:00
parent 6710ac3a2f
commit 340a3d492c
4 changed files with 12 additions and 14 deletions

View File

@@ -4,6 +4,6 @@ set(ARM_PREFIX arm-frc-linux-gnueabi)
set(CMAKE_SYSTEM_NAME Linux)
CMAKE_FORCE_CXX_COMPILER(${ARM_PREFIX}-g++ GNU)
CMAKE_FORCE_C_COMPILER(${ARM_PREFIX}-gcc GNU)
set(CMAKE_CXX_FLAGS "-std=c++1y -Wformat=2 -Wall -Wextra -Werror -Wno-psabi" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-std=c++1y -Wformat=2 -Wall -Wextra -Werror -pedantic -Wno-psabi" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g" CACHE STRING "" FORCE) # still want debugging for release?

View File

@@ -4,6 +4,8 @@
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#pragma once
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include <stdint.h>
@@ -37,3 +39,4 @@
// FIXME: these should not be here!
using namespace nFPGA;
using namespace nRoboRIO_FPGANamespace;
#pragma GCC diagnostic pop

View File

@@ -7,10 +7,10 @@
#ifdef WPI_ERRORS_DEFINE_STRINGS
#define S(label, offset, message) const char *wpi_error_s_##label = message ; \
const int32_t wpi_error_value_##label = offset ;
const int32_t wpi_error_value_##label = offset
#else
#define S(label, offset, message) extern const char *wpi_error_s_##label ; \
const int32_t wpi_error_value_##label = offset ;
const int32_t wpi_error_value_##label = offset
#endif
/*

View File

@@ -10,6 +10,7 @@
#include "RobotState.h"
#include "Timer.h"
#include "WPIErrors.h"
#include <typeinfo>
static const char *kName = "name";
static const char *kRunning = "running";
@@ -29,17 +30,7 @@ void Command::InitCommand(const char *name, double timeout)
m_canceled = false;
m_runWhenDisabled = false;
m_parent = NULL;
if (name == NULL)
{
// Don't have a way to find the subclass name like java, so use the address
char buf[32];
snprintf(buf, 32, "Command_%p", this);
m_name = buf;
}
else
{
m_name = name;
}
m_name = name == NULL? std::string() : name;
m_table = NULL;
}
@@ -437,6 +428,10 @@ bool Command::WillRunWhenDisabled()
std::string Command::GetName()
{
if (m_name.length() == 0)
{
m_name = std::string("Command_") + std::string(typeid(*this).name());
}
return m_name;
}