diff --git a/apriltag/CMakeLists.txt b/apriltag/CMakeLists.txt index 9d1606d737..7754c6f9a8 100644 --- a/apriltag/CMakeLists.txt +++ b/apriltag/CMakeLists.txt @@ -120,7 +120,7 @@ add_library(apriltag ${apriltag_native_src} ${apriltag_resources_src} ${apriltag set_target_properties(apriltag PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET apriltag PROPERTY FOLDER "libraries") -target_compile_features(apriltag PUBLIC cxx_std_20) +target_compile_features(apriltag PUBLIC cxx_std_23) wpilib_target_warnings(apriltag) target_link_libraries(apriltag wpimath) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index dfadd80f4e..0c0500b705 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -6,7 +6,7 @@ file(GLOB benchmarkCpp_src src/main/native/cpp/*.cpp src/main/native/thirdparty/ add_executable(benchmarkCpp ${benchmarkCpp_src}) -target_compile_features(benchmarkCpp PUBLIC cxx_std_20) +target_compile_features(benchmarkCpp PUBLIC cxx_std_23) wpilib_target_warnings(benchmarkCpp) diff --git a/commandsv2/CMakeLists.txt b/commandsv2/CMakeLists.txt index d38f48264f..499994a444 100644 --- a/commandsv2/CMakeLists.txt +++ b/commandsv2/CMakeLists.txt @@ -62,7 +62,7 @@ add_library(commandsv2 ${commandsv2_native_src}) set_target_properties(commandsv2 PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET commandsv2 PROPERTY FOLDER "libraries") -target_compile_features(commandsv2 PUBLIC cxx_std_20) +target_compile_features(commandsv2 PUBLIC cxx_std_23) wpilib_target_warnings(commandsv2) target_link_libraries(commandsv2 wpilibc) diff --git a/commandsv2/src/main/native/cpp/frc2/command/Command.cpp b/commandsv2/src/main/native/cpp/frc2/command/Command.cpp index aedd7f8e6d..ab901259a6 100644 --- a/commandsv2/src/main/native/cpp/frc2/command/Command.cpp +++ b/commandsv2/src/main/native/cpp/frc2/command/Command.cpp @@ -9,6 +9,7 @@ #include "wpi/commands2/CommandPtr.hpp" #include "wpi/commands2/CommandScheduler.hpp" +#include "wpi/util/Demangle.hpp" #include "wpi/util/StackTrace.hpp" #include "wpi/util/sendable/SendableBuilder.hpp" #include "wpi/util/sendable/SendableRegistry.hpp" diff --git a/commandsv2/src/main/native/cpp/frc2/command/CommandPtr.cpp b/commandsv2/src/main/native/cpp/frc2/command/CommandPtr.cpp index fec92c5270..4b75f75e24 100644 --- a/commandsv2/src/main/native/cpp/frc2/command/CommandPtr.cpp +++ b/commandsv2/src/main/native/cpp/frc2/command/CommandPtr.cpp @@ -21,6 +21,7 @@ #include "wpi/commands2/WaitUntilCommand.hpp" #include "wpi/commands2/WrapperCommand.hpp" #include "wpi/system/Errors.hpp" +#include "wpi/util/StackTrace.hpp" using namespace wpi::cmd; diff --git a/commandsv2/src/main/native/cpp/frc2/command/SubsystemBase.cpp b/commandsv2/src/main/native/cpp/frc2/command/SubsystemBase.cpp index f56a249b0f..a0a126d5a7 100644 --- a/commandsv2/src/main/native/cpp/frc2/command/SubsystemBase.cpp +++ b/commandsv2/src/main/native/cpp/frc2/command/SubsystemBase.cpp @@ -8,6 +8,7 @@ #include "wpi/commands2/Command.hpp" #include "wpi/commands2/CommandScheduler.hpp" +#include "wpi/util/Demangle.hpp" #include "wpi/util/sendable/SendableBuilder.hpp" #include "wpi/util/sendable/SendableRegistry.hpp" diff --git a/commandsv2/src/main/native/include/wpi/commands2/Command.hpp b/commandsv2/src/main/native/include/wpi/commands2/Command.hpp index be31868600..72f35548f6 100644 --- a/commandsv2/src/main/native/include/wpi/commands2/Command.hpp +++ b/commandsv2/src/main/native/include/wpi/commands2/Command.hpp @@ -5,16 +5,13 @@ #pragma once #include -#include #include #include #include "wpi/commands2/Requirements.hpp" #include "wpi/commands2/Subsystem.hpp" #include "wpi/units/time.hpp" -#include "wpi/util/Demangle.hpp" #include "wpi/util/SmallSet.hpp" -#include "wpi/util/StackTrace.hpp" #include "wpi/util/sendable/Sendable.hpp" namespace wpi::cmd { diff --git a/datalog/CMakeLists.txt b/datalog/CMakeLists.txt index bc9107cefb..ad933aee10 100644 --- a/datalog/CMakeLists.txt +++ b/datalog/CMakeLists.txt @@ -10,7 +10,7 @@ list(REMOVE_ITEM datalog_native_src ${datalog_jni_src}) add_library(datalog ${datalog_native_src}) set_target_properties(datalog PROPERTIES DEBUG_POSTFIX "d") -target_compile_features(datalog PUBLIC cxx_std_20) +target_compile_features(datalog PUBLIC cxx_std_23) wpilib_target_warnings(datalog) target_include_directories( diff --git a/fields/CMakeLists.txt b/fields/CMakeLists.txt index 42b2f3d27e..90a49fae0a 100644 --- a/fields/CMakeLists.txt +++ b/fields/CMakeLists.txt @@ -52,7 +52,7 @@ add_library(fields ${field_images_resources_src} src/main/native/cpp/fields.cpp) set_target_properties(fields PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET fields PROPERTY FOLDER "libraries") -target_compile_features(fields PUBLIC cxx_std_20) +target_compile_features(fields PUBLIC cxx_std_23) if(MSVC) target_compile_options(fields PUBLIC /bigobj) endif() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 57fedd443e..ad3e0f761d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -27,7 +27,7 @@ mockito-core = { module = "org.mockito:mockito-core", version = "4.1.0" } # Note that these are also Gradle plugins and cannot be used with the plugin specification # due to their presence on the classpath without version information. wpilib-gradle-vscode = { module = "org.wpilib:gradle-cpp-vscode", version = "2027.0.0" } -wpilib-native-utils = { module = "org.wpilib:native-utils", version = "2027.5.1" } +wpilib-native-utils = { module = "org.wpilib:native-utils", version = "2027.6.1" } [bundles] ejml = ["ejml-simple"] @@ -46,6 +46,6 @@ wpilib-gradle-jni = { id = "org.wpilib.GradleJni", version = "2027.0.0" } # Note: these plugins can't be used. Their JARs are on the classpath for buildSrc, # which doesn't retain version information. # wpilib-gradle-vscode = { id = "org.wpilib.GradleVsCode", version = "2027.0.0" } -# wpilib-native-utils = { id = "org.wpilib.NativeUtils", version = "2027.5.1" } +# wpilib-native-utils = { id = "org.wpilib.NativeUtils", version = "2027.6.1" } wpilib-repositories = { id = "org.wpilib.WPILibRepositoriesPlugin", version = "2027.0.0" } wpilib-versioning = { id = "org.wpilib.WPILibVersioningPlugin", version = "2027.0.1" } diff --git a/ntcore/CMakeLists.txt b/ntcore/CMakeLists.txt index c248d532aa..ee170b50e5 100644 --- a/ntcore/CMakeLists.txt +++ b/ntcore/CMakeLists.txt @@ -25,7 +25,7 @@ target_include_directories( $ ) wpilib_target_warnings(ntcore) -target_compile_features(ntcore PUBLIC cxx_std_20) +target_compile_features(ntcore PUBLIC cxx_std_23) target_link_libraries(ntcore PUBLIC wpinet wpiutil datalog) set_property(TARGET ntcore PROPERTY FOLDER "libraries") diff --git a/ntcore/src/dev/native/cpp/main.cpp b/ntcore/src/dev/native/cpp/main.cpp index 9f90b133bf..b0210a3fb0 100644 --- a/ntcore/src/dev/native/cpp/main.cpp +++ b/ntcore/src/dev/native/cpp/main.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/romiVendordep/CMakeLists.txt b/romiVendordep/CMakeLists.txt index 600a0e4484..aadacf0966 100644 --- a/romiVendordep/CMakeLists.txt +++ b/romiVendordep/CMakeLists.txt @@ -52,7 +52,7 @@ add_library(romiVendordep ${romiVendordep_native_src}) set_target_properties(romiVendordep PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET romiVendordep PROPERTY FOLDER "libraries") -target_compile_features(romiVendordep PUBLIC cxx_std_20) +target_compile_features(romiVendordep PUBLIC cxx_std_23) wpilib_target_warnings(romiVendordep) target_link_libraries(romiVendordep wpilibc) diff --git a/shared/bazel/compiler_flags/linux_flags.rc b/shared/bazel/compiler_flags/linux_flags.rc index 2099cb18fc..6e24041dcf 100644 --- a/shared/bazel/compiler_flags/linux_flags.rc +++ b/shared/bazel/compiler_flags/linux_flags.rc @@ -7,7 +7,7 @@ common:linux --repo_env=BAZEL_COPTS="-Wall:-Wextra:-Werror:-gz=zlib" # C++ only -common:linux --repo_env=BAZEL_CXXOPTS="-std=c++20:-Wformat=2:-pedantic:-Wno-psabi:-Wno-unused-parameter:-fPIC:-pthread:-Wno-deprecated-enum-enum-conversion" +common:linux --repo_env=BAZEL_CXXOPTS="-std=c++23:-Wformat=2:-pedantic:-Wno-psabi:-Wno-unused-parameter:-fPIC:-pthread:-Wno-deprecated-enum-enum-conversion" # C Only common:linux --repo_env=BAZEL_CONLYOPTS="-Wformat=2:-pedantic:-Wno-psabi:-Wno-unused-parameter:-fPIC:-pthread" diff --git a/shared/bazel/compiler_flags/osx_flags.rc b/shared/bazel/compiler_flags/osx_flags.rc index 823c5b57b7..26262e5ed3 100644 --- a/shared/bazel/compiler_flags/osx_flags.rc +++ b/shared/bazel/compiler_flags/osx_flags.rc @@ -2,7 +2,7 @@ common:macos --repo_env=BAZEL_COPTS="-Wall:-Wextra:-Werror:-Wno-shorten-64-to-32 common:macos --host_per_file_copt=external/.*@-Wno-deprecated-non-prototype,-Wno-unused-function,-Wno-sign-compare # C++ only -common:macos --repo_env=BAZEL_CXXOPTS="-std=c++20:-pedantic:-fPIC:-Wno-unused-parameter:-Wno-error=deprecated-enum-enum-conversion:-Wno-missing-field-initializers:-Wno-unused-private-field:-Wno-unused-const-variable:-Wno-error=c11-extensions:-pthread:-Wno-deprecated-anon-enum-enum-conversion" +common:macos --repo_env=BAZEL_CXXOPTS="-std=c++23:-pedantic:-fPIC:-Wno-unused-parameter:-Wno-error=deprecated-enum-enum-conversion:-Wno-missing-field-initializers:-Wno-unused-private-field:-Wno-unused-const-variable:-Wno-error=c11-extensions:-pthread:-Wno-deprecated-anon-enum-enum-conversion" # C only common:macos --repo_env=BAZEL_CONLYOPTS="-pedantic:-fPIC:-Wno-unused-parameter:-Wno-missing-field-initializers:-Wno-unused-private-field:-Wno-fixed-enum-extension" diff --git a/shared/bazel/compiler_flags/windows_flags.rc b/shared/bazel/compiler_flags/windows_flags.rc index 36df64aeaf..8d6c0aa526 100644 --- a/shared/bazel/compiler_flags/windows_flags.rc +++ b/shared/bazel/compiler_flags/windows_flags.rc @@ -5,7 +5,7 @@ common:windows --repo_env="BAZEL_COPTS=/W3:/WX" # C++ options -common:windows --repo_env="BAZEL_CXXOPTS=/EHsc:/FS:/Zc%:inline:/wd4244:/wd4267:/wd4146:/wd4996:/Zc%:throwingNew:/D_CRT_SECURE_NO_WARNINGS:/std%:c++20:/permissive-:/utf-8:/bigobj:/Zc%:__cplusplus:/Zc%:preprocessor:/wd5105" +common:windows --repo_env="BAZEL_CXXOPTS=/EHsc:/FS:/Zc%:inline:/wd4244:/wd4267:/wd4146:/wd4996:/Zc%:throwingNew:/D_CRT_SECURE_NO_WARNINGS:/std%:c++23preview:/permissive-:/utf-8:/bigobj:/Zc%:__cplusplus:/Zc%:preprocessor:/wd5105" # Remove "/D_WIN32_WINNT=0x0601" common:windows --repo_env="BAZEL_WIN32_WINNT=" diff --git a/shared/bazel/rules/objectivec_rules.bzl b/shared/bazel/rules/objectivec_rules.bzl index 05d674fa3c..815a490b0f 100644 --- a/shared/bazel/rules/objectivec_rules.bzl +++ b/shared/bazel/rules/objectivec_rules.bzl @@ -23,7 +23,7 @@ def wpilib_objc_library( """ copts = copts or [] if is_cpp: - copts.append("-std=c++20") + copts.append("-std=c++23") if include_arc: copts += ["-fobjc-weak", "-fobjc-arc"] diff --git a/shared/bazel/rules/robotpy/semiwrap_helpers.bzl b/shared/bazel/rules/robotpy/semiwrap_helpers.bzl index 6c41aee92f..c917d68468 100644 --- a/shared/bazel/rules/robotpy/semiwrap_helpers.bzl +++ b/shared/bazel/rules/robotpy/semiwrap_helpers.bzl @@ -164,7 +164,7 @@ def header_to_dat( cmd += " " + include_root cmd += _location_helper(RESOLVE_CASTERS_DIR + casters_pickle) cmd += " $(OUTS)" - cmd += " bogus c++20 ccache c++ -- -std=c++20" # TODO(pj) Does it matter what these values are? + cmd += " bogus c++23 ccache c++ -- -std=c++23" # TODO(pj) Does it matter what these values are? native.genrule( name = name + "." + class_name, diff --git a/thirdparty/catch2/CMakeLists.txt b/thirdparty/catch2/CMakeLists.txt index b1cabb90f3..45882cf34f 100644 --- a/thirdparty/catch2/CMakeLists.txt +++ b/thirdparty/catch2/CMakeLists.txt @@ -8,7 +8,7 @@ add_library(catch2 ${catch2_src}) set_target_properties(catch2 PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET catch2 PROPERTY FOLDER "libraries") -target_compile_features(catch2 PUBLIC cxx_std_20) +target_compile_features(catch2 PUBLIC cxx_std_23) target_include_directories( catch2 diff --git a/thirdparty/googletest/CMakeLists.txt b/thirdparty/googletest/CMakeLists.txt index dfc09e9490..043670ce6c 100644 --- a/thirdparty/googletest/CMakeLists.txt +++ b/thirdparty/googletest/CMakeLists.txt @@ -12,7 +12,7 @@ add_library(googletest ${googletest_src}) set_target_properties(googletest PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET googletest PROPERTY FOLDER "libraries") -target_compile_features(googletest PUBLIC cxx_std_20) +target_compile_features(googletest PUBLIC cxx_std_23) include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/include" diff --git a/thirdparty/imgui_suite/CMakeLists.txt b/thirdparty/imgui_suite/CMakeLists.txt index e117f221fe..3e158585ba 100644 --- a/thirdparty/imgui_suite/CMakeLists.txt +++ b/thirdparty/imgui_suite/CMakeLists.txt @@ -51,7 +51,7 @@ target_include_directories( PRIVATE "$" ) -target_compile_features(imgui PUBLIC cxx_std_20) +target_compile_features(imgui PUBLIC cxx_std_23) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0) target_compile_options(imgui PUBLIC -Wno-nontrivial-memcall) diff --git a/tools/wpical/build.gradle b/tools/wpical/build.gradle index 9770c2dc0e..3bb11173f0 100644 --- a/tools/wpical/build.gradle +++ b/tools/wpical/build.gradle @@ -82,42 +82,46 @@ nativeUtils.platformConfigs.each { it.cCompiler.args.add("/wd4047") it.cCompiler.args.add("/wd4098") it.cCompiler.args.add("/wd4267") + it.cppCompiler.args.add("/wd4068") it.cppCompiler.args.add("/wd4101") it.cppCompiler.args.add("/wd4200") it.cppCompiler.args.add("/wd4576") it.cppCompiler.args.add("/wd4715") } else if (it.name.contains('osx')) { - it.cCompiler.args.add("-Wno-format-nonliteral") it.cCompiler.args.remove("-pedantic") - it.cCompiler.args.add("-Wno-unused-variable") - it.cCompiler.args.add("-Wno-unused-function") + it.cCompiler.args.add("-Wno-format-nonliteral") it.cCompiler.args.add("-Wno-sign-compare") - it.cppCompiler.args.add("-Wno-missing-field-initializers") + it.cCompiler.args.add("-Wno-unused-function") + it.cCompiler.args.add("-Wno-unused-variable") + it.cppCompiler.args.remove("-pedantic") - it.cppCompiler.args.add("-Wno-unused-variable") - it.cppCompiler.args.add("-Wno-unused-function") - it.cppCompiler.args.add("-Wno-sign-compare") it.cppCompiler.args.remove("-permissive") it.cppCompiler.args.add("-fpermissive") + it.cppCompiler.args.add("-Wno-missing-field-initializers") + it.cppCompiler.args.add("-Wno-deprecated-declarations") it.cppCompiler.args.add("-Wno-missing-braces") it.cppCompiler.args.add("-Wno-null-conversion") - it.cppCompiler.args.add("-Wno-unused-but-set-variable") - } else { - it.cCompiler.args.add("-Wno-format-nonliteral") - it.cCompiler.args.remove("-pedantic") - it.cCompiler.args.add("-Wno-unused-variable") - it.cCompiler.args.add("-Wno-unused-function") - it.cCompiler.args.add("-Wno-sign-compare") - it.cppCompiler.args.add("-Wno-missing-field-initializers") - it.cppCompiler.args.remove("-pedantic") - it.cppCompiler.args.add("-Wno-unused-variable") - it.cppCompiler.args.add("-Wno-unused-function") it.cppCompiler.args.add("-Wno-sign-compare") - it.cppCompiler.args.add("-Wno-deprecated-declarations") - it.cppCompiler.args.add("-Wno-deprecated-enum-enum-conversion") + it.cppCompiler.args.add("-Wno-unused-but-set-variable") + it.cppCompiler.args.add("-Wno-unused-function") + it.cppCompiler.args.add("-Wno-unused-variable") + } else { + it.cCompiler.args.remove("-pedantic") + it.cCompiler.args.add("-Wno-format-nonliteral") + it.cCompiler.args.add("-Wno-sign-compare") + it.cCompiler.args.add("-Wno-unused-function") + it.cCompiler.args.add("-Wno-unused-variable") + + it.cppCompiler.args.remove("-pedantic") it.cppCompiler.args.remove("-permissive") it.cppCompiler.args.add("-fpermissive") + it.cppCompiler.args.add("-Wno-deprecated-declarations") + it.cppCompiler.args.add("-Wno-deprecated-enum-enum-conversion") + it.cppCompiler.args.add("-Wno-missing-field-initializers") + it.cppCompiler.args.add("-Wno-sign-compare") + it.cppCompiler.args.add("-Wno-unused-function") + it.cppCompiler.args.add("-Wno-unused-variable") } } def testResources = "\"$rootDir/tools/wpical/src/main/native/assets\"".replace("\\", "/") diff --git a/wpimath/CMakeLists.txt b/wpimath/CMakeLists.txt index daeb98d33d..65b1529347 100644 --- a/wpimath/CMakeLists.txt +++ b/wpimath/CMakeLists.txt @@ -162,7 +162,7 @@ set_target_properties(wpimath PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET wpimath PROPERTY FOLDER "libraries") target_compile_definitions(wpimath PRIVATE WPILIB_EXPORTS SLEIPNIR_EXPORTS) -target_compile_features(wpimath PUBLIC cxx_std_20) +target_compile_features(wpimath PUBLIC cxx_std_23) if(MSVC) target_compile_options(wpimath PUBLIC /utf-8 /bigobj) endif() diff --git a/wpinet/CMakeLists.txt b/wpinet/CMakeLists.txt index af645178e3..a979cfae98 100644 --- a/wpinet/CMakeLists.txt +++ b/wpinet/CMakeLists.txt @@ -124,7 +124,7 @@ set_target_properties(wpinet PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET wpinet PROPERTY FOLDER "libraries") -target_compile_features(wpinet PUBLIC cxx_std_20) +target_compile_features(wpinet PUBLIC cxx_std_23) wpilib_target_warnings(wpinet) target_link_libraries(wpinet PUBLIC wpiutil) diff --git a/wpiutil/CMakeLists.txt b/wpiutil/CMakeLists.txt index 168943ba20..e0df345331 100644 --- a/wpiutil/CMakeLists.txt +++ b/wpiutil/CMakeLists.txt @@ -134,8 +134,6 @@ file( ) list(REMOVE_ITEM wpiutil_native_src ${wpiutil_jni_src}) file(GLOB_RECURSE wpiutil_unix_src src/main/native/unix/*.cpp) -file(GLOB_RECURSE wpiutil_linux_src src/main/native/linux/*.cpp) -file(GLOB_RECURSE wpiutil_macos_src src/main/native/macOS/*.cpp) file(GLOB_RECURSE wpiutil_windows_src src/main/native/windows/*.cpp) file(GLOB fmtlib_native_src src/main/native/thirdparty/fmtlib/src/*.cpp) @@ -145,7 +143,7 @@ set_target_properties(wpiutil PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET wpiutil PROPERTY FOLDER "libraries") -target_compile_features(wpiutil PUBLIC cxx_std_20) +target_compile_features(wpiutil PUBLIC cxx_std_23) if(MSVC) target_compile_options( wpiutil @@ -187,11 +185,6 @@ if(MSVC) target_sources(wpiutil PRIVATE ${wpiutil_windows_src}) else() target_sources(wpiutil PRIVATE ${wpiutil_unix_src}) - if(APPLE) - target_sources(wpiutil PRIVATE ${wpiutil_macos_src}) - else() - target_sources(wpiutil PRIVATE ${wpiutil_linux_src}) - endif() endif() install( diff --git a/wpiutil/build.gradle b/wpiutil/build.gradle index 3b117b0871..1e142b5cf2 100644 --- a/wpiutil/build.gradle +++ b/wpiutil/build.gradle @@ -134,32 +134,6 @@ ext { } } } - } else if (it.targetPlatform.operatingSystem.isMacOsX()) { - it.sources { - wpiutilmacOSCpp(CppSourceSet) { - source { - srcDirs 'src/main/native/macOS' - include '**/*.cpp' - } - exportedHeaders { - srcDirs 'src/main/native/include', 'src/main/native/cpp', 'src/main/native/thirdparty/llvm/include', 'src/main/native/thirdparty/fmtlib/include', 'src/main/native/thirdparty/sigslot/include', 'src/main/native/thirdparty/json/include', 'src/main/native/thirdparty/mpack/include', 'src/main/native/thirdparty/nanopb/include' - include '**/*.h' - } - } - } - } else { - it.sources { - wpiutilLinuxCpp(CppSourceSet) { - source { - srcDirs 'src/main/native/linux' - include '**/*.cpp' - } - exportedHeaders { - srcDirs 'src/main/native/include', 'src/main/native/cpp', 'src/main/native/thirdparty/llvm/include', 'src/main/native/thirdparty/fmtlib/include', 'src/main/native/thirdparty/sigslot/include', 'src/main/native/thirdparty/json/include', 'src/main/native/thirdparty/mpack/include', 'src/main/native/thirdparty/nanopb/include' - include '**/*.h' - } - } - } } } } diff --git a/wpiutil/src/main/native/unix/StackTrace.cpp b/wpiutil/src/main/native/cpp/StackTrace.cpp similarity index 63% rename from wpiutil/src/main/native/unix/StackTrace.cpp rename to wpiutil/src/main/native/cpp/StackTrace.cpp index fc4029b323..0d8a36ebca 100644 --- a/wpiutil/src/main/native/unix/StackTrace.cpp +++ b/wpiutil/src/main/native/cpp/StackTrace.cpp @@ -4,7 +4,9 @@ #include "wpi/util/StackTrace.hpp" -#ifndef __EMSCRIPTEN__ +#ifdef __cpp_lib_stacktrace +#include +#elif !defined(_WIN32) && !defined(__EMSCRIPTEN__) #include #endif @@ -18,23 +20,36 @@ namespace wpi::util { std::string GetStackTraceDefault(int offset) { -#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) - void* stackTrace[128]; - int stackSize = backtrace(stackTrace, 128); - char** mangledSymbols = backtrace_symbols(stackTrace, stackSize); wpi::util::SmallString<1024> buf; wpi::util::raw_svector_ostream trace(buf); - for (int i = offset; i < stackSize; i++) { - // Only print recursive functions once in a row. +#ifdef __cpp_lib_stacktrace + auto stackTrace = std::stacktrace::current(); + + for (size_t i = offset; i < stackTrace.size(); ++i) { + // Only print recursive functions once in a row if (i == 0 || stackTrace[i] != stackTrace[i - 1]) { - // extract just function name from "pathToExe(functionName+offset)" + trace << "\tat " << std::to_string(stackTrace[i]) << '\n'; + } + } + + return std::string{trace.str()}; +#elif !defined(_WIN32) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) + void* stackTrace[128]; + int stackSize = backtrace(stackTrace, 128); + char** mangledSymbols = backtrace_symbols(stackTrace, stackSize); + + for (int i = offset; i < stackSize; ++i) { + // Only print recursive functions once in a row + if (i == 0 || stackTrace[i] != stackTrace[i - 1]) { + // Extract just function name from "pathToExe(functionName+offset)" std::string_view sym = split(mangledSymbols[i], '(').second; std::string_view offset; std::tie(sym, offset) = split(sym, '+'); std::string_view addr; std::tie(offset, addr) = split(offset, ')'); - trace << "\tat " << Demangle(sym) << " + " << offset << addr << "\n"; + + trace << "\tat " << Demangle(sym) << " + " << offset << addr << '\n'; } } diff --git a/wpiutil/src/main/native/windows/StackTrace.cpp b/wpiutil/src/main/native/windows/StackTrace.cpp deleted file mode 100644 index c6d2920708..0000000000 --- a/wpiutil/src/main/native/windows/StackTrace.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// 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/StackTrace.hpp" - -#include - -#if defined(_MSC_VER) - -namespace wpi::util { - -std::string GetStackTraceDefault(int offset) { - // FIXME: Use C++23 std::stacktrace - return ""; -} - -} // namespace wpi::util - -#endif // defined(_MSC_VER) diff --git a/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_array_type_caster.h b/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_array_type_caster.h index b3955b79df..3a1ba846d5 100644 --- a/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_array_type_caster.h +++ b/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_array_type_caster.h @@ -83,7 +83,7 @@ public: size_t index = 0; for (auto &&value : src) { auto value_ = reinterpret_steal( - value_conv::cast(forward_like(value), policy, parent)); + value_conv::cast(detail::forward_like(value), policy, parent)); if (!value_) return handle(); PyTuple_SET_ITEM(l.ptr(), (ssize_t)index++, @@ -94,4 +94,4 @@ public: }; } // namespace detail -} // namespace pybind11 \ No newline at end of file +} // namespace pybind11 diff --git a/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_smallvectorimpl_type_caster.h b/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_smallvectorimpl_type_caster.h index 2f791e83d1..949e0cc49d 100644 --- a/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_smallvectorimpl_type_caster.h +++ b/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_smallvectorimpl_type_caster.h @@ -58,7 +58,7 @@ public: list l(src.size()); size_t index = 0; for (auto &&value : src) { - auto value_ = reinterpret_steal(value_conv::cast(forward_like(value), policy, parent)); + auto value_ = reinterpret_steal(value_conv::cast(detail::forward_like(value), policy, parent)); if (!value_) return handle(); PyList_SET_ITEM(l.ptr(), (ssize_t) index++, value_.release().ptr()); // steals a reference diff --git a/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_span_type_caster.h b/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_span_type_caster.h index 22f8c6dd51..9f5f80ac8b 100644 --- a/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_span_type_caster.h +++ b/wpiutil/src/main/python/wpiutil/src/type_casters/wpi_span_type_caster.h @@ -64,7 +64,7 @@ public: size_t index = 0; for (auto &&value : src) { auto value_ = reinterpret_steal( - value_conv::cast(forward_like(value), policy, parent)); + value_conv::cast(detail::forward_like(value), policy, parent)); if (!value_) return handle(); PyTuple_SET_ITEM(l.ptr(), (ssize_t)index++, @@ -107,7 +107,7 @@ public: size_t index = 0; for (auto &&value : src) { auto value_ = reinterpret_steal( - value_conv::cast(forward_like(value), policy, parent)); + value_conv::cast(detail::forward_like(value), policy, parent)); if (!value_) return handle(); PyList_SET_ITEM(l.ptr(), (ssize_t)index++, @@ -169,4 +169,4 @@ public: }; } // namespace detail -} // namespace pybind11 \ No newline at end of file +} // namespace pybind11 diff --git a/xrpVendordep/CMakeLists.txt b/xrpVendordep/CMakeLists.txt index b4bf64d995..ecaf3b4d30 100644 --- a/xrpVendordep/CMakeLists.txt +++ b/xrpVendordep/CMakeLists.txt @@ -52,7 +52,7 @@ add_library(xrpVendordep ${xrpVendordep_native_src}) set_target_properties(xrpVendordep PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET xrpVendordep PROPERTY FOLDER "libraries") -target_compile_features(xrpVendordep PUBLIC cxx_std_20) +target_compile_features(xrpVendordep PUBLIC cxx_std_23) wpilib_target_warnings(xrpVendordep) target_link_libraries(xrpVendordep wpilibc)