Upgrade wpiformat and use clang-format's include sorting (#8350)

This PR also uses the newly added -default-branch flag to generate the list of changed files with respect to the correct branch (2027).
This commit is contained in:
Tyler Veness
2025-11-11 18:05:12 -08:00
committed by GitHub
parent a0f4727179
commit 1705b2d61c
321 changed files with 677 additions and 628 deletions

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/util/array.hpp"
#include <gtest/gtest.h>
namespace {
class MoveOnlyType {
public:

View File

@@ -2,11 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/Base64.hpp"
#include <string>
#include <gtest/gtest.h>
#include "wpi/util/Base64.hpp"
#include "wpi/util/SmallString.hpp"
namespace wpi::util {

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/util/FastQueue.hpp"
#include <gtest/gtest.h>
TEST(FastQueueTest, Basic) {
wpi::util::FastQueue<int> q;
q.enqueue(25);

View File

@@ -2,10 +2,10 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <gtest/gtest.h>
#include "wpi/util/StringExtras.hpp"
#include <gtest/gtest.h>
TEST(StringExtrasTest, RemovePrefix) {
std::string_view original = "wpilib";
auto modified = wpi::util::remove_prefix(original, "wpi");

View File

@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
#include "wpi/util/StringMap.hpp" // NOLINT(build/include_order)
#include "wpi/util/StringMap.hpp"
#include <string>
#include <tuple>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/Synchronization.h" // NOLINT(build/include_order)
#include "wpi/util/Synchronization.h"
#include <thread>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/UidVector.hpp" // NOLINT(build/include_order)
#include "wpi/util/UidVector.hpp"
#include <vector>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/circular_buffer.hpp" // NOLINT(build/include_order)
#include "wpi/util/circular_buffer.hpp"
#include <array>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/ct_string.hpp" // NOLINT(build/include_order)
#include "wpi/util/ct_string.hpp"
#include <string>
#include <string_view>

View File

@@ -2,6 +2,8 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/expected"
#include <initializer_list>
#include <tuple>
#include <utility>
@@ -9,8 +11,6 @@
#include <gtest/gtest.h>
#include "wpi/util/expected"
namespace {
struct TakesInitAndVariadic {
std::vector<int> v;

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/future.hpp" // NOLINT(build/include_order)
#include "wpi/util/future.hpp"
#include <utility>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/interpolating_map.hpp" // NOLINT(build/include_order)
#include "wpi/util/interpolating_map.hpp"
#include <gtest/gtest.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/priority_mutex.hpp" // NOLINT(build/include_order)
#include "wpi/util/priority_mutex.hpp"
#include <atomic>
#include <condition_variable>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/rotated_span.hpp" // NOLINT(build/include_order)
#include "wpi/util/rotated_span.hpp"
#include <array>
#include <vector>
@@ -25,7 +25,7 @@ static std::array<int, 10> sarr_values = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}};
static int arr_values[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
static std::vector<int> vec_values{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
TEST(CircularSpanTest, Constexpr) {
TEST(RotatedSpanTest, Constexpr) {
{
constexpr wpi::util::rotated_span<const int, 10> sp{cesarr_values};
static_assert(sp[5] == cesarr_values[5]);
@@ -36,7 +36,7 @@ TEST(CircularSpanTest, Constexpr) {
}
}
TEST(CircularSpanTest, ConstructConst) {
TEST(RotatedSpanTest, ConstructConst) {
{
wpi::util::rotated_span<const int, 10> sp{csarr_values};
EXPECT_EQ(sp[5], sarr_values[5]);
@@ -65,7 +65,7 @@ TEST(CircularSpanTest, ConstructConst) {
}
}
TEST(CircularSpanTest, ConstructNonConst) {
TEST(RotatedSpanTest, ConstructNonConst) {
{
wpi::util::rotated_span<int, 10> sp{sarr_values};
EXPECT_EQ(sp[5], sarr_values[5]);
@@ -92,7 +92,7 @@ TEST(CircularSpanTest, ConstructNonConst) {
}
}
TEST(CircularSpanTest, ConstructRotated) {
TEST(RotatedSpanTest, ConstructRotated) {
{
constexpr wpi::util::rotated_span<const int, 10> sp{cesarr_values, 1};
static_assert(sp[5] == cesarr_values[6]);
@@ -128,7 +128,7 @@ TEST(CircularSpanTest, ConstructRotated) {
}
}
TEST(CircularSpanTest, Rotate) {
TEST(RotatedSpanTest, Rotate) {
constexpr wpi::util::rotated_span<const int, 10> sp{cesarr_values, 1};
static_assert(sp[5] == cesarr_values[6]);
static_assert(sp.rotate(2)[5] == cesarr_values[8]);
@@ -147,7 +147,7 @@ void const_unsized_func(wpi::util::rotated_span<const int>) {}
void sized_func(wpi::util::rotated_span<int, 10>) {}
void const_sized_func(wpi::util::rotated_span<const int, 10>) {}
TEST(CircularSpanTest, Implicit) {
TEST(RotatedSpanTest, Implicit) {
// unsized_func(csarr_values); // error
const_unsized_func(csarr_values);
// sized_func(csarr_values); // error
@@ -169,7 +169,7 @@ TEST(CircularSpanTest, Implicit) {
const_sized_func(arr_values);
}
TEST(CircularSpanTest, IteratorConst) {
TEST(RotatedSpanTest, IteratorConst) {
wpi::util::rotated_span<const int> sp_sarr{csarr_values};
// iterator
@@ -187,7 +187,7 @@ TEST(CircularSpanTest, IteratorConst) {
}
}
TEST(CircularSpanTest, IteratorNonConst) {
TEST(RotatedSpanTest, IteratorNonConst) {
wpi::util::rotated_span<int> sp_sarr{sarr_values};
// iterator

View File

@@ -19,12 +19,12 @@
-- Volker Grabsch <vog@notjusthosting.com>
*/
#include "wpi/util/sha1.hpp"
#include <string>
#include <gtest/gtest.h>
#include "wpi/util/sha1.hpp"
namespace wpi::util {
/*

View File

@@ -31,7 +31,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "wpi/util/Signal.h" // NOLINT(build/include_order)
// clang-format off
#include "wpi/util/Signal.h"
// clang-format on
#include <type_traits>

View File

@@ -31,7 +31,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "wpi/util/Signal.h" // NOLINT(build/include_order)
// clang-format off
#include "wpi/util/Signal.h"
// clang-format on
#include <gtest/gtest.h>

View File

@@ -31,7 +31,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "wpi/util/Signal.h" // NOLINT(build/include_order)
// clang-format off
#include "wpi/util/Signal.h"
// clang-format on
#include <gtest/gtest.h>

View File

@@ -31,7 +31,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "wpi/util/Signal.h" // NOLINT(build/include_order)
// clang-format off
#include "wpi/util/Signal.h"
// clang-format on
#include <array>
#include <atomic>

View File

@@ -31,7 +31,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "wpi/util/Signal.h" // NOLINT(build/include_order)
// clang-format off
#include "wpi/util/Signal.h"
// clang-format on
#include <cmath>
#include <memory>

View File

@@ -31,7 +31,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "wpi/util/Signal.h" // NOLINT(build/include_order)
#include "wpi/util/Signal.h"
#include <cmath>
#include <sstream>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/spinlock.hpp" // NOLINT(build/include_order)
#include "wpi/util/spinlock.hpp"
#include <chrono>
#include <mutex>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/static_circular_buffer.hpp" // NOLINT(build/include_order)
#include "wpi/util/static_circular_buffer.hpp"
#include <array>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/struct/DynamicStruct.hpp" // NOLINT(build/include_order)
#include "wpi/util/struct/DynamicStruct.hpp"
#include <stdint.h>

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/util/struct/SchemaParser.hpp" // NOLINT(build/include_order)
#include "wpi/util/struct/SchemaParser.hpp"
#include <gtest/gtest.h>