mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
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:
committed by
Peter Johnson
parent
fb1239a2ad
commit
221011494d
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2015-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. */
|
||||
@@ -36,6 +36,9 @@ class NetworkTableInstance;
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -765,6 +768,8 @@ class NetworkTable final : public ITable {
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#elif _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} // namespace nt
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2015-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. */
|
||||
@@ -278,21 +278,16 @@ class Value final {
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string entry value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time if nonzero, the creation time to use (instead of the current
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
template <typename T,
|
||||
typename = std::enable_if_t<std::is_same<T, std::string>>>
|
||||
#else
|
||||
/**
|
||||
* Creates a string entry value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time if nonzero, the creation time to use (instead of the current
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
template <typename T,
|
||||
typename std::enable_if<std::is_same<T, std::string>::value>::type>
|
||||
#endif
|
||||
static std::shared_ptr<Value> MakeString(T&& value, uint64_t time = 0) {
|
||||
auto val = std::make_shared<Value>(NT_STRING, time, private_init());
|
||||
val->m_string = std::move(value);
|
||||
@@ -317,21 +312,16 @@ class Value final {
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a raw entry value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time if nonzero, the creation time to use (instead of the current
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
template <typename T,
|
||||
typename = std::enable_if_t<std::is_same<T, std::string>>>
|
||||
#else
|
||||
/**
|
||||
* Creates a raw entry value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time if nonzero, the creation time to use (instead of the current
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
template <typename T,
|
||||
typename std::enable_if<std::is_same<T, std::string>::value>::type>
|
||||
#endif
|
||||
static std::shared_ptr<Value> MakeRaw(T&& value, uint64_t time = 0) {
|
||||
auto val = std::make_shared<Value>(NT_RAW, time, private_init());
|
||||
val->m_string = std::move(value);
|
||||
|
||||
@@ -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. */
|
||||
@@ -36,7 +36,7 @@ class RpcCall final {
|
||||
*/
|
||||
RpcCall(NT_Entry entry, NT_RpcCall call) : m_entry(entry), m_call(call) {}
|
||||
|
||||
RpcCall(RpcCall&& other);
|
||||
RpcCall(RpcCall&& other) noexcept;
|
||||
RpcCall(const RpcCall&) = delete;
|
||||
RpcCall& operator=(const RpcCall&) = delete;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace nt {
|
||||
|
||||
inline RpcCall::RpcCall(RpcCall&& other) : RpcCall() {
|
||||
inline RpcCall::RpcCall(RpcCall&& other) noexcept : RpcCall() {
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2015-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. */
|
||||
@@ -79,19 +79,19 @@ struct ConnectionInfo {
|
||||
std::string remote_ip;
|
||||
|
||||
/** The port number of the remote node. */
|
||||
unsigned int remote_port;
|
||||
unsigned int remote_port{0};
|
||||
|
||||
/**
|
||||
* The last time any update was received from the remote node (same scale as
|
||||
* returned by nt::Now()).
|
||||
*/
|
||||
uint64_t last_update;
|
||||
uint64_t last_update{0};
|
||||
|
||||
/**
|
||||
* The protocol version being used for this connection. This in protocol
|
||||
* layer format, so 0x0200 = 2.0, 0x0300 = 3.0).
|
||||
*/
|
||||
unsigned int protocol_version;
|
||||
unsigned int protocol_version{0};
|
||||
|
||||
friend void swap(ConnectionInfo& first, ConnectionInfo& second) {
|
||||
using std::swap;
|
||||
@@ -179,7 +179,7 @@ class RpcAnswer {
|
||||
/** NetworkTables Entry Notification */
|
||||
class EntryNotification {
|
||||
public:
|
||||
EntryNotification() : listener(0), entry(0) {}
|
||||
EntryNotification() : listener(0), entry(0), flags(0) {}
|
||||
EntryNotification(NT_EntryListener listener_, NT_Entry entry_,
|
||||
StringRef name_, std::shared_ptr<Value> value_,
|
||||
unsigned int flags_)
|
||||
|
||||
@@ -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. */
|
||||
@@ -18,6 +18,9 @@
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
class ITable;
|
||||
@@ -58,6 +61,8 @@ class WPI_DEPRECATED(
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#elif _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // NTCORE_TABLES_ITABLELISTENER_H_
|
||||
|
||||
Reference in New Issue
Block a user