Skip to content

Commit 876d410

Browse files
committed
[wpiutil] Use C++23 stacktrace library on Windows
This lets us remove the unmaintained StackWalker library and its hacky upstream_utils script. A Discord user also reported that StackWalker gives blank stacktraces: https://discord.com/channels/176186766946992128/368993897495527424/1261940029287301150 They 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 ```
1 parent d62ab12 commit 876d410

File tree

19 files changed

+68
-2007
lines changed

19 files changed

+68
-2007
lines changed

.github/workflows/upstream-utils.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,6 @@ jobs:
120120
./mpack.py clone
121121
./mpack.py copy-src
122122
./mpack.py format-patch
123-
- name: Run stack_walker.py
124-
run: |
125-
cd upstream_utils
126-
./stack_walker.py clone
127-
./stack_walker.py copy-src
128-
./stack_walker.py format-patch
129123
- name: Run memory.py
130124
run: |
131125
cd upstream_utils

ThirdPartyNotices.txt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jQuery wpinet/src/main/native/resources/jquery-*
3333
popper.js wpinet/src/main/native/resources/popper-*
3434
units wpimath/src/main/native/include/units/
3535
Eigen wpimath/src/main/native/thirdparty/eigen/include/
36-
StackWalker wpiutil/src/main/native/windows/StackWalker.*
3736
Team 254 Library wpimath/src/main/java/edu/wpi/first/math/spline/SplineParameterizer.java
3837
wpimath/src/main/java/edu/wpi/first/math/trajectory/TrajectoryParameterizer.java
3938
wpimath/src/main/native/include/frc/spline/SplineParameterizer.h
@@ -1026,35 +1025,6 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
10261025
defined by the Mozilla Public License, v. 2.0.
10271026

10281027

1029-
===================
1030-
StackWalker License
1031-
===================
1032-
Copyright (c) 2005-2013, Jochen Kalmbach
1033-
All rights reserved.
1034-
1035-
Redistribution and use in source and binary forms, with or without modification,
1036-
are permitted provided that the following conditions are met:
1037-
1038-
Redistributions of source code must retain the above copyright notice,
1039-
this list of conditions and the following disclaimer.
1040-
Redistributions in binary form must reproduce the above copyright notice,
1041-
this list of conditions and the following disclaimer in the documentation
1042-
and/or other materials provided with the distribution.
1043-
Neither the name of Jochen Kalmbach nor the names of its contributors may be
1044-
used to endorse or promote products derived from this software without
1045-
specific prior written permission.
1046-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1047-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
1048-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1049-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
1050-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1051-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1052-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1053-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1054-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1055-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1056-
1057-
10581028
================
10591029
Team 254 Library
10601030
================

apriltag/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ add_library(apriltag ${apriltag_native_src} ${apriltag_resources_src} ${apriltag
120120
set_target_properties(apriltag PROPERTIES DEBUG_POSTFIX "d")
121121

122122
set_property(TARGET apriltag PROPERTY FOLDER "libraries")
123-
target_compile_features(apriltag PUBLIC cxx_std_20)
123+
if(MSVC)
124+
target_compile_features(apriltag PUBLIC cxx_std_23)
125+
else()
126+
target_compile_features(apriltag PUBLIC cxx_std_20)
127+
endif()
124128
wpilib_target_warnings(apriltag)
125129

126130
target_link_libraries(apriltag wpimath)

fieldImages/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ add_library(fieldImages ${field_images_resources_src} src/main/native/cpp/fields
4646
set_target_properties(fieldImages PROPERTIES DEBUG_POSTFIX "d")
4747

4848
set_property(TARGET fieldImages PROPERTY FOLDER "libraries")
49-
target_compile_features(fieldImages PUBLIC cxx_std_20)
5049
if(MSVC)
5150
target_compile_options(fieldImages PUBLIC /bigobj)
51+
target_compile_features(fieldImages PUBLIC cxx_std_23)
52+
else()
53+
target_compile_features(fieldImages PUBLIC cxx_std_20)
5254
endif()
5355
wpilib_target_warnings(fieldImages)
5456

ntcore/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ target_include_directories(
2525
$<INSTALL_INTERFACE:${include_dest}/ntcore>
2626
)
2727
wpilib_target_warnings(ntcore)
28-
target_compile_features(ntcore PUBLIC cxx_std_20)
28+
if(MSVC)
29+
target_compile_features(ntcore PUBLIC cxx_std_23)
30+
else()
31+
target_compile_features(ntcore PUBLIC cxx_std_20)
32+
endif()
2933
target_link_libraries(ntcore PUBLIC wpinet wpiutil)
3034

3135
set_property(TARGET ntcore PROPERTY FOLDER "libraries")

romiVendordep/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ add_library(romiVendordep ${romiVendordep_native_src})
5252
set_target_properties(romiVendordep PROPERTIES DEBUG_POSTFIX "d")
5353
set_property(TARGET romiVendordep PROPERTY FOLDER "libraries")
5454

55-
target_compile_features(romiVendordep PUBLIC cxx_std_20)
55+
if(MSVC)
56+
target_compile_features(romiVendordep PUBLIC cxx_std_23)
57+
else()
58+
target_compile_features(romiVendordep PUBLIC cxx_std_20)
59+
endif()
5660
wpilib_target_warnings(romiVendordep)
5761
target_link_libraries(romiVendordep wpilibc)
5862

shared/config.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ nativeUtils.platformConfigs.each {
3939
}
4040
}
4141

42+
// Use C++23 on Windows
43+
nativeUtils.platformConfigs.each {
44+
if (it.name.contains('windows')) {
45+
it.cppCompiler.args.add("/std:c++23preview")
46+
}
47+
}
48+
4249
nativeUtils.platformConfigs.linuxathena.linker.args.add("-Wl,--fatal-warnings")
4350

4451
if (project.hasProperty('ntcoreffibuild')) {

upstream_utils/stack_walker.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

upstream_utils/stack_walker_patches/0001-Add-advapi-pragma.patch

Lines changed: 0 additions & 21 deletions
This file was deleted.

wpilibNewCommands/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ add_library(wpilibNewCommands ${wpilibNewCommands_native_src})
6060
set_target_properties(wpilibNewCommands PROPERTIES DEBUG_POSTFIX "d")
6161
set_property(TARGET wpilibNewCommands PROPERTY FOLDER "libraries")
6262

63-
target_compile_features(wpilibNewCommands PUBLIC cxx_std_20)
63+
if(MSVC)
64+
target_compile_features(wpilibNewCommands PUBLIC cxx_std_23)
65+
else()
66+
target_compile_features(wpilibNewCommands PUBLIC cxx_std_20)
67+
endif()
6468
wpilib_target_warnings(wpilibNewCommands)
6569
target_link_libraries(wpilibNewCommands wpilibc)
6670

0 commit comments

Comments
 (0)