mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil] Use C++23 stacktrace library on Windows (#6839)
This lets us remove the unmaintained StackWalker library and its hacky upstream_utils script. @Gold856 reported that StackWalker gives blank stacktraces: https://discord.com/channels/176186766946992128/368993897495527424/1261940029287301150. They also reported an earlier version of this PR giving the following stacktrace instead: ``` D:\allwpilib\developerRobot\src\main\native\cpp\Robot.cpp(18): developerRobotCpp!Robot::RobotInit+0xB6 D:\allwpilib\wpilibc\src\main\native\cpp\TimedRobot.cpp(22): wpilibcd!frc::TimedRobot::StartCompetition+0x4F D:\allwpilib\wpilibc\src\main\native\include\frc\RobotBase.h(36): developerRobotCpp!frc::impl::RunRobot<Robot>+0xC8 D:\allwpilib\wpilibc\src\main\native\include\frc\RobotBase.h(106): developerRobotCpp!frc::StartRobot<Robot>+0x17E D:\allwpilib\developerRobot\src\main\native\cpp\Robot.cpp(60): developerRobotCpp!main+0xB D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(79): developerRobotCpp!invoke_main+0x39 D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288): developerRobotCpp!__scrt_common_main_seh+0x132 D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(331): developerRobotCpp!__scrt_common_main+0xE D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp(17): developerRobotCpp!mainCRTStartup+0xE KERNEL32!BaseThreadInitThunk+0x1D ntdll!RtlUserThreadStart+0x28 ```
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -5,16 +5,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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" }
|
||||
|
||||
@@ -25,7 +25,7 @@ target_include_directories(
|
||||
$<INSTALL_INTERFACE:${include_dest}/ntcore>
|
||||
)
|
||||
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")
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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="
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
2
thirdparty/catch2/CMakeLists.txt
vendored
2
thirdparty/catch2/CMakeLists.txt
vendored
@@ -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
|
||||
|
||||
2
thirdparty/googletest/CMakeLists.txt
vendored
2
thirdparty/googletest/CMakeLists.txt
vendored
@@ -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"
|
||||
|
||||
2
thirdparty/imgui_suite/CMakeLists.txt
vendored
2
thirdparty/imgui_suite/CMakeLists.txt
vendored
@@ -51,7 +51,7 @@ target_include_directories(
|
||||
PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
@@ -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("\\", "/")
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
#include "wpi/util/StackTrace.hpp"
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#ifdef __cpp_lib_stacktrace
|
||||
#include <stacktrace>
|
||||
#elif !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#include <execinfo.h>
|
||||
#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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <string>
|
||||
|
||||
#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)
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
size_t index = 0;
|
||||
for (auto &&value : src) {
|
||||
auto value_ = reinterpret_steal<object>(
|
||||
value_conv::cast(forward_like<T>(value), policy, parent));
|
||||
value_conv::cast(detail::forward_like<T>(value), policy, parent));
|
||||
if (!value_)
|
||||
return handle();
|
||||
PyTuple_SET_ITEM(l.ptr(), (ssize_t)index++,
|
||||
@@ -94,4 +94,4 @@ public:
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace pybind11
|
||||
} // namespace pybind11
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
list l(src.size());
|
||||
size_t index = 0;
|
||||
for (auto &&value : src) {
|
||||
auto value_ = reinterpret_steal<object>(value_conv::cast(forward_like<T>(value), policy, parent));
|
||||
auto value_ = reinterpret_steal<object>(value_conv::cast(detail::forward_like<T>(value), policy, parent));
|
||||
if (!value_)
|
||||
return handle();
|
||||
PyList_SET_ITEM(l.ptr(), (ssize_t) index++, value_.release().ptr()); // steals a reference
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
size_t index = 0;
|
||||
for (auto &&value : src) {
|
||||
auto value_ = reinterpret_steal<object>(
|
||||
value_conv::cast(forward_like<T>(value), policy, parent));
|
||||
value_conv::cast(detail::forward_like<T>(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<object>(
|
||||
value_conv::cast(forward_like<T>(value), policy, parent));
|
||||
value_conv::cast(detail::forward_like<T>(value), policy, parent));
|
||||
if (!value_)
|
||||
return handle();
|
||||
PyList_SET_ITEM(l.ptr(), (ssize_t)index++,
|
||||
@@ -169,4 +169,4 @@ public:
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace pybind11
|
||||
} // namespace pybind11
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user