mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Upgrade to C++20 (#4239)
* Use explicit this capture required by C++20 * Use C++20 span * Replace wpi::numbers with std::numbers * Fix C++20 clang-tidy warning false positive in fmt * Remove ciso646 include since C++20 removed that header * Fix global-buffer-overflow asan warnings in ntcore tests * Add DIOSetProxy constructor to HAL * Upgrade MSVC compiler to 2022 * Bump native-utils to 2023.2.7 (changes to std=c++20) Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <span>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <hal/simulation/DriverStationData.h>
|
||||
#include <hal/simulation/MockHooks.h>
|
||||
#include <wpi/span.h>
|
||||
|
||||
using namespace halsim;
|
||||
|
||||
@@ -45,7 +45,7 @@ void DSCommPacket::SetAlliance(uint8_t station_code) {
|
||||
m_alliance_station = static_cast<HAL_AllianceStationID>(station_code);
|
||||
}
|
||||
|
||||
void DSCommPacket::ReadMatchtimeTag(wpi::span<const uint8_t> tagData) {
|
||||
void DSCommPacket::ReadMatchtimeTag(std::span<const uint8_t> tagData) {
|
||||
if (tagData.size() < 6) {
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void DSCommPacket::ReadMatchtimeTag(wpi::span<const uint8_t> tagData) {
|
||||
m_match_time = matchTime;
|
||||
}
|
||||
|
||||
void DSCommPacket::ReadJoystickTag(wpi::span<const uint8_t> dataInput,
|
||||
void DSCommPacket::ReadJoystickTag(std::span<const uint8_t> dataInput,
|
||||
int index) {
|
||||
DSCommJoystickPacket& stick = m_joystick_packets[index];
|
||||
stick.ResetUdp();
|
||||
@@ -112,7 +112,7 @@ void DSCommPacket::ReadJoystickTag(wpi::span<const uint8_t> dataInput,
|
||||
/*----------------------------------------------------------------------------
|
||||
** Communication methods
|
||||
**--------------------------------------------------------------------------*/
|
||||
void DSCommPacket::DecodeTCP(wpi::span<const uint8_t> packet) {
|
||||
void DSCommPacket::DecodeTCP(std::span<const uint8_t> packet) {
|
||||
// No header
|
||||
while (!packet.empty()) {
|
||||
int tagLength = packet[0] << 8 | packet[1];
|
||||
@@ -137,7 +137,7 @@ void DSCommPacket::DecodeTCP(wpi::span<const uint8_t> packet) {
|
||||
}
|
||||
}
|
||||
|
||||
void DSCommPacket::DecodeUDP(wpi::span<const uint8_t> packet) {
|
||||
void DSCommPacket::DecodeUDP(std::span<const uint8_t> packet) {
|
||||
if (packet.size() < 6) {
|
||||
return;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void DSCommPacket::DecodeUDP(wpi::span<const uint8_t> packet) {
|
||||
}
|
||||
}
|
||||
|
||||
void DSCommPacket::ReadNewMatchInfoTag(wpi::span<const uint8_t> data) {
|
||||
void DSCommPacket::ReadNewMatchInfoTag(std::span<const uint8_t> data) {
|
||||
// Size 2 bytes, tag 1 byte
|
||||
if (data.size() <= 3) {
|
||||
return;
|
||||
@@ -204,7 +204,7 @@ void DSCommPacket::ReadNewMatchInfoTag(wpi::span<const uint8_t> data) {
|
||||
HALSIM_SetMatchInfo(&matchInfo);
|
||||
}
|
||||
|
||||
void DSCommPacket::ReadGameSpecificMessageTag(wpi::span<const uint8_t> data) {
|
||||
void DSCommPacket::ReadGameSpecificMessageTag(std::span<const uint8_t> data) {
|
||||
// Size 2 bytes, tag 1 byte
|
||||
if (data.size() <= 3) {
|
||||
return;
|
||||
@@ -220,7 +220,7 @@ void DSCommPacket::ReadGameSpecificMessageTag(wpi::span<const uint8_t> data) {
|
||||
|
||||
HALSIM_SetMatchInfo(&matchInfo);
|
||||
}
|
||||
void DSCommPacket::ReadJoystickDescriptionTag(wpi::span<const uint8_t> data) {
|
||||
void DSCommPacket::ReadJoystickDescriptionTag(std::span<const uint8_t> data) {
|
||||
if (data.size() < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user