mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
Fixing pedantics and using RTTI for command name
Change-Id: I16dc33faa229bc83af21ecf55011108245f67141
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user