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:
Tyler Veness
2022-10-15 16:33:14 -07:00
committed by GitHub
parent 396143004c
commit fbdc810887
355 changed files with 1659 additions and 2918 deletions

View File

@@ -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;
}