Update for C++17 and fix MSVC warnings (#1694)

* Update MSVC arguments
* Fix json allocator
* Fix simulation diamond
* Bump gtest
* Remove empty varargs in unit tests
* Replace test case with test suite
* Remove deprecation warning in optional
* Remove need for NOMIXMAX to be defined in wpilib headers
This commit is contained in:
Thad House
2019-05-31 13:43:32 -07:00
committed by Peter Johnson
parent fb1239a2ad
commit 221011494d
99 changed files with 534 additions and 398 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -44,11 +44,11 @@ constexpr int32_t kExpectedLoopTiming = 40;
* scaling is implemented as an output squelch to get longer periods for old
* devices.
*/
constexpr float kDefaultPwmPeriod = 5.05;
constexpr float kDefaultPwmPeriod = 5.05f;
/**
* kDefaultPwmCenter is the PWM range center in ms
*/
constexpr float kDefaultPwmCenter = 1.5;
constexpr float kDefaultPwmCenter = 1.5f;
/**
* kDefaultPWMStepsDown is the number of PWM steps below the centerpoint
*/

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -26,6 +26,10 @@
#include "mockdata/DIODataInternal.h"
#include "mockdata/HAL_Value.h"
#ifdef _WIN32
#pragma warning(disable : 4996 4018 6297 26451 4334)
#endif
using namespace hal;
enum WaitResult {
@@ -54,9 +58,9 @@ struct Interrupt {
};
struct SynchronousWaitData {
HAL_InterruptHandle interruptHandle;
HAL_InterruptHandle interruptHandle{HAL_kInvalidHandle};
wpi::condition_variable waitCond;
HAL_Bool waitPredicate;
HAL_Bool waitPredicate{false};
};
} // namespace
@@ -231,7 +235,7 @@ static int64_t WaitForInterruptDigital(HAL_InterruptHandle handle,
// Cancel our callback
SimDIOData[digitalIndex].value.CancelCallback(uid);
synchronousInterruptHandles->Free(dataHandle);
(void)synchronousInterruptHandles->Free(dataHandle);
// Check for what to return
if (timedOut) return WaitResult::Timeout;
@@ -295,7 +299,7 @@ static int64_t WaitForInterruptAnalog(HAL_InterruptHandle handle,
// Cancel our callback
SimAnalogInData[analogIndex].voltage.CancelCallback(uid);
synchronousInterruptHandles->Free(dataHandle);
(void)synchronousInterruptHandles->Free(dataHandle);
// Check for what to return
if (timedOut) return WaitResult::Timeout;

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -30,7 +30,7 @@ class EncoderData {
SimDataValue<HAL_Bool, MakeBoolean, GetInitializedName> initialized{false};
SimDataValue<int32_t, MakeInt, GetCountName> count{0};
SimDataValue<double, MakeDouble, GetPeriodName> period{
std::numeric_limits<double>::max()};
(std::numeric_limits<double>::max)()};
SimDataValue<HAL_Bool, MakeBoolean, GetResetName> reset{false};
SimDataValue<double, MakeDouble, GetMaxPeriodName> maxPeriod{0};
SimDataValue<HAL_Bool, MakeBoolean, GetDirectionName> direction{false};