diff --git a/arm-toolchain.cmake b/arm-toolchain.cmake index 1425b2b450..771c62983b 100644 --- a/arm-toolchain.cmake +++ b/arm-toolchain.cmake @@ -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? diff --git a/hal/lib/Athena/ChipObject.h b/hal/lib/Athena/ChipObject.h index 67f998131f..b726306d48 100644 --- a/hal/lib/Athena/ChipObject.h +++ b/hal/lib/Athena/ChipObject.h @@ -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 @@ -37,3 +39,4 @@ // FIXME: these should not be here! using namespace nFPGA; using namespace nRoboRIO_FPGANamespace; +#pragma GCC diagnostic pop diff --git a/wpilibc/wpilibC++/include/WPIErrors.h b/wpilibc/wpilibC++/include/WPIErrors.h index 570ee0fef3..d8b3cd264e 100644 --- a/wpilibc/wpilibC++/include/WPIErrors.h +++ b/wpilibc/wpilibC++/include/WPIErrors.h @@ -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 /* diff --git a/wpilibc/wpilibC++/src/Commands/Command.cpp b/wpilibc/wpilibC++/src/Commands/Command.cpp index 7ad6e45d2a..9bb53c9201 100644 --- a/wpilibc/wpilibC++/src/Commands/Command.cpp +++ b/wpilibc/wpilibC++/src/Commands/Command.cpp @@ -10,6 +10,7 @@ #include "RobotState.h" #include "Timer.h" #include "WPIErrors.h" +#include 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; }