Squashed 'third_party/allwpilib/' changes from e4b91005cf..83f1860047
83f1860047 [wpilib] Add/update documentation to PneumaticBase and subclasses (NFC) (#4881)
9872e676d8 [commands] Make Subsystem destructor virtual (#4892)
25db20e49d [hal] Fix segfault in various HAL functions (#4891)
b0c6724eed [glass] Add hamburger menu icon to titlebars (#4874)
f0fa8205ac Add missing compiler flags and fix warnings (#4889)
42fc4cb6bc [wpiutil] SafeThread: Provide start/stop hooks (#4880)
cc166c98d2 [templates] Add Command-based skeleton template (#4861)
3f51f10ad3 [build] Update to 2023v3 image (#4886)
1562eae74a [ntcore] Refactor meta-topic decoding from glass (#4809)
b632b288a3 Fix usages of std::min and std::max to be windows safe (#4887)
c11bd2720f [wpilibc] Add internal function to reset Shuffleboard instance (#4884)
f1151d375f [ntcore] Add method to get server time offset (#4847)
fe1b62647f [hal,wpilib] Update documentation for getComments (NFC) (#4879)
c49a45abbd [build] Fix examples linking in incorrect jni library (#4873)
bc3d01a721 [build] Add platform check to doxygen plugin (#4862)
bc473240ae Add Jetbrains Fleet folder to .gitignore (#4872)
2121bd5fb8 [wpimath] Remove RKF45 (#4870)
835f8470d6 [build] Fix roborio cross-compiler on arm hosts (#4864)
6cfe5de00d [ntcore] Don't deadlock server on early destroy (#4863)
2ac41f3edc [hal, wpilib] Add RobotController.getComments() (#4463)
26bdbf3d41 Java optimization and formatting fixes (#4857)
92149efa11 Spelling and grammar cleanups (#4849)
176fddeb4c [commands] Add functions to HID classes to allow use of axes as BooleanEvents/Triggers (#4762)
87a34af367 [templates] Add bindings to command-based template (#4838)
4534e75787 [examples] Remove redundant MotorControl example (#4837)
1cbebaa2f7 [commands] Remove final semicolon from test macro definition (#4859)
6efb9ee405 [commands] Add constructor for SwerveControllerCommand that takes a HolonomicDriveController (#4785)
1e7fcd5637 [cscore] Change run loop functions to not be mac specific (#4854)
1f940e2b60 [apriltag] Add C++ wrappers, rewrite Java/JNI to match (#4842)
a6d127aedf [build] Add missing task dependency in wpilibjExamples (#4852)
b893b3d6d3 [cscore] Add support for USB cameras on macOS (#4846)
1696a490fa [glass] Add support for alternate NT ports (#4848)
40a22d69bc [glass] Add support for alternate NT ports (#4848)
e84dbfede0 [wpilib] GenericHID: Add rumble both option (#4843)
8aa9dbfa90 [examples] Link apriltag package in examples build.gradle (#4845)
eda2fa8a17 [build] Update Spotless (#4840)
d20594db0d Fix typos (#4839)
dd8ecfdd54 [commands] Fix typo in waitUntil docs (NFC) (#4841)
17ceebfff4 [apriltag] Clean up apriltag JNI (#4823)
8b74ab389d [examples] RapidReactCommandBot: Fix array indices (#4833)
1aad3489c2 [sim] Implement PD total current and power (#4830)
2744991771 [wpimath] Fix docs in SwerveModulePosition (#4825)
ffbf6a1fa2 [commands] Disable regularly failing unit test (#4824)
fbabd0ef15 [commands] Enhance Command Sendable implementations (#4822)
7713f68772 [hal] Use atomic rather then mutex for DS Data updates (#4787)
701995d6cc [examples] Update Command-based starter project (#4778)
bf7068ac27 [wpilibc] Add missing PPS implementation for C++ (#4821)
aae0f52ca6 [ntcore] NetworkTable: fix visibility of get/set value (#4820)
ee02fb7ba7 [hal] Add support for Pulse-Per-Second signal (#4819)
518916ba02 [wpilib] Fix DS mode thread event being manual reset accidentally (#4818)
3997c6635b [hal] Update to new image, use new TCP notify callback and new duty cycle API (#4774)
cc8675a4e5 [examples] Add comment on how to view elevator sim (NFC) (#4482)
fb2c170b6e [ntcore] Simplify local startup (#4803)
7ba8a9ee1f [wpimath] ProfiledPIDController: Add to SendableRegistry (#4656)
c569d8e523 [wpilib] Joystick.getMagnitude(): use hypot() function (#4816)
2a5e89fa97 [apriltag] Improve description of pose coordinates (NFC) (#4810)
cc003c6c38 [apriltag] Fix AprilTagFieldLayout JSON name (#4814)
5522916123 [commands] CommandXBoxController bumper documentation fix (NFC) (#4815)
967b30de3a [glass] Fix NT view UpdateClients() bug (#4808)
3270d4fc86 [wpimath] Rewrite pose estimator docs (#4807)
be39678447 [apriltag] Add test to ensure apriltagjni loads (#4805)
61c75deb2a [commands] Test no-op behavior of scheduling a scheduled command (#4806)
a865f48e96 [ntcore] Pass pub/sub options as a unified PubSubOptions struct (#4794)
f66a667321 [commands] Fix incorrect Trigger docs (NFC) (#4792)
f8d4e9866e [ntcore] Clean up ntcore_test.h (#4804)
7e84ea891f [wpimath] Fix ComputerVisionUtil transform example in parameter docs (NFC) (#4800)
da3ec1be10 [wpimath] Change terminology for ArmFeedforward gravity gain (NFC) (#4791)
944dd7265d [wpilibc] Add C++ Notifier error handling, update java notifier error message (#4795)
6948cea67a [wpiutil] Fix MemoryBuffer initialization (#4797)
a31459bce6 [wpiutil] Fix UnescapeCString overflow when inputSize < 2 (#4796)
4a0ad6b48c [wpimath] Rotation2d: Add reference to angleModulus in docs (NFC) (#4786)
e6552d272e [ntcore] Remove table multi-subscriber (#4789)
bde383f763 [hal] Replace const char* with std::string_view in Driver Station sim functions (#4532)
5a52b51443 [hal] Add RobotController.getSerialNumber() (#4783)
69a66ec5ec [wpilib] Fix multiple motor safety issues (#4784)
989c9fb29a [wpimath] Revert Rotation2D change that limits angles (#4781)
0f5b08ec69 [wpigui] Update imgui to 1.89.1+ (#4780)
fba191099c [examples] AddressableLED: Add unit test (#4779)
b390cad095 [wpilibj] Consistently use ErrorMessages.requireNonNullParam (#4776)
b9772214d9 [wpilib] Sendable: Don't call setter for getter changes
342c375a71 [ntcore] Add subscriber option to exclude single publisher
b0e4053087 [ntcore] Use int for options instead of double
f3e666b7bb [cscore] Convert YUYV and UYVY directly to grayscale (#4777)
b300518bd1 [hal] Add CAN Stream API to Java through JNI bindings (#4193)
be27171236 [wpilibj] Shuffleboard: Check for null sendable (#4772)
4bbdbdfb48 [commands] Move GroupedCommands to CommandScheduler (#4728)
f18fd41ac3 [wpimath] Remove broken and obsoleted ComputerVisionUtil functions (#4775)
2d0faecf4f [glass] DataSource: Add spinlock to protect value (#4771)
348bd107fc [hal] Add CANManufacturer for The Thrifty Bot (#4773)
3149dc64b8 [examples] HatchbotInlined: Use Subsystem factories (#4765)
8618dd4160 [glass, wpilib] Replace remaining references to Speed Controller with Motor Controller (#4769)
72e21a1ed1 [apriltag] Use wpilibsuite fork of apriltag (#4764)
eab0d929e6 [commands] CommandGenericHID POV methods: Fix docs (NFC) (#4760)
6789869663 [wpilib] Call set(0) rather than disable for stopMotor (#4763)
c9dea2968d [cscore] Emit warning that USB Camera isn't supported on OSX (#4766)
8f402645f5 [commands] Fix PIDSubsystem setSetpoint behavior (#4759)
f24ad1d715 [build] Upgrade to googletest 1.12.1 (#4752)
ff88756864 [wpimath] Add new DCMotor functions for alternative calculations and reduction calculation (#4749)
f58873db8e [wpimath] Remove extra terms in matrix for pose estimator docs (#4756)
37e969b41a [wpimath] Add constructors to pose estimators with default standard deviations (#4754)
13cdc29382 [ci] Rename comment command from "/wpiformat" to "/format" (#4755)
6e23985ae6 [examples] Add main include directory to test builds (#4751)
66bb0ffb2c [examples] Add unit testing infrastructure (#4646)
74cc86c4c5 [wpimath] Make transform tests use pose/transform equality operators (#4675)
e22d8cc343 [wpimath] Use Odometry for internal state in Pose Estimation (#4668)
68dba92630 [ci] Update mac and windows builds to Java 17 (#4750)
23bfc2d9ab [sim] Remove unmaintained Gazebo support (#4736)
1f1461e254 [wpilib] Add method to enable/disable LiveWindow in test mode (#4678)
eae68fc165 [wpimath] Add tolerance for Rotation3d rotation matrix special orthogonality (#4744)
4c4545fb4b [apriltag] Suppress warning (#4743)
16ffaa754d [docs] Generate docs for apriltag subproject (#4745)
5e74ff26d8 [apriltag, build] Update native utils, add apriltag impl and JNI (#4733)
53875419a1 [hal] Allow overriding stderr printing by HAL_SendError (#4742)
aa6499e920 [ntcore] Fix special topic multi-subscriber handling (#4740)
df70351107 [build] Fix cmake install of thirdparty includes (#4741)
e9bd50ff9b [glass] NT view: clear meta-topic info on disconnect (#4732)
9b319fd56b [ntcore] Add sub option for local vs remote changes (#4731)
18d28ec5e3 [ntcore] Remove duplicate value checking from ClientImpl
bdfb625211 [ntcore] Send duplicate values to network if necessary
21003e34eb [commands] Update Subsystem factories and example to return CommandBase (#4729)
70080457d5 [commands] Refactor ProxyScheduleCommand, SelectCommand into ProxyCommand (#4534)
e82cd5147b [wpilib] Tweak Color HSV formula and use in AddressableLED (#4724)
ec124bb662 [commands] Allow unsetting a subsystem's default command (#4621)
2b2aa8eef7 [examples] Update all examples to use NWU coordinate conventions (#4725)
cb38bacfe8 [commands] Revert to original Trigger implementation (#4673)
15561338d5 [commands] Remove one more default command isFinished check (#4727)
ca35a2e097 Add simgui files to .gitignore (#4726)
20dbae0cee [examples] Renovate command-based examples (#4409)
1a59737f40 [commands] Add convenience factories (#4460)
42b6d4e3f7 Use defaulted comparison operators in C++ (#4723)
135c13958f [wpigui] Add FontAwesome (#4713)
ffbfc61532 [ntcore] Add NetworkTable table-specific listeners (#4640)
8958b2a4da [commands] Add property tests for command compositions (#4715)
e4ac09077c [wpilib] Add link to MotorSafety article (#4720)
f40de0c120 [commands] Add C++ factory templates (#4686)
51fa3e851f [build] cmake: Use FetchContent instead of ExternalProject (#4714)
1da84b2255 [wpigui] Reload fonts to scale rather than preloading (#4712)
e43e2fbc84 [wpiutil] StringExtras: Add UnescapeCString (#4707)
5804d8fa84 [ntcore] Server: Properly handle multiple subscribers (#4717)
169ef5fabf [glass] Update NT view for topicsOnly and sendAll changes (#4718)
148759ef54 [examples] CANPDP: Expand properties shown (#4687)
58ed112b51 [commands] RepeatCommand: restart on following iteration (#4706)
dd1da77d20 [readme] Fix broken CI badge (#4710)
7cda85df20 [build] Check Gradle plugin repo last to fix CI (#4711)
7ed9b13277 [build] Bump version plugin to fix null tag (#4705)
6b4f26225d [apriltag] Fix pluralization of apriltag artifacts (#4671)
b2d2924b72 [cscore] Add Y16 image support (#4702)
34ec89c041 [wpilibc] Shuffleboard SimpleWidget: Return pointer instead of reference (#4703)
e15200068d [ci] Disable HW testbench runs (#4704)
d5200db6cd [wpimath] Rename HolonomicDriveController.calculate params (#4683)
2ee3d86de4 [wpimath] Clarify Rotation3d roll-pitch-yaw direction (#4699)
9f0a8b930f [cscore] Use MFVideoFormat_L8 for Gray on Windows (#4701)
2bca43779e [cscore] Add UYVY image support (#4700)
4307d0ee8b [glass] Plot: allow for more than 11 plots (#4685)
3fe8d355a1 [examples] StateSpaceDifferentialDriveSimulation: Use encoder reversed constants (#4682)
b44034dadc [ntcore] Allow duplicate client IDs on server (#4676)
52d2c53888 [commands] Rename Java factory wait() to waitSeconds() (#4684)
76e918f71e [build] Fix JNI artifacts linking to incorrect libraries (#4680)
0bee875aff [commands] Change C++ CommandPtr to use CommandBase (#4677)
98e922313b [glass] Don't check IsConnected for NT widgets (#4674)
9a36373b8f [apriltag] Switch 2022 apriltag layout length and width values (#4670)
cf8faa9e67 [wpilib] Update values on controllable sendables (#4667)
5ec067c1f8 [ntcore] Implement keep duplicates pub/sub flag (#4666)
e962fd2916 [ntcore] Allow numeric-compatible value sets (#4620)
88bd67e7de [ci] Update clang repositories to jammy (#4665)
902e8686d3 [wpimath] Rework odometry APIs to improve feature parity (#4645)
e2d49181da Update to native utils 2023.8.0 (#4664)
149bac55b1 [cscore] Add Arducam OV9281 exposure quirk (#4663)
88f7a3ccb9 [wpimath] Fix Pose relativeTo documentation (#4661)
8acce443f0 [examples] Fix swerve examples to use getDistance for turning encoder (#4652)
295a1f8f3b [ntcore] Fix WaitForListenerQueue (#4662)
388e7a4265 [ntcore] Provide mechanism to reset internals of NT instance (#4653)
13aceea8dc [apriltag] Fix FieldDimensions argument order (#4659)
c203f3f0a9 [apriltag] Fix documentation for AprilTagFieldLayout (#4657)
f54d495c90 Fix non initialized hal functionality during motor safety init (#4658)
e6392a1570 [cmd] Change factories return type to CommandBase (#4655)
53904e7cf4 [apriltag] Split AprilTag functionality to a separate library (#4578)
2e88a496c2 [wpimath] Add support for swerve joystick normalization (#4516)
ce4c45df13 [wpimath] Rework function signatures for Pose Estimation / Odometry (#4642)
0401597d3b [readme] Add wpinet to MavenArtifacts.md (#4651)
2e5f9e45bb [wpimath] Remove encoder reset comments on Swerve, Mecanum Odometry and Pose Estimation (#4643)
e4b5795fc7 [docs] Disable Doxygen for memory to fix search (#4636)
03d0ea188c [build] cmake: Add missing wpinet to installed config file (#4637)
3082bd236b [build] Move version file to its own source set (#4638)
b7ca860417 [build] Use build cache for sign step (#4635)
64838e6367 [commands] Remove unsafe default command isFinished check (#4411)
1269d2b901 [myRobot] Disable spotbugs (#4565)
14d8506b72 [wpimath] Fix units docs for LinearSystemId::IdentifyDrivetrainSystem() (#4600)
d1d458db2b [wpimath] Constrain Rotation2d range to -pi to pi (#4611)
f656e99245 [readme] Add links to development build documentation (#4481)
6dd937cef7 [commands] Fix Trigger API docs (NFC) (#4599)
49047c85b9 [commands] Report error on C++ CommandPtr use-after-move (#4575)
d07267fed1 [ci] Upgrade containers to Ubuntu 22.04 and remove libclang installation (#4633)
b53ce1d3f0 [build, wpiutil] Switch macos to universal binaries (#4628)
5a320c326b [upstream_util, wpiutil] Refactor python scripts (#4614)
c4e526d315 [glass] Fix NT Mechanism2D (#4626)
d122e4254f [ci] Run spotlessApply after wpiformat in comment command (#4623)
5a1e7ea036 [wpilibj] FieldObject2d: Add null check to close() (#4619)
179f569113 [ntcore] Notify locally on SetDefault (#4617)
b0f6dc199d [wpilibc] ShuffleboardComponent.WithProperties: Update type (#4615)
7836f661cd [wpimath] Add missing open curly brace to units/base.h (#4613)
dbcc1de37f [wpimath] Add DifferentialDriveFeedforward classes which wrap LinearPlantInversionFeedforward (#4598)
93890c528b [wpimath] Add additional angular acceleration units (#4610)
3d8d5936f9 [wpimath] Add macro for disabling units fmt support (#4609)
2b04159dec [wpimath] Update units/base.h license header (#4608)
2764004fad [wpinet] Fix incorrect jni definitions (#4605)
85f1bb8f2b [wpiutil] Reenable jni check task (#4606)
231ae2c353 [glass] Plot: Fix Y-axis not being saved (#4594)
e92b6dd5f9 [wpilib] Fix AprilTagFieldLayout JSON property name typos (#4597)
2a8e0e1cc8 Update all dependencies that use grgit (#4596)
7d06e517e9 [commands] Move SelectCommand factory impl to header (#4581)
323524fed6 [wpimath] Remove deprecated units/units.h header (#4572)
d426873ed1 [commands] Add missing PS4 triangle methods (#4576)
5be5869b2f [apriltags] Use map as internal data model (#4577)
b1b4c1e9e7 [wpimath] Fix Pose3d transformBy rotation type (#4545)
a4054d702f [commands] Allow composing two triggers directly (#4580)
0190301e09 [wpilibc] Explicitly mark EventLoop as non-copyable/non-movable (#4579)
9d1ce6a6d9 [ntcore] Catch file open error when saving preferences (#4571)
5005e2ca04 [ntcore] Change Java event mask to EnumSet (#4564)
fa44a07938 [upstream-utils][mpack] Add upstream util for mpack (#4500)
4ba16db645 [ntcore] Various fixes and cleanups (#4544)
837415abfd [hal] Fix joysticks either crashing or returning 0 (#4570)
2c20fd0d09 [wpilib] SingleJointedArmSim: Check angle equals limit on wouldHit (#4567)
64a7136e08 [wpimath] SwerveDrivePoseEstimator: Restore comment about encoder reset (#4569)
b2b473b24a [wpilib] Add AprilTag and AprilTagFieldLayout (#4421)
7aab8fa93a [build] Update to Native Utils 2023.6.0 (#4563)
12c2851856 [commands] WrapperCommand: inherit from CommandBase (#4561)
0da169dd84 [wpimath] Remove template argument from ElevatorFeedforward (#4554)
2416827c25 [wpimath] Fix docs for pose estimator local measurement models (#4558)
1177a3522e [wpilib] Fix Xbox/PS4 POV sim for port number constructors (#4548)
102344e27a [commands] HID classes: Add missing methods, tweak return types (#4557)
1831ef3e19 [wpilib] Fix Shuffleboard SuppliedValueWidget (#4559)
a9606ce870 [wpilib] Fix Xbox/PS4 POV sim (#4546)
6c80d5eab3 [wpimath] Remove unused SymbolExports.h include from units/base.h (#4541)
b114006543 [ntcore] Unify listeners (#4536)
32fbfb7da6 [build] cmake: Install ntcore generated include files (#4540)
02465920fb [build] Update native utils to 2023.4.0 (#4539)
3a5a376465 [wpimath] Increase constexpr support in geometry data types (#4231)
1c3c86e9f1 [ntcore] Cache GetEntry(name) values (#4531)
dcda09f90a [command] Rename trigger methods (#4210)
66157397c1 [wpilib] Make drive classes follow NWU axes convention (#4079)
9e22ffbebf [ntcore] Fix null deref in NT3 client (#4530)
648ab6115c [wpigui,dlt,glass,ov] Support arm in GUI tools (#4527)
8bc3b04f5b [wpimath] Make ComputerVisionUtil use 3D geometry classes (#4528)
cfb84a6083 [wpilibc] Don't hang waiting for NT server to start (#4524)
02c47726e1 [wpimath] Remove unused odometry instance from DifferentialDrivePoseEstimator test (#4522)
b2a0093294 [ci] Revert upgrade of github-pages-deploy-action (#4521)
2a98d6b5d7 [wpimath] PIDController: Add getters for position & velocity tolerances (#4458)
9f36301dc8 [ci] Write wpiformat patch to job summary (#4519)
901fc555f4 [wpimath] Position Delta Odometry for Mecanum (#4514)
4170ec6107 [wpimath] Position Delta Odometry for Swerve (#4493)
fe400f68c5 [docs] Add wpinet to docs build (#4517)
794669b346 [ntcore] Revamp listeners (#4511)
dcfa85a5d5 [ci] Build sanitizers with clang-14 (#4518)
15ad855f1d [ntcore] Add UnitTopic<T> (C++ only) (#4497)
11244a49d9 [wpilib] Add IsConnected function to all gyros (#4465)
1d2e8eb153 [build] Update myRobot deployment (#4515)
ad53fb19b4 [hal] Use new HMB api for addressable LED (#4479)
ba850bac3b [hal] Add more shutdown checks and motor safety shutdown (#4510)
023a5989f8 [ntcore] Fix typo in NetworkServer client connect message (#4512)
c970011ccc [docs] Add Doxygen aliases used by Foonathan memory (#4509)
07a43c3d9a [readme] Document clang-format version and /wpiformat (#4503)
a05b212b04 [ci] Revert changes to wpiformat task from #4501 (#4508)
09faf31b67 [commands] Replace Command HID inheritance with delegation (#4470)
9e1f9c1133 [commands] Add command factories (#4476)
f19d2b9b84 [ci] Add NUMBER environment variable to comment command commit script (#4507)
a28f93863c [ci] Push comment command commit directly to PR (#4506)
c9f61669b8 [ci] Fix comment command commit push (#4505)
dcce5ad3b3 [ci] Update github-script API usage (#4504)
6836e5923d [wpilibc] Restore get duty cycle scale factor (#4502)
335188c652 [dlt] Add deselect/select all buttons to download view (#4499)
60a29dcb99 [glass] Field2D: Add "hidden" option for objects (#4498)
b55d5b3034 [ci] Update deprecated github actions (#4501)
10ed4b3969 [ntcore] Various NT4 fixes (#4474)
4a401b89d7 [hal, wpilib] New DS thread model and implementation (#3787)
c195b4fc46 [wpimath] Clean up PoseEstimator nominal dt docs (#4496)
8f2e34c6a3 [build] Remove wpilib prefix from CMake flat install (#4492)
150d692df7 [wpimath] Remove unused private PoseEstimator function (#4495)
3e5bfff1b5 [wpimath] FromFieldRelativeSpeeds: Add ChassisSpeeds overload (#4494)
9c7e66a27d [commands] C++: Add CommandPtr overload for SetDefaultCommand (#4488)
0ca274866b [build] Fix CMake system library opt-ins (#4487)
dc037f8d41 [commands] Remove EndlessCommand (#4483)
16cdc741cf [wpimath] Add Pose3d(Pose2d) constructor (#4485)
9d5055176d [build] cmake: Allow disabling ntcore build (#4486)
d1e66e1296 [build] Compile all java code with inline string concatenation (#4490)
1fc098e696 Enable log macros to work with no args (#4475)
878cc8defb [wpilib] LiveWindow: Add enableAllTelemetry() (#4480)
8153911160 [build] Fix MSVC runtime archiver to grab default runtime (#4478)
fbdc810887 Upgrade to C++20 (#4239)
396143004c [ntcore] Add ntcoreffi binary (#4471)
1f45732700 [build] Update to 2023.2.4 native-utils and new dependencies (#4473)
574cb41c18 [ntcore] Various fixes (#4469)
d9d6c425e7 [build] Force Java 11 source compatibility (#4472)
58b6484dbe Switch away from NI interrupt manager to custom implementation (#3705)
ca43fe2798 [wpimath] Use Units conversions in ComputerVisionUtil docs (NFC) (#4464)
87a64ccedc [hal] Convert DutyCycle Raw output to be a high time measurement (#4466)
89a3d00297 [commands] Add FinallyDo and HandleInterrupt decorators (#4412)
1497665f96 [commands] Add C++ versions of Java-only decorators (#4457)
27b173374e [wpimath] Add minLinearAccel parameter to DifferentialDriveAccelerationLimiter (#4422)
2a13dba8ac [wpilib] TrajectoryUtil: Fix ambiguous documentation (NFC) (#4461)
77301b126c [ntcore] NetworkTables 4 (#3217)
90cfa00115 [build] cmake: Fix libssh include directory order (#4459)
5cf961edb9 [commands] Refactor lambda-based commands to inherit FunctionalCommand (#4451)
b2276e47de [wpimath] Enable continuous angle input for HolonomicDriveController (#4453)
893b46139a [fieldImages] Add utilities to simplify loading of fields (#4456)
60e29627c0 [commands] C++ unique_ptr migration (#4319)
3b81cf6c35 [wpilib] Improve Color.toString (#4450)
5c067d30a0 [wpinet] WebSocket: Add SendFrames() (#4445)
ceaf493811 [wpiutil] MakeJByteArray: Use span<uint8> instead of string_view (#4446)
10e04e2b13 [examples] FrisbeeBot: Fix reference capture (#4449)
726f67c64b [build] Add exeSplitSetup (#4444)
c7b7624c1c [wpiutil] Add MessagePack utility functions (#4448)
d600529ec0 [wpinet] uv::Async: Add UnsafeSend() (#4447)
b53b3526a2 [wpimath] Add CoordinateSystem conversion for Transform3d (#4443)
38bb23eb18 [wpimath] Add scalar multiply and divide operators to all geometry classes (#4438)
3937ff8221 [wpilib] Remove deprecated Controller class (#4440)
abbfe244b5 [wpilib] Improve Color FromHSV (#4439)
4ddb8aa0dd [sim] Provide function that resets all simulation data (#4016)
a791470de7 Clean up Java warning suppressions (#4433)
17f504f548 [hal,wpilib] Fix SPI Mode Setting (#4434)
773198537c [wpiutil] Add wpi::scope_exit (#4432)
5ac658c8f0 [wpiutil] Logger: Conditionalize around WPI_LOG (#4431)
8767e4a941 [wpiutil] DataLog: Fix SetMetadata output (#4430)
8c4af073f4 [wpiutil] Synchronization: shutdown race protection (#4429)
c79f38584a [build] Fix Java integration tests (#4428)
36c08dd97c [build] Fix cmake install of fmtlib (#4426)
69b7b3dd7d [ci] Remove the Windows cmake job (#4425)
738c75fed8 [readme] Fix formatting/linting link (#4423)
4eb1d03fb3 [wpimath] Document C++ LinearFilter exception (#4417)
ba4ec6c967 [build] Fix clang-tidy false positive on Linux (#4406)
97836f0e55 [commands] Fix ProfiledPIDSubsystem setGoal behavior (#4414)
fdfb85f695 [wpimath] Remove Java LQR constructor that takes a controller gain matrix (#4419)
ab1baf4832 [wpimath] Add rotation matrix constructor to Rotation3d (#4413)
9730032866 [wpimath] Document LQR and KalmanFilter exceptions (#4418)
5b656eecf6 [wpimath] Fix HTML5 entity (#4420)
9ae38eaa7c [commands] Add owning overload to ProxyScheduleCommand (#4405)
cb33bd71df [commands] deprecate withInterrupt decorator (#4407)
d9b4e7b8bf [commands] Revert "Change grouping decorator impl to flatten nested group structures (#3335)" (#4402)
0389bf5214 [hal] REVPH: Improve handling of disconnected CAN Bus (#4169)
4267fa08d1 [wpilibc] ADIS IMUs: Fix memory leak (#4170)
65c8fbd452 [wpilib] MotorControllerGroup: Override setVoltage (#4403)
f36162fddc [wpimath] Improve Discretization internal docs (#4400)
5149f7d894 [wpimath] Add two-vector Rotation3d constructor (#4398)
20b5bed1cb [wpimath] Clean up Java Quaternion class (#4399)
f18dd1905d [build] Include all thirdparty sources in distribution (#4397)
aa9d7f1cdc [wpiutil] Import foonathan memory (#4306)
2742662254 [ci] Remove a couple of obsolete clang-tidy checks (#4396)
a5df391166 [hal, wpilib] Fix up DIO pulse API (#4387)
59e6706b75 [glass] Turn on docking by default
8461bb1e03 [glass] Add support for saving docking info
b873e208b4 [wpigui] Add support for imgui config flags
873e72df8c [build] Update imgui to 1.88 docking branch
c8bd6fc5b4 [ci] Fix comment-command (take 2) (#4395)
fed68b83b4 [ci] Fix comment-command action not running runners (#4393)
0ef8a4e1df [wpimath] Support formatting more Eigen types (#4391)
c393b3b367 [build] Update to native utils 2023.1.0 and Gradle 7.5.1 (#4392)
b5a17f762c [wpimath] Add direction to slew rate limiter (#4377)
fafc81ed1a [wpiutil] Upgrade to fmt 9.1.0 (#4389)
cc56bdc787 [wpiutil] SafeThread: Add Synchronization object variant (#4382)
4254438d8d [commands] Mark command group lifecycle methods as final (#4385)
97c15af238 [wpimath] LinearSystemId: Fix docs, move C++ impls out of header (#4388)
d22ff8a158 [wpiutil] Add JNI access to C++ stderr (#4381)
fdb5a2791f [wpiutil] jni_util: Add Mac-friendly MakeJLongArray/JArrayRef (#4383)
c3a93fb995 [commands] Revamp Interruptible (#4192)
f2a8d38d2a [commands] Rename Command.repeat to repeatedly (#4379)
9e24c6eac0 [wpiutil] Logger: paren-protect instance usage in macro (#4384)
fe4d12ce22 [wpimath] Add LTV controller derivations and make enums private (#4380)
eb08486039 [build] Fix MacOS binary rpath generation (#4376)
ccf83c634a [build] Use native-utils platform names instead of raw strings (#4375)
3fd69749e7 [docs] Upgrade to doxygen 1.9.4 (#4370)
594df5fc08 [wpinet] uv/util.h: Pull in ws2_32.lib on Windows for ntohs (#4371)
539070820d [ci] Enable asan for wpinet and wpiutil (#4369)
564a56d99b [wpinet] Fix memory leak in WorkerThreadTest (#4368)
5adf50d93c [upstream_utils] Refactor upstream_utils scripts (#4367)
d80e8039d7 [wpiutil] Suppress fmtlib clang-tidy warning in C++20 consteval contexts (#4364)
0e6d67b23b [upstream_utils] Remove yapf format disable comment (#4366)
be5270697a [build] Suppress enum-enum deprecation warning in OpenCV (#4365)
8d28851263 Add Rosetta install command to build requirements (#4363)
3d2115c93e [wpinet] include-what-you-use in MulticastTest (#4360)
91002ae3cc [wpimath] Upgrade to Drake 1.6.0 (#4361)
148c18e658 [wpinet] Upgrade to libuv 1.44.2 (#4362)
a2a5c926b6 Fix clang-tidy warnings (#4359)
ea6b1d8449 [wpiutil] Remove unused ManagedStatic class (#4358)
ac9be78e27 Use stricter C++ type conversions (#4357)
151dabb2af [wpiutil] Upgrade to fmt 9.0.0 (#4337)
340465c929 [ci] Upgrade to clang-format and clang-tidy 14 (NFC) (#4347)
d45bcddd15 [examples] Add comments to StateSpaceDifferentialDrive (#4341)
0e0786331a Update LLVM libraries to 14.0.6 (#4350)
c5db23f296 [wpimath] Add Eigen sparse matrix and iterative solver support (#4349)
44abc8dfa6 [upstream_utils] Remove git version from upstream patches (#4351)
3fdb2f767d [wpimath] Add comments with Ramsete equations (#4348)
0485f05da9 [wpilibjExamples] Upgrade jacoco to match allwpilib (#4346)
0a5eb65231 [wpinet] Handle empty txt block for mdns announcer (#4072)
19ffebaf3e [wpilib] Add reference to I2C Lockup to API Docs (NFC) (#4340)
ce1a90d639 [hal] Replace SerialHelper "goto done" with continue (#4342)
d25af48797 [ci] Make upstream_utils CI fail on untracked files (#4339)
ebb836dacb [examples] Fix negations in event loop examples (#4334)
d83e202f00 [upstream_utils] Update paths in update_fmt.py (#4338)
3ccf806064 [wpimath] Remove redundant LinearFilter.finiteDifference() argument (#4335)
6f1e01f8bd [wpimath] Document example of online filtering for LinearFilter.finiteDifference() (#4336)
1023c34b1c [readme] Update location of ni-libraries (#4333)
faa29d596c [wpilib] Improve Notifier docs (NFC) (#4326)
add00a96ed [wpimath] Improve DifferentialDriveAccelerationLimiter docs (NFC) (#4323)
82fac41244 [wpimath] Better document trackwidth parameters (NFC) (#4324)
5eb44e22a9 Format Python scripts with black (NFC) (#4325)
2e09fa7325 [build] Fix mpack cmake (#4322)
fe3c24b1ee [command] Add ignoringDisable decorator (#4305)
aa221597bc [build] Add M1 builds, change arm name, update to 2023 deps (#4315)
579a8ee229 [ci] Use one worker for Windows release Gradle build (#4318)
5105c5eab6 [wpilibj] Change "final" to "exit" in the IterativeRobotBase JavaDoc (NFC) (#4317)
787fe6e7a5 [wpiutil] Separate third party libraries (#4190)
6671f8d099 [wpigui] Update portable file dialogs (#4316)
9ac9b69aa2 [command] Reorder Scheduler operations (#4261)
e61028cb18 [build] halsim_gui: Add wpinet dependency (#4313)
661d23eaf5 [glass] Add precision setting for NetworkTable view (#4311)
666040e3e5 [hal] Throw exceptions for invalid sizes in I2C and SPI JNI (#4312)
aebc272449 [build] Upgrade to spotbugs Gradle plugin 5.0.8 (#4310)
fd884581e4 [wpilib] Add BooleanEvent/Trigger factories on HID classes (#4247)
9b1bf5c7f1 [wpimath] Move Drake and Eigen to thirdparty folders (#4307)
c9e620a920 [wpilibc] Change EventLoop data structure to vector (#4304)
41d40dd62f [wpinet] Fix libuv unused variable warning on Mac (#4299)
30f5b68264 [wpinet] Fix JNI loading error (#4295)
f7b3f4b90e [examples] Getting Started: Change Joystick to XboxController (#4194)
a99c11c14c [wpimath] Replace UKF implementation with square root form (#4168)
45b7fc445b [wpilib] Add EventLoop (#4104)
16a4888c52 [wpilib] Default off LiveWindow telemetry (#4301)
17752f1337 [ci] Split debug and release Windows builds (#4277)
abb45a68db [commands] Remove custom test wrappers (#4296)
1280a54ef3 [upstream_utils]: Make work with Python 3.8 (#4298)
f2d243fa68 [build] Change defaults for Java lints (#4300)
a4787130f4 Update using development build to work with 2023 gradlerio (#4294)
af7985e46c [wpiutil] Use invoke_result_t instead of result_of in future.h (#4293)
e9d1b5c2d0 [hal] Remove deprecated SimDevice functions (#4209)
45b598d236 [wpilibj] Add toString() methods to Color and Color8Bit (#4286)
fc37265da5 [wpimath] Add angle measurement convention to ArmFeedforward docs (NFC) (#4285)
a4ec13eb0e [wpilibjexamples] Remove unnecessary voltage desaturation
2fa52007af [wpilibc] Use GetBatteryVoltage() in MotorController::SetVoltage
d9f9cd1140 [wpimath] Reset prev_time on pose estimator reset (#4283)
8b6df88783 [wpilibj] Tachometer.getFrequency(): Fix bug (#4281)
345cff08c0 [wpiutil] Make wpi::array constexpr (#4278)
57428112ac [wpimath] Upgrade to Drake v1.3.0 (#4279)
a18d4ff154 [build] Fix tools not being copied when built with -Ponly* (#4276)
d1cd07b9f3 [wpigui] Add OpenURL (#4273)
e67f8e917a [glass] Use glfwSetKeyCallback for Enter key remap (#4275)
be2fedfe50 [wpimath] Add stdexcept include for std::invalid_argument (IWYU) (#4274)
7ad2be172e [build] Update native-utils to 2023.0.1 (#4272)
abc605c9c9 [ci] Update workflows to 20.04 base image (#4271)
3e94805220 [wpiutil] Reduce llvm collections patches (#4268)
db2e1d170e [upstream_utils] Document how to update thirdparty libraries (#4253)
96ebdcaf16 [wpimath] Remove unused Eigen AutoDiff module (#4267)
553b2a3b12 [upstream_utils] Fix stackwalker (#4265)
3e13ef42eb [wpilibc] Add missing std::array #include (include-what-you-use) (#4266)
d651a1fcec Fix internal deprecation warnings (#4257)
b193b318c1 [commands] Add unless() decorator (#4244)
ef3714223b [commands] Remove docs reference to obsolete interrupted() method (NFC) (#4262)
3d8dbbbac3 [readme] Add quickstart (#4225)
013efdde25 [wpinet] Wrap a number of newer libuv features (#4260)
816aa4e465 [wpilib] Add Pneumatics sim classes (#4033)
046c2c8972 [wpilibc] Rename SpeedControllerGroupTest.cpp (#4258)
d80e9cdf64 [upstream_utils] Use shallow clones for thirdparty repos (#4255)
7576136b4a [upstream_utils] Make update_llvm.py executable (#4254)
c3b223ce60 [wpiutil] Vendor llvm and update to 13.0.0 (#4224)
5aa67f56e6 [wpimath] Clean up math comments (#4252)
fff4d1f44e [wpimath] Extend Eigen warning suppression to GCC 12 (#4251)
0d9956273c [wpimath] Add CoordinateSystem.convert() translation and rotation overloads (#4227)
3fada4e0b4 [wpinet] Update to libuv 1.44.1 (#4232)
65b23ac45e [wpilibc] Fix return value of DriverStation::GetJoystickAxisType() (#4230)
4ac34c0141 [upstream_utils] Cleanup update_libuv.py (#4249)
8bd614bb1e [upstream_utils] Use "git am" instead of "git apply" for patches (#4248)
4253d6d5f0 [upstream_utils] Apply "git am" patches individually (#4250)
6a4752dcdc Fix GCC 12.1 warning false positives (#4246)
5876b40f08 [wpimath] Memoize CoordinateSystem and CoordinateAxis statics (#4241)
5983434a70 [cameraserver] Replace IterativeRobot in comment sample code with TimedRobot (#4238)
a3d44a1e69 [wpimath] Add Translation2d.getAngle() (#4217)
d364bbd5a7 [upstream_utils] Give vendor update scripts execute permissions (#4226)
f341e1b2be [wpimath] Document standard coordinate systems better (NFC) (#4228)
9af389b200 [wpinet] AddrToName: Initialize name (#4229)
2ae4adf2d7 [ci] Add wpiformat command to PRs (#4223)
178b2a1e88 Contributing.md: Correct version of clang-format used (#4222)
18db343cdc [wpiutil, wpinet] Vendor libuv, stack walker (#4219)
f0c821282a [build] Use artifactory mirror (#4220)
d673ead481 [wpinet] Move network portions of wpiutil into new wpinet library (#4077)
b33715db15 [wpimath] Add CoordinateSystem class (#4214)
99424ad562 [sim] Allow creating a PWMSim object from a PWMMotorController (#4039)
dc6f641fd2 [wpimath] PIDController: Reset position and velocity error when reset() is called. (#4064)
f20a20f3f1 [wpimath] Add 3D geometry classes (#4175)
708a4bc3bc [wpimath] Conserve previously calculated swerve module angles when updating states for stationary ChassisSpeeds (#4208)
ef7ed21a9d [wpimath] Improve accuracy of ComputerVisionUtil.calculateDistanceToTarget() (#4215)
b1abf455c1 [wpimath] LTVUnicycleController: Use LUT, provide default hyperparameters (#4213)
d5456cf278 [wpimath] LTVDifferentialDriveController: Remove unused variable (#4212)
99343d40ba [command] Remove old command-based framework (#4211)
ee03a7ad3b Remove most 2022 deprecations (#4205)
ce1a7d698a [wpimath] Refactor WheelVoltages inner class to a separate file (#4203)
87bf70fa8e [wpimath] Add LTV controllers (#4094)
ebd2a303bf [wpimath] Remove deprecated MakeMatrix() function (#4202)
e28776d361 [wpimath] LinearSystemLoop: Add extern templates for common cases
dac1429aa9 [wpimath] LQR: Use extern template instead of Impl class
e767605e94 [wpimath] Add typedefs for common types
97c493241f [wpimath] UnscentedKalmanFilter: Move implementation out-of-line
8ea90d8bc9 [wpimath] ExtendedKalmanFilter: Move implementation out-of-line
ae7b1851ec [wpimath] KalmanFilter: Use extern template instead of Impl class
e3d62c22d3 [wpimath] Add extern templates for common cases
7200c4951d [wpiutil] SymbolExports: Add WPILIB_IMPORTS for dllimport
84056c9347 [wpiutil] SymbolExports: Add EXPORT_TEMPLATE_DECLARE/DEFINE
09cf6eeecb [wpimath] ApplyDeadband: add a scale param (#3865)
03230fc842 [build,ci] Enable artifactory build cache (#4200)
63cf3aaa3f [examples] Don't square ArcadeDrive inputs in auto (#4201)
18ff694f02 [wpimath] Add Rotation2d.fromRadians factory (#4178)
4f79ceedd9 [wpilibc] Add missing #include (#4198)
f7ca72fb41 [command] Rename PerpetualCommand to EndlessCommand (#4177)
a06b3f0307 [hal] Correct documentation on updateNotifierAlarm (#4156)
d926dd1610 [wpimath] Fix pose estimator performance (#4111)
51bc893bc5 [wpiutil] CircularBuffer: Change Java package-private methods to public (#4181)
fbe761f7f6 [build] Increase Gradle JVM heap size (#4172)
5ebe911933 [wpimath] Add DifferentialDriveAccelerationLimiter (#4091)
3919250da2 [wpilibj] Remove finalizers (#4158)
b3aee28388 [commands] Allow BooleanSupplier for Trigger operations (#4103)
9d20ab3024 [wpilib] Allow disabling ElevatorSim gravity (#4145)
aaa69f6717 [ci] Remove 32-bit Windows builds (#4078)
355a11a414 Update Java linters and fix new PMD errors (#4157)
ffc69d406c [examples] Reduce suggested acceleration in Ramsete example (#4171)
922d50079a [wpimath] Units: fix comment in degreesToRotations (NFC) (#4159)
dd163b62ae [wpimath] Rotation2d: Add factory method that uses rotations (#4166)
bd80e220b9 [ci] Upgrade CMake actions (#4161)
aef4b16d4c [wpimath] Remove unnecessary NOLINT in LinearPlantInversionFeedforward (NFC) (#4155)
975171609e [wpilib] Compressor: Rename enabled to isEnabled (#4147)
5bf46a9093 [wpimath] Add ComputerVisionUtil (#4124)
f27a1f9bfb [commands] Fix JoystickButton.getAsBoolean (#4131)
1b26e2d5da [commands] Add RepeatCommand (#4009)
88222daa3d [hal] Fix misspelling in AnalogInput/Output docs (NFC) (#4153)
81c5b41ce1 [wpilibj] Document MechanismLigament2d angle unit (NFC) (#4142)
9650e6733e [wpiutil] DataLog: Document finish and thread safety (NFC) (#4140)
c8905ec29a [wpimath] Remove ImplicitModelFollower dt argument (#4119)
b4620f01f9 [wpimath] Fix Rotation2d interpolation in Java (#4125)
2e462a19d3 [wpimath] Constexprify units unary operators (#4138)
069f932e59 [build] Fix gl3w cmake build (#4139)
126e3de91a [wpilibc] Remove unused SetPriority() call from Ultrasonic (#4123)
ba0dccaae4 [wpimath] Fix reference to Rotation2d.fromRadians() (#4118)
e1b6e5f212 [wpilib] Improve MotorSafety documentation (NFC) (#4120)
8d79dc8738 [wpimath] Add ImplicitModelFollower (#4056)
78108c2aba [wpimath] Fix PIDController having incorrect error after calling SetSetpoint() (#4070)
cdafc723fb [examples] Remove unused LinearPlantInversionFeedforward includes (#4069)
0d70884dce [wpimath] Add InterpolatedTreeMap (#4073)
765efa325e [wpimath] Remove redundant column index from vectors (#4116)
89ffcbbe41 [wpimath] Update TrapezoidProfile class name in comment (NFC) (#4107)
95ae23b0e7 [wpimath] Improve EKF numerical stability (#4093)
d5cb6fed67 [wpimath] Support zero cost entries in MakeCostMatrix() (#4100)
d0fef18378 [wpimath] Remove redundant `this.` from ExtendedKalmanFilter.java (#4115)
d640c0f41f [wpimath] Fix pose estimator local measurement standard deviation docs (NFC) (#4113)
a2fa5e3ff7 [wpilibc] BatterySim: Provide non-initializer list versions of Calculate (#4076)
a3eea9958e [hal] Add link to FRC CAN Spec (NFC) (#4086)
db27331d7b [wpilib] Update DifferentialDrive docs (NFC) (#4085)
fdfb31f164 [dlt] Export boolean[] values (#4082)
f93c3331b3 [wpigui] disable changing directory when initializing on MacOS (#4092)
ab7ac4fbb9 [build] Fix various warnings in cmake builds (#4081)
bc39a1a293 [wpilibc] Fix moved pneumatics objects not destructing properly (#4068)
2668130e70 [wpimath] Remove SwerveDrivePoseEstimator encoder reset warning (#4066)
d27ed3722b [ci] Set actions workflow concurrency (#4060)
dae18308c9 [wpimath] Minor fixes to Rotation2d docs (NFC) (#4055)
d66555e42f [datalogtool] Add datalogtool
9f52d8a3b1 [wpilib] DriverStation: Add DataLog support for modes and joystick data
757ea91932 [wpilib] Add DataLogManager
02a804f1c5 [ntcore] Add DataLog support
9b500df0d9 [wpiutil] Add high speed data logging
5a89575b3a [wpiutil] Import customized LLVM MemoryBuffer
b8c4d7527b [wpiutil] Add MappedFileRegion
ac5d46cfa7 [wpilibc] Fix ProfiledPID SetTolerance default velocity value (#4054)
bc9e96e86f [wpilib] Absolute Encoder API and behavior fixes (#4052)
f88c435dd0 [hal] Add mechanism to cancel all periodic callbacks (#4049)
Change-Id: I49aa5b08abbefc7a045e99e19d48ce2cd8fc4d1b
git-subtree-dir: third_party/allwpilib
git-subtree-split: 83f1860047c86aa3330fcb41caf3b2047e074804
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch b/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch
new file mode 100644
index 0000000..6965d0d
--- /dev/null
+++ b/upstream_utils/libuv_patches/0001-Fix-missing-casts.patch
@@ -0,0 +1,1533 @@
+From d5613423f057b088f6b3753f49162947d5559ad9 Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:01:25 -0400
+Subject: [PATCH 1/9] Fix missing casts
+
+---
+ include/uv/unix.h | 2 +-
+ src/fs-poll.c | 10 ++++-----
+ src/inet.c | 11 +++++-----
+ src/strscpy.c | 2 +-
+ src/threadpool.c | 2 +-
+ src/unix/bsd-ifaddrs.c | 2 +-
+ src/unix/core.c | 12 +++++-----
+ src/unix/darwin-proctitle.c | 5 +++--
+ src/unix/darwin.c | 2 +-
+ src/unix/epoll.c | 2 +-
+ src/unix/freebsd.c | 4 ++--
+ src/unix/fs.c | 20 ++++++++---------
+ src/unix/fsevents.c | 40 +++++++++++++++++-----------------
+ src/unix/getaddrinfo.c | 8 +++----
+ src/unix/ibmi.c | 2 +-
+ src/unix/kqueue.c | 6 ++---
+ src/unix/linux-core.c | 5 ++---
+ src/unix/linux-inotify.c | 4 ++--
+ src/unix/loop.c | 2 +-
+ src/unix/netbsd.c | 4 ++--
+ src/unix/openbsd.c | 4 ++--
+ src/unix/pipe.c | 4 ++--
+ src/unix/poll.c | 2 +-
+ src/unix/posix-poll.c | 2 +-
+ src/unix/process.c | 4 ++--
+ src/unix/proctitle.c | 2 +-
+ src/unix/random-sysctl-linux.c | 2 +-
+ src/unix/stream.c | 35 ++++++++++++++---------------
+ src/unix/thread.c | 7 +++---
+ src/unix/udp.c | 8 +++----
+ src/uv-common.c | 16 +++++++-------
+ src/win/core.c | 8 ++++---
+ src/win/fs-event.c | 4 ++--
+ src/win/fs-fd-hash-inl.h | 2 +-
+ src/win/fs.c | 26 +++++++++++-----------
+ src/win/pipe.c | 10 ++++-----
+ src/win/process.c | 12 +++++-----
+ src/win/tcp.c | 2 +-
+ src/win/thread.c | 4 ++--
+ src/win/util.c | 29 ++++++++++++------------
+ 40 files changed, 166 insertions(+), 162 deletions(-)
+
+diff --git a/include/uv/unix.h b/include/uv/unix.h
+index ea37d787..420be86c 100644
+--- a/include/uv/unix.h
++++ b/include/uv/unix.h
+@@ -223,7 +223,7 @@ typedef struct {
+ int backend_fd; \
+ void* pending_queue[2]; \
+ void* watcher_queue[2]; \
+- uv__io_t** watchers; \
++ void** watchers; \
+ unsigned int nwatchers; \
+ unsigned int nfds; \
+ void* wq[2]; \
+diff --git a/src/fs-poll.c b/src/fs-poll.c
+index 1bac1c56..5a39daed 100644
+--- a/src/fs-poll.c
++++ b/src/fs-poll.c
+@@ -77,7 +77,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
+
+ loop = handle->loop;
+ len = strlen(path);
+- ctx = uv__calloc(1, sizeof(*ctx) + len);
++ ctx = (struct poll_ctx*)uv__calloc(1, sizeof(*ctx) + len);
+
+ if (ctx == NULL)
+ return UV_ENOMEM;
+@@ -101,7 +101,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
+ goto error;
+
+ if (handle->poll_ctx != NULL)
+- ctx->previous = handle->poll_ctx;
++ ctx->previous = (struct poll_ctx*)handle->poll_ctx;
+ handle->poll_ctx = ctx;
+ uv__handle_start(handle);
+
+@@ -119,7 +119,7 @@ int uv_fs_poll_stop(uv_fs_poll_t* handle) {
+ if (!uv_is_active((uv_handle_t*)handle))
+ return 0;
+
+- ctx = handle->poll_ctx;
++ ctx = (struct poll_ctx*)handle->poll_ctx;
+ assert(ctx != NULL);
+ assert(ctx->parent_handle == handle);
+
+@@ -144,7 +144,7 @@ int uv_fs_poll_getpath(uv_fs_poll_t* handle, char* buffer, size_t* size) {
+ return UV_EINVAL;
+ }
+
+- ctx = handle->poll_ctx;
++ ctx = (struct poll_ctx*)handle->poll_ctx;
+ assert(ctx != NULL);
+
+ required_len = strlen(ctx->path);
+@@ -244,7 +244,7 @@ static void timer_close_cb(uv_handle_t* timer) {
+ if (handle->poll_ctx == NULL && uv__is_closing(handle))
+ uv__make_close_pending((uv_handle_t*)handle);
+ } else {
+- for (last = handle->poll_ctx, it = last->previous;
++ for (last = (struct poll_ctx*)handle->poll_ctx, it = last->previous;
+ it != ctx;
+ last = it, it = it->previous) {
+ assert(last->previous != NULL);
+diff --git a/src/inet.c b/src/inet.c
+index ddabf22f..ca8b6ac8 100644
+--- a/src/inet.c
++++ b/src/inet.c
+@@ -40,9 +40,9 @@ static int inet_pton6(const char *src, unsigned char *dst);
+ int uv_inet_ntop(int af, const void* src, char* dst, size_t size) {
+ switch (af) {
+ case AF_INET:
+- return (inet_ntop4(src, dst, size));
++ return (inet_ntop4((const unsigned char*)src, dst, size));
+ case AF_INET6:
+- return (inet_ntop6(src, dst, size));
++ return (inet_ntop6((const unsigned char*)src, dst, size));
+ default:
+ return UV_EAFNOSUPPORT;
+ }
+@@ -154,10 +154,11 @@ int uv_inet_pton(int af, const char* src, void* dst) {
+
+ switch (af) {
+ case AF_INET:
+- return (inet_pton4(src, dst));
++ return (inet_pton4(src, (unsigned char*)dst));
+ case AF_INET6: {
+ int len;
+- char tmp[UV__INET6_ADDRSTRLEN], *s, *p;
++ char tmp[UV__INET6_ADDRSTRLEN], *s;
++ const char *p;
+ s = (char*) src;
+ p = strchr(src, '%');
+ if (p != NULL) {
+@@ -168,7 +169,7 @@ int uv_inet_pton(int af, const char* src, void* dst) {
+ memcpy(s, src, len);
+ s[len] = '\0';
+ }
+- return inet_pton6(s, dst);
++ return inet_pton6(s, (unsigned char*)dst);
+ }
+ default:
+ return UV_EAFNOSUPPORT;
+diff --git a/src/strscpy.c b/src/strscpy.c
+index 20df6fcb..6b4cc3bc 100644
+--- a/src/strscpy.c
++++ b/src/strscpy.c
+@@ -27,7 +27,7 @@ ssize_t uv__strscpy(char* d, const char* s, size_t n) {
+
+ for (i = 0; i < n; i++)
+ if ('\0' == (d[i] = s[i]))
+- return i > SSIZE_MAX ? UV_E2BIG : (ssize_t) i;
++ return i > SSIZE_MAX ? (ssize_t) UV_E2BIG : (ssize_t) i;
+
+ if (i == 0)
+ return 0;
+diff --git a/src/threadpool.c b/src/threadpool.c
+index e804c7c4..1241ace1 100644
+--- a/src/threadpool.c
++++ b/src/threadpool.c
+@@ -206,7 +206,7 @@ static void init_threads(void) {
+
+ threads = default_threads;
+ if (nthreads > ARRAY_SIZE(default_threads)) {
+- threads = uv__malloc(nthreads * sizeof(threads[0]));
++ threads = (uv_thread_t*)uv__malloc(nthreads * sizeof(threads[0]));
+ if (threads == NULL) {
+ nthreads = ARRAY_SIZE(default_threads);
+ threads = default_threads;
+diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
+index 11ca9559..c3dd71a1 100644
+--- a/src/unix/bsd-ifaddrs.c
++++ b/src/unix/bsd-ifaddrs.c
+@@ -92,7 +92,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+ }
+
+ /* Make sure the memory is initiallized to zero using calloc() */
+- *addresses = uv__calloc(*count, sizeof(**addresses));
++ *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
+
+ if (*addresses == NULL) {
+ freeifaddrs(addrs);
+diff --git a/src/unix/core.c b/src/unix/core.c
+index 54c769f3..6353b0e3 100644
+--- a/src/unix/core.c
++++ b/src/unix/core.c
+@@ -824,7 +824,7 @@ static unsigned int next_power_of_two(unsigned int val) {
+ }
+
+ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
+- uv__io_t** watchers;
++ void** watchers;
+ void* fake_watcher_list;
+ void* fake_watcher_count;
+ unsigned int nwatchers;
+@@ -843,8 +843,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
+ }
+
+ nwatchers = next_power_of_two(len + 2) - 2;
+- watchers = uv__reallocf(loop->watchers,
+- (nwatchers + 2) * sizeof(loop->watchers[0]));
++ watchers = (void**)
++ uv__reallocf(loop->watchers, (nwatchers + 2) * sizeof(loop->watchers[0]));
+
+ if (watchers == NULL)
+ abort();
+@@ -1184,7 +1184,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
+ * is frequently 1024 or 4096, so we can just use that directly. The pwent
+ * will not usually be large. */
+ for (bufsize = 2000;; bufsize *= 2) {
+- buf = uv__malloc(bufsize);
++ buf = (char*)uv__malloc(bufsize);
+
+ if (buf == NULL)
+ return UV_ENOMEM;
+@@ -1210,7 +1210,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
+ name_size = strlen(pw.pw_name) + 1;
+ homedir_size = strlen(pw.pw_dir) + 1;
+ shell_size = strlen(pw.pw_shell) + 1;
+- pwd->username = uv__malloc(name_size + homedir_size + shell_size);
++ pwd->username = (char*)uv__malloc(name_size + homedir_size + shell_size);
+
+ if (pwd->username == NULL) {
+ uv__free(buf);
+@@ -1274,7 +1274,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
+
+ for (i = 0; environ[i] != NULL; i++);
+
+- *envitems = uv__calloc(i, sizeof(**envitems));
++ *envitems = (uv_env_item_s*)uv__calloc(i, sizeof(**envitems));
+
+ if (*envitems == NULL)
+ return UV_ENOMEM;
+diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c
+index 5288083e..9bd55dd7 100644
+--- a/src/unix/darwin-proctitle.c
++++ b/src/unix/darwin-proctitle.c
+@@ -128,8 +128,9 @@ int uv__set_process_title(const char* title) {
+ if (pLSSetApplicationInformationItem == NULL)
+ goto out;
+
+- display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle,
+- S("_kLSDisplayNameKey"));
++ display_name_key = (CFStringRef*)
++ pCFBundleGetDataPointerForName(launch_services_bundle,
++ S("_kLSDisplayNameKey"));
+
+ if (display_name_key == NULL || *display_name_key == NULL)
+ goto out;
+diff --git a/src/unix/darwin.c b/src/unix/darwin.c
+index 62f04d31..5fbf7342 100644
+--- a/src/unix/darwin.c
++++ b/src/unix/darwin.c
+@@ -353,7 +353,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ return UV_EINVAL; /* FIXME(bnoordhuis) Translate error. */
+ }
+
+- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+ if (!(*cpu_infos)) {
+ vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type);
+ return UV_ENOMEM;
+diff --git a/src/unix/epoll.c b/src/unix/epoll.c
+index 97348e25..4c057fb3 100644
+--- a/src/unix/epoll.c
++++ b/src/unix/epoll.c
+@@ -325,7 +325,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
+ assert(fd >= 0);
+ assert((unsigned) fd < loop->nwatchers);
+
+- w = loop->watchers[fd];
++ w = (uv__io_t*)loop->watchers[fd];
+
+ if (w == NULL) {
+ /* File descriptor that we've stopped watching, disarm it.
+diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c
+index 658ff262..6700ff61 100644
+--- a/src/unix/freebsd.c
++++ b/src/unix/freebsd.c
+@@ -215,7 +215,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0))
+ return UV__ERR(errno);
+
+- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+ if (!(*cpu_infos))
+ return UV_ENOMEM;
+
+@@ -232,7 +232,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+
+ size = maxcpus * CPUSTATES * sizeof(long);
+
+- cp_times = uv__malloc(size);
++ cp_times = (long*)uv__malloc(size);
+ if (cp_times == NULL) {
+ uv__free(*cpu_infos);
+ return UV_ENOMEM;
+diff --git a/src/unix/fs.c b/src/unix/fs.c
+index 933c9c0d..1a615244 100644
+--- a/src/unix/fs.c
++++ b/src/unix/fs.c
+@@ -137,7 +137,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */
+ size_t new_path_len; \
+ path_len = strlen(path) + 1; \
+ new_path_len = strlen(new_path) + 1; \
+- req->path = uv__malloc(path_len + new_path_len); \
++ req->path = (char*)uv__malloc(path_len + new_path_len); \
+ if (req->path == NULL) \
+ return UV_ENOMEM; \
+ req->new_path = req->path + path_len; \
+@@ -572,7 +572,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
+ static int uv__fs_opendir(uv_fs_t* req) {
+ uv_dir_t* dir;
+
+- dir = uv__malloc(sizeof(*dir));
++ dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
+ if (dir == NULL)
+ goto error;
+
+@@ -596,7 +596,7 @@ static int uv__fs_readdir(uv_fs_t* req) {
+ unsigned int dirent_idx;
+ unsigned int i;
+
+- dir = req->ptr;
++ dir = (uv_dir_t*)req->ptr;
+ dirent_idx = 0;
+
+ while (dirent_idx < dir->nentries) {
+@@ -638,7 +638,7 @@ error:
+ static int uv__fs_closedir(uv_fs_t* req) {
+ uv_dir_t* dir;
+
+- dir = req->ptr;
++ dir = (uv_dir_t*)req->ptr;
+
+ if (dir->dir != NULL) {
+ closedir(dir->dir);
+@@ -667,7 +667,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
+ #endif /* defined(__sun) */
+ return -1;
+
+- stat_fs = uv__malloc(sizeof(*stat_fs));
++ stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
+ if (stat_fs == NULL) {
+ errno = ENOMEM;
+ return -1;
+@@ -731,7 +731,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
+ maxlen = uv__fs_pathmax_size(req->path);
+ #endif
+
+- buf = uv__malloc(maxlen);
++ buf = (char*)uv__malloc(maxlen);
+
+ if (buf == NULL) {
+ errno = ENOMEM;
+@@ -751,7 +751,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
+
+ /* Uncommon case: resize to make room for the trailing nul byte. */
+ if (len == maxlen) {
+- buf = uv__reallocf(buf, len + 1);
++ buf = (char*)uv__reallocf(buf, len + 1);
+
+ if (buf == NULL)
+ return -1;
+@@ -774,7 +774,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) {
+ ssize_t len;
+
+ len = uv__fs_pathmax_size(req->path);
+- buf = uv__malloc(len + 1);
++ buf = (char*)uv__malloc(len + 1);
+
+ if (buf == NULL) {
+ errno = ENOMEM;
+@@ -2010,7 +2010,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req,
+ req->nbufs = nbufs;
+ req->bufs = req->bufsml;
+ if (nbufs > ARRAY_SIZE(req->bufsml))
+- req->bufs = uv__malloc(nbufs * sizeof(*bufs));
++ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+
+ if (req->bufs == NULL)
+ return UV_ENOMEM;
+@@ -2180,7 +2180,7 @@ int uv_fs_write(uv_loop_t* loop,
+ req->nbufs = nbufs;
+ req->bufs = req->bufsml;
+ if (nbufs > ARRAY_SIZE(req->bufsml))
+- req->bufs = uv__malloc(nbufs * sizeof(*bufs));
++ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+
+ if (req->bufs == NULL)
+ return UV_ENOMEM;
+diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c
+index bf4f1f6a..648c8a98 100644
+--- a/src/unix/fsevents.c
++++ b/src/unix/fsevents.c
+@@ -185,7 +185,7 @@ static void (*pFSEventStreamStop)(FSEventStreamRef);
+ static void uv__fsevents_cb(uv_async_t* cb) {
+ uv_fs_event_t* handle;
+
+- handle = cb->data;
++ handle = (uv_fs_event_t*)cb->data;
+
+ UV__FSEVENTS_PROCESS(handle, {
+ handle->cb(handle, event->path[0] ? event->path : NULL, event->events, 0);
+@@ -233,10 +233,10 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
+ FSEventStreamEventFlags flags;
+ QUEUE head;
+
+- loop = info;
+- state = loop->cf_state;
++ loop = (uv_loop_t*)info;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+ assert(state != NULL);
+- paths = eventPaths;
++ paths = (char**)eventPaths;
+
+ /* For each handle */
+ uv_mutex_lock(&state->fsevent_mutex);
+@@ -306,7 +306,7 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
+ continue;
+ }
+
+- event = uv__malloc(sizeof(*event) + len);
++ event = (uv__fsevents_event_t*)uv__malloc(sizeof(*event) + len);
+ if (event == NULL)
+ break;
+
+@@ -373,7 +373,7 @@ static int uv__fsevents_create_stream(uv_loop_t* loop, CFArrayRef paths) {
+ flags);
+ assert(ref != NULL);
+
+- state = loop->cf_state;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+ pFSEventStreamScheduleWithRunLoop(ref,
+ state->loop,
+ *pkCFRunLoopDefaultMode);
+@@ -392,7 +392,7 @@ static int uv__fsevents_create_stream(uv_loop_t* loop, CFArrayRef paths) {
+ static void uv__fsevents_destroy_stream(uv_loop_t* loop) {
+ uv__cf_loop_state_t* state;
+
+- state = loop->cf_state;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+
+ if (state->fsevent_stream == NULL)
+ return;
+@@ -419,7 +419,7 @@ static void uv__fsevents_reschedule(uv_fs_event_t* handle,
+ int err;
+ unsigned int path_count;
+
+- state = handle->loop->cf_state;
++ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
+ paths = NULL;
+ cf_paths = NULL;
+ err = 0;
+@@ -447,7 +447,7 @@ static void uv__fsevents_reschedule(uv_fs_event_t* handle,
+ uv_mutex_lock(&state->fsevent_mutex);
+ path_count = state->fsevent_handle_count;
+ if (path_count != 0) {
+- paths = uv__malloc(sizeof(*paths) * path_count);
++ paths = (CFStringRef*)uv__malloc(sizeof(*paths) * path_count);
+ if (paths == NULL) {
+ uv_mutex_unlock(&state->fsevent_mutex);
+ goto final;
+@@ -605,7 +605,7 @@ static int uv__fsevents_loop_init(uv_loop_t* loop) {
+ if (err)
+ return err;
+
+- state = uv__calloc(1, sizeof(*state));
++ state = (uv__cf_loop_state_t*)uv__calloc(1, sizeof(*state));
+ if (state == NULL)
+ return UV_ENOMEM;
+
+@@ -707,7 +707,7 @@ void uv__fsevents_loop_delete(uv_loop_t* loop) {
+ }
+
+ /* Destroy state */
+- state = loop->cf_state;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+ uv_sem_destroy(&state->fsevent_sem);
+ uv_mutex_destroy(&state->fsevent_mutex);
+ pCFRelease(state->signal_source);
+@@ -721,8 +721,8 @@ static void* uv__cf_loop_runner(void* arg) {
+ uv_loop_t* loop;
+ uv__cf_loop_state_t* state;
+
+- loop = arg;
+- state = loop->cf_state;
++ loop = (uv_loop_t*)arg;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+ state->loop = pCFRunLoopGetCurrent();
+
+ pCFRunLoopAddSource(state->loop,
+@@ -750,8 +750,8 @@ static void uv__cf_loop_cb(void* arg) {
+ QUEUE split_head;
+ uv__cf_loop_signal_t* s;
+
+- loop = arg;
+- state = loop->cf_state;
++ loop = (uv_loop_t*)arg;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+
+ uv_mutex_lock(&loop->cf_mutex);
+ QUEUE_MOVE(&loop->cf_signals, &split_head);
+@@ -781,7 +781,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
+ uv__cf_loop_signal_t* item;
+ uv__cf_loop_state_t* state;
+
+- item = uv__malloc(sizeof(*item));
++ item = (uv__cf_loop_signal_t*)uv__malloc(sizeof(*item));
+ if (item == NULL)
+ return UV_ENOMEM;
+
+@@ -791,7 +791,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
+ uv_mutex_lock(&loop->cf_mutex);
+ QUEUE_INSERT_TAIL(&loop->cf_signals, &item->member);
+
+- state = loop->cf_state;
++ state = (uv__cf_loop_state_t*)loop->cf_state;
+ assert(state != NULL);
+ pCFRunLoopSourceSignal(state->signal_source);
+ pCFRunLoopWakeUp(state->loop);
+@@ -825,7 +825,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
+ * Events will occur in other thread.
+ * Initialize callback for getting them back into event loop's thread
+ */
+- handle->cf_cb = uv__malloc(sizeof(*handle->cf_cb));
++ handle->cf_cb = (uv_async_t*)uv__malloc(sizeof(*handle->cf_cb));
+ if (handle->cf_cb == NULL) {
+ err = UV_ENOMEM;
+ goto fail_cf_cb_malloc;
+@@ -841,7 +841,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
+ goto fail_cf_mutex_init;
+
+ /* Insert handle into the list */
+- state = handle->loop->cf_state;
++ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
+ uv_mutex_lock(&state->fsevent_mutex);
+ QUEUE_INSERT_TAIL(&state->fsevent_handles, &handle->cf_member);
+ state->fsevent_handle_count++;
+@@ -881,7 +881,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
+ return UV_EINVAL;
+
+ /* Remove handle from the list */
+- state = handle->loop->cf_state;
++ state = (uv__cf_loop_state_t*)handle->loop->cf_state;
+ uv_mutex_lock(&state->fsevent_mutex);
+ QUEUE_REMOVE(&handle->cf_member);
+ state->fsevent_handle_count--;
+diff --git a/src/unix/getaddrinfo.c b/src/unix/getaddrinfo.c
+index 77337ace..41dc3909 100644
+--- a/src/unix/getaddrinfo.c
++++ b/src/unix/getaddrinfo.c
+@@ -172,7 +172,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
+ hostname_len = hostname ? strlen(hostname) + 1 : 0;
+ service_len = service ? strlen(service) + 1 : 0;
+ hints_len = hints ? sizeof(*hints) : 0;
+- buf = uv__malloc(hostname_len + service_len + hints_len);
++ buf = (char*)uv__malloc(hostname_len + service_len + hints_len);
+
+ if (buf == NULL)
+ return UV_ENOMEM;
+@@ -190,17 +190,17 @@ int uv_getaddrinfo(uv_loop_t* loop,
+ len = 0;
+
+ if (hints) {
+- req->hints = memcpy(buf + len, hints, sizeof(*hints));
++ req->hints = (struct addrinfo*)memcpy(buf + len, hints, sizeof(*hints));
+ len += sizeof(*hints);
+ }
+
+ if (service) {
+- req->service = memcpy(buf + len, service, service_len);
++ req->service = (char*)memcpy(buf + len, service, service_len);
+ len += service_len;
+ }
+
+ if (hostname)
+- req->hostname = memcpy(buf + len, hostname, hostname_len);
++ req->hostname = (char*)memcpy(buf + len, hostname, hostname_len);
+
+ if (cb) {
+ uv__work_submit(loop,
+diff --git a/src/unix/ibmi.c b/src/unix/ibmi.c
+index 8c6ae636..56af31e9 100644
+--- a/src/unix/ibmi.c
++++ b/src/unix/ibmi.c
+@@ -288,7 +288,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+
+ numcpus = sysconf(_SC_NPROCESSORS_ONLN);
+
+- *cpu_infos = uv__malloc(numcpus * sizeof(uv_cpu_info_t));
++ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(uv_cpu_info_t));
+ if (!*cpu_infos) {
+ return UV_ENOMEM;
+ }
+diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c
+index 5dac76ae..86eb529b 100644
+--- a/src/unix/kqueue.c
++++ b/src/unix/kqueue.c
+@@ -281,8 +281,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
+ nevents = 0;
+
+ assert(loop->watchers != NULL);
+- loop->watchers[loop->nwatchers] = (void*) events;
+- loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
++ loop->watchers[loop->nwatchers] = (uv__io_t*) events;
++ loop->watchers[loop->nwatchers + 1] = (uv__io_t*) (uintptr_t) nfds;
+ for (i = 0; i < nfds; i++) {
+ ev = events + i;
+ fd = ev->ident;
+@@ -304,7 +304,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
+ /* Skip invalidated events, see uv__platform_invalidate_fd */
+ if (fd == -1)
+ continue;
+- w = loop->watchers[fd];
++ w = (uv__io_t*)loop->watchers[fd];
+
+ if (w == NULL) {
+ /* File descriptor that we've stopped watching, disarm it.
+diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c
+index 23a7dafe..85f3fc01 100644
+--- a/src/unix/linux-core.c
++++ b/src/unix/linux-core.c
+@@ -117,7 +117,6 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
+ }
+
+
+-
+ uint64_t uv__hrtime(uv_clocktype_t type) {
+ static clock_t fast_clock_id = -1;
+ struct timespec t;
+@@ -283,7 +282,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ goto out;
+
+ err = UV_ENOMEM;
+- ci = uv__calloc(numcpus, sizeof(*ci));
++ ci = (uv_cpu_info_t*)uv__calloc(numcpus, sizeof(*ci));
+ if (ci == NULL)
+ goto out;
+
+@@ -663,7 +662,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+ }
+
+ /* Make sure the memory is initiallized to zero using calloc() */
+- *addresses = uv__calloc(*count, sizeof(**addresses));
++ *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
+ if (!(*addresses)) {
+ freeifaddrs(addrs);
+ return UV_ENOMEM;
+diff --git a/src/unix/linux-inotify.c b/src/unix/linux-inotify.c
+index c1bd260e..f5366e96 100644
+--- a/src/unix/linux-inotify.c
++++ b/src/unix/linux-inotify.c
+@@ -281,12 +281,12 @@ int uv_fs_event_start(uv_fs_event_t* handle,
+ goto no_insert;
+
+ len = strlen(path) + 1;
+- w = uv__malloc(sizeof(*w) + len);
++ w = (watcher_list*)uv__malloc(sizeof(*w) + len);
+ if (w == NULL)
+ return UV_ENOMEM;
+
+ w->wd = wd;
+- w->path = memcpy(w + 1, path, len);
++ w->path = (char*)memcpy(w + 1, path, len);
+ QUEUE_INIT(&w->watchers);
+ w->iterating = 0;
+ RB_INSERT(watcher_root, CAST(&handle->loop->inotify_watchers), w);
+diff --git a/src/unix/loop.c b/src/unix/loop.c
+index a88e71c3..2e819cdd 100644
+--- a/src/unix/loop.c
++++ b/src/unix/loop.c
+@@ -148,7 +148,7 @@ int uv_loop_fork(uv_loop_t* loop) {
+
+ /* Rearm all the watchers that aren't re-queued by the above. */
+ for (i = 0; i < loop->nwatchers; i++) {
+- w = loop->watchers[i];
++ w = (uv__io_t*)loop->watchers[i];
+ if (w == NULL)
+ continue;
+
+diff --git a/src/unix/netbsd.c b/src/unix/netbsd.c
+index c66333f5..b6886a1c 100644
+--- a/src/unix/netbsd.c
++++ b/src/unix/netbsd.c
+@@ -206,14 +206,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ cpuspeed = 0;
+
+ size = numcpus * CPUSTATES * sizeof(*cp_times);
+- cp_times = uv__malloc(size);
++ cp_times = (u_int64_t*)uv__malloc(size);
+ if (cp_times == NULL)
+ return UV_ENOMEM;
+
+ if (sysctlbyname("kern.cp_time", cp_times, &size, NULL, 0))
+ return UV__ERR(errno);
+
+- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+ if (!(*cpu_infos)) {
+ uv__free(cp_times);
+ uv__free(*cpu_infos);
+diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c
+index f32a94df..62740f73 100644
+--- a/src/unix/openbsd.c
++++ b/src/unix/openbsd.c
+@@ -72,7 +72,7 @@ int uv_exepath(char* buffer, size_t* size) {
+ mypid = getpid();
+ for (;;) {
+ err = UV_ENOMEM;
+- argsbuf = uv__reallocf(argsbuf, argsbuf_size);
++ argsbuf = (char**)uv__reallocf(argsbuf, argsbuf_size);
+ if (argsbuf == NULL)
+ goto out;
+ mib[0] = CTL_KERN;
+@@ -197,7 +197,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ if (sysctl(which, ARRAY_SIZE(which), &numcpus, &size, NULL, 0))
+ return UV__ERR(errno);
+
+- *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++ *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+ if (!(*cpu_infos))
+ return UV_ENOMEM;
+
+diff --git a/src/unix/pipe.c b/src/unix/pipe.c
+index e8cfa148..c8ba31da 100644
+--- a/src/unix/pipe.c
++++ b/src/unix/pipe.c
+@@ -309,7 +309,7 @@ int uv_pipe_pending_count(uv_pipe_t* handle) {
+ if (handle->queued_fds == NULL)
+ return 1;
+
+- queued_fds = handle->queued_fds;
++ queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
+ return queued_fds->offset + 1;
+ }
+
+@@ -346,7 +346,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
+ if (r != UV_ENOBUFS)
+ return r;
+
+- name_buffer = uv__malloc(name_len);
++ name_buffer = (char*)uv__malloc(name_len);
+ if (name_buffer == NULL)
+ return UV_ENOMEM;
+
+diff --git a/src/unix/poll.c b/src/unix/poll.c
+index 7a12e2d1..73647317 100644
+--- a/src/unix/poll.c
++++ b/src/unix/poll.c
+@@ -117,7 +117,7 @@ int uv_poll_stop(uv_poll_t* handle) {
+
+
+ int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
+- uv__io_t** watchers;
++ void** watchers;
+ uv__io_t* w;
+ int events;
+
+diff --git a/src/unix/posix-poll.c b/src/unix/posix-poll.c
+index 0f4bf938..8da038d1 100644
+--- a/src/unix/posix-poll.c
++++ b/src/unix/posix-poll.c
+@@ -61,7 +61,7 @@ static void uv__pollfds_maybe_resize(uv_loop_t* loop) {
+ return;
+
+ n = loop->poll_fds_size ? loop->poll_fds_size * 2 : 64;
+- p = uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
++ p = (struct pollfd*)uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
+ if (p == NULL)
+ abort();
+
+diff --git a/src/unix/process.c b/src/unix/process.c
+index f8415368..0916aa45 100644
+--- a/src/unix/process.c
++++ b/src/unix/process.c
+@@ -403,7 +403,7 @@ static int posix_spawn_can_use_setsid;
+ static void uv__spawn_init_posix_spawn_fncs(void) {
+ /* Try to locate all non-portable functions at runtime */
+ posix_spawn_fncs.file_actions.addchdir_np =
+- dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
++ (int (*)(void* const*, const char*)) dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
+ }
+
+
+@@ -967,7 +967,7 @@ int uv_spawn(uv_loop_t* loop,
+ err = UV_ENOMEM;
+ pipes = pipes_storage;
+ if (stdio_count > (int) ARRAY_SIZE(pipes_storage))
+- pipes = uv__malloc(stdio_count * sizeof(*pipes));
++ pipes = (int (*)[2])uv__malloc(stdio_count * sizeof(*pipes));
+
+ if (pipes == NULL)
+ goto error;
+diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c
+index 9d1f00dd..8cdec753 100644
+--- a/src/unix/proctitle.c
++++ b/src/unix/proctitle.c
+@@ -65,7 +65,7 @@ char** uv_setup_args(int argc, char** argv) {
+ /* Add space for the argv pointers. */
+ size += (argc + 1) * sizeof(char*);
+
+- new_argv = uv__malloc(size);
++ new_argv = (char**)uv__malloc(size);
+ if (new_argv == NULL)
+ return argv;
+
+diff --git a/src/unix/random-sysctl-linux.c b/src/unix/random-sysctl-linux.c
+index 66ba8d74..9ef18df0 100644
+--- a/src/unix/random-sysctl-linux.c
++++ b/src/unix/random-sysctl-linux.c
+@@ -48,7 +48,7 @@ int uv__random_sysctl(void* buf, size_t buflen) {
+ char* pe;
+ size_t n;
+
+- p = buf;
++ p = (char*)buf;
+ pe = p + buflen;
+
+ while (p < pe) {
+diff --git a/src/unix/stream.c b/src/unix/stream.c
+index b1f6359e..c6cc50e7 100644
+--- a/src/unix/stream.c
++++ b/src/unix/stream.c
+@@ -113,7 +113,7 @@ static void uv__stream_osx_interrupt_select(uv_stream_t* stream) {
+ uv__stream_select_t* s;
+ int r;
+
+- s = stream->select;
++ s = (uv__stream_select_t*)stream->select;
+ if (s == NULL)
+ return;
+
+@@ -142,8 +142,8 @@ static void uv__stream_osx_select(void* arg) {
+ int r;
+ int max_fd;
+
+- stream = arg;
+- s = stream->select;
++ stream = (uv_stream_t*)arg;
++ s = (uv__stream_select_t*)stream->select;
+ fd = s->fd;
+
+ if (fd > s->int_fd)
+@@ -320,7 +320,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
+ sread_sz = ROUND_UP(max_fd + 1, sizeof(uint32_t) * NBBY) / NBBY;
+ swrite_sz = sread_sz;
+
+- s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
++ s = (uv__stream_select_t*)uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
+ if (s == NULL) {
+ err = UV_ENOMEM;
+ goto failed_malloc;
+@@ -605,7 +605,7 @@ done:
+ if (server->queued_fds != NULL) {
+ uv__stream_queued_fds_t* queued_fds;
+
+- queued_fds = server->queued_fds;
++ queued_fds = (uv__stream_queued_fds_t*)(server->queued_fds);
+
+ /* Read first */
+ server->accepted_fd = queued_fds->fds[0];
+@@ -844,7 +844,7 @@ static int uv__try_write(uv_stream_t* stream,
+ /* silence aliasing warning */
+ {
+ void* pv = CMSG_DATA(cmsg);
+- int* pi = pv;
++ int* pi = (int*)pv;
+ *pi = fd_to_send;
+ }
+
+@@ -975,11 +975,12 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
+ uv__stream_queued_fds_t* queued_fds;
+ unsigned int queue_size;
+
+- queued_fds = stream->queued_fds;
++ queued_fds = (uv__stream_queued_fds_t*)stream->queued_fds;
+ if (queued_fds == NULL) {
+ queue_size = 8;
+- queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
+- sizeof(*queued_fds));
++ queued_fds = (uv__stream_queued_fds_t*)
++ uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
++ sizeof(*queued_fds));
+ if (queued_fds == NULL)
+ return UV_ENOMEM;
+ queued_fds->size = queue_size;
+@@ -989,9 +990,9 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
+ /* Grow */
+ } else if (queued_fds->size == queued_fds->offset) {
+ queue_size = queued_fds->size + 8;
+- queued_fds = uv__realloc(queued_fds,
+- (queue_size - 1) * sizeof(*queued_fds->fds) +
+- sizeof(*queued_fds));
++ queued_fds = (uv__stream_queued_fds_t*)
++ uv__realloc(queued_fds, (queue_size - 1) * sizeof(*queued_fds->fds) +
++ sizeof(*queued_fds));
+
+ /*
+ * Allocation failure, report back.
+@@ -1039,7 +1040,7 @@ static int uv__stream_recv_cmsg(uv_stream_t* stream, struct msghdr* msg) {
+
+ /* silence aliasing warning */
+ pv = CMSG_DATA(cmsg);
+- pi = pv;
++ pi = (int*)pv;
+
+ /* Count available fds */
+ start = (char*) cmsg;
+@@ -1423,7 +1424,7 @@ int uv_write2(uv_write_t* req,
+
+ req->bufs = req->bufsml;
+ if (nbufs > ARRAY_SIZE(req->bufsml))
+- req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
++ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
+
+ if (req->bufs == NULL)
+ return UV_ENOMEM;
+@@ -1557,7 +1558,7 @@ int uv___stream_fd(const uv_stream_t* handle) {
+ handle->type == UV_TTY ||
+ handle->type == UV_NAMED_PIPE);
+
+- s = handle->select;
++ s = (const uv__stream_select_t*)handle->select;
+ if (s != NULL)
+ return s->fd;
+
+@@ -1575,7 +1576,7 @@ void uv__stream_close(uv_stream_t* handle) {
+ if (handle->select != NULL) {
+ uv__stream_select_t* s;
+
+- s = handle->select;
++ s = (uv__stream_select_t*)handle->select;
+
+ uv_sem_post(&s->close_sem);
+ uv_sem_post(&s->async_sem);
+@@ -1610,7 +1611,7 @@ void uv__stream_close(uv_stream_t* handle) {
+
+ /* Close all queued fds */
+ if (handle->queued_fds != NULL) {
+- queued_fds = handle->queued_fds;
++ queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
+ for (i = 0; i < queued_fds->offset; i++)
+ uv__close(queued_fds->fds[i]);
+ uv__free(handle->queued_fds);
+diff --git a/src/unix/thread.c b/src/unix/thread.c
+index d89e5cd1..759cd0c2 100644
+--- a/src/unix/thread.c
++++ b/src/unix/thread.c
+@@ -59,7 +59,7 @@ int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
+ if (barrier == NULL || count == 0)
+ return UV_EINVAL;
+
+- b = uv__malloc(sizeof(*b));
++ b = (_uv_barrier*)uv__malloc(sizeof(*b));
+ if (b == NULL)
+ return UV_ENOMEM;
+
+@@ -275,8 +275,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
+ abort();
+ }
+
+- f.in = entry;
+- err = pthread_create(tid, attr, f.out, arg);
++ err = pthread_create(tid, attr, (void*(*)(void*)) (void(*)(void)) entry, arg);
+
+ if (attr != NULL)
+ pthread_attr_destroy(attr);
+@@ -547,7 +546,7 @@ static int uv__custom_sem_init(uv_sem_t* sem_, unsigned int value) {
+ int err;
+ uv_semaphore_t* sem;
+
+- sem = uv__malloc(sizeof(*sem));
++ sem = (uv_semaphore_t*)uv__malloc(sizeof(*sem));
+ if (sem == NULL)
+ return UV_ENOMEM;
+
+diff --git a/src/unix/udp.c b/src/unix/udp.c
+index 4d985b88..a130aeaa 100644
+--- a/src/unix/udp.c
++++ b/src/unix/udp.c
+@@ -227,11 +227,11 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
+ if (msgs[k].msg_hdr.msg_flags & MSG_TRUNC)
+ flags |= UV_UDP_PARTIAL;
+
+- chunk_buf = uv_buf_init(iov[k].iov_base, iov[k].iov_len);
++ chunk_buf = uv_buf_init((char*) iov[k].iov_base, iov[k].iov_len);
+ handle->recv_cb(handle,
+ msgs[k].msg_len,
+ &chunk_buf,
+- msgs[k].msg_hdr.msg_name,
++ (const sockaddr*) msgs[k].msg_hdr.msg_name,
+ flags);
+ }
+
+@@ -281,7 +281,7 @@ static void uv__udp_recvmsg(uv_udp_t* handle) {
+ memset(&peer, 0, sizeof(peer));
+ h.msg_name = &peer;
+ h.msg_namelen = sizeof(peer);
+- h.msg_iov = (void*) &buf;
++ h.msg_iov = (iovec*) &buf;
+ h.msg_iovlen = 1;
+
+ do {
+@@ -765,7 +765,7 @@ int uv__udp_send(uv_udp_send_t* req,
+
+ req->bufs = req->bufsml;
+ if (nbufs > ARRAY_SIZE(req->bufsml))
+- req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
++ req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
+
+ if (req->bufs == NULL) {
+ uv__req_unregister(handle->loop, req);
+diff --git a/src/uv-common.c b/src/uv-common.c
+index efc9eb50..dfb606e3 100644
+--- a/src/uv-common.c
++++ b/src/uv-common.c
+@@ -54,10 +54,10 @@ static uv__allocator_t uv__allocator = {
+
+ char* uv__strdup(const char* s) {
+ size_t len = strlen(s) + 1;
+- char* m = uv__malloc(len);
++ char* m = (char*)uv__malloc(len);
+ if (m == NULL)
+ return NULL;
+- return memcpy(m, s, len);
++ return (char*)memcpy(m, s, len);
+ }
+
+ char* uv__strndup(const char* s, size_t n) {
+@@ -65,11 +65,11 @@ char* uv__strndup(const char* s, size_t n) {
+ size_t len = strlen(s);
+ if (n < len)
+ len = n;
+- m = uv__malloc(len + 1);
++ m = (char*)uv__malloc(len + 1);
+ if (m == NULL)
+ return NULL;
+ m[len] = '\0';
+- return memcpy(m, s, len);
++ return (char*)memcpy(m, s, len);
+ }
+
+ void* uv__malloc(size_t size) {
+@@ -653,7 +653,7 @@ void uv__fs_scandir_cleanup(uv_fs_t* req) {
+
+ unsigned int* nbufs = uv__get_nbufs(req);
+
+- dents = req->ptr;
++ dents = (uv__dirent_t**)(req->ptr);
+ if (*nbufs > 0 && *nbufs != (unsigned int) req->result)
+ (*nbufs)--;
+ for (; *nbufs < (unsigned int) req->result; (*nbufs)++)
+@@ -680,7 +680,7 @@ int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) {
+ nbufs = uv__get_nbufs(req);
+ assert(nbufs);
+
+- dents = req->ptr;
++ dents = (uv__dirent_t**)(req->ptr);
+
+ /* Free previous entity */
+ if (*nbufs > 0)
+@@ -745,7 +745,7 @@ void uv__fs_readdir_cleanup(uv_fs_t* req) {
+ if (req->ptr == NULL)
+ return;
+
+- dir = req->ptr;
++ dir = (uv_dir_t*)req->ptr;
+ dirents = dir->dirents;
+ req->ptr = NULL;
+
+@@ -791,7 +791,7 @@ uv_loop_t* uv_default_loop(void) {
+ uv_loop_t* uv_loop_new(void) {
+ uv_loop_t* loop;
+
+- loop = uv__malloc(sizeof(*loop));
++ loop = (uv_loop_t*)uv__malloc(sizeof(*loop));
+ if (loop == NULL)
+ return NULL;
+
+diff --git a/src/win/core.c b/src/win/core.c
+index 67af93e6..0752edff 100644
+--- a/src/win/core.c
++++ b/src/win/core.c
+@@ -98,7 +98,8 @@ static int uv__loops_add(uv_loop_t* loop) {
+
+ if (uv__loops_size == uv__loops_capacity) {
+ new_capacity = uv__loops_capacity + UV__LOOPS_CHUNK_SIZE;
+- new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
++ new_loops = (uv_loop_t**)
++ uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
+ if (!new_loops)
+ goto failed_loops_realloc;
+ uv__loops = new_loops;
+@@ -152,7 +153,8 @@ static void uv__loops_remove(uv_loop_t* loop) {
+ smaller_capacity = uv__loops_capacity / 2;
+ if (uv__loops_size >= smaller_capacity)
+ goto loop_removed;
+- new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
++ new_loops = (uv_loop_t**)
++ uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
+ if (!new_loops)
+ goto loop_removed;
+ uv__loops = new_loops;
+@@ -261,7 +263,7 @@ int uv_loop_init(uv_loop_t* loop) {
+
+ loop->endgame_handles = NULL;
+
+- loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap));
++ loop->timer_heap = timer_heap = (heap*)uv__malloc(sizeof(*timer_heap));
+ if (timer_heap == NULL) {
+ err = UV_ENOMEM;
+ goto fail_timers_alloc;
+diff --git a/src/win/fs-event.c b/src/win/fs-event.c
+index 6758c7c7..15046731 100644
+--- a/src/win/fs-event.c
++++ b/src/win/fs-event.c
+@@ -73,7 +73,7 @@ static void uv__relative_path(const WCHAR* filename,
+ if (dirlen > 0 && dir[dirlen - 1] == '\\')
+ dirlen--;
+ relpathlen = filenamelen - dirlen - 1;
+- *relpath = uv__malloc((relpathlen + 1) * sizeof(WCHAR));
++ *relpath = (WCHAR*)uv__malloc((relpathlen + 1) * sizeof(WCHAR));
+ if (!*relpath)
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+ wcsncpy(*relpath, filename + dirlen + 1, relpathlen);
+@@ -242,7 +242,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
+ if (short_path_buffer_len == 0) {
+ goto short_path_done;
+ }
+- short_path_buffer = uv__malloc(short_path_buffer_len * sizeof(WCHAR));
++ short_path_buffer = (WCHAR*)uv__malloc(short_path_buffer_len * sizeof(WCHAR));
+ if (short_path_buffer == NULL) {
+ goto short_path_done;
+ }
+diff --git a/src/win/fs-fd-hash-inl.h b/src/win/fs-fd-hash-inl.h
+index 0b532af1..703a8d8f 100644
+--- a/src/win/fs-fd-hash-inl.h
++++ b/src/win/fs-fd-hash-inl.h
+@@ -146,7 +146,7 @@ INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
+
+ if (bucket_ptr->size != 0 && i == 0) {
+ struct uv__fd_hash_entry_group_s* new_group_ptr =
+- uv__malloc(sizeof(*new_group_ptr));
++ (struct uv__fd_hash_entry_group_s*)uv__malloc(sizeof(*new_group_ptr));
+ if (new_group_ptr == NULL) {
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+ }
+diff --git a/src/win/fs.c b/src/win/fs.c
+index 79230799..8374012f 100644
+--- a/src/win/fs.c
++++ b/src/win/fs.c
+@@ -285,7 +285,7 @@ static int fs__wide_to_utf8(WCHAR* w_source_ptr,
+ return 0;
+ }
+
+- target = uv__malloc(target_len + 1);
++ target = (char*)uv__malloc(target_len + 1);
+ if (target == NULL) {
+ SetLastError(ERROR_OUTOFMEMORY);
+ return -1;
+@@ -1464,7 +1464,7 @@ void fs__scandir(uv_fs_t* req) {
+ if (dirents_used >= dirents_size) {
+ size_t new_dirents_size =
+ dirents_size == 0 ? dirents_initial_size : dirents_size << 1;
+- uv__dirent_t** new_dirents =
++ uv__dirent_t** new_dirents = (uv__dirent_t**)
+ uv__realloc(dirents, new_dirents_size * sizeof *dirents);
+
+ if (new_dirents == NULL)
+@@ -1478,7 +1478,7 @@ void fs__scandir(uv_fs_t* req) {
+ * includes room for the first character of the filename, but `utf8_len`
+ * doesn't count the NULL terminator at this point.
+ */
+- dirent = uv__malloc(sizeof *dirent + utf8_len);
++ dirent = (uv__dirent_t*)uv__malloc(sizeof *dirent + utf8_len);
+ if (dirent == NULL)
+ goto out_of_memory_error;
+
+@@ -1589,7 +1589,7 @@ void fs__opendir(uv_fs_t* req) {
+ goto error;
+ }
+
+- dir = uv__malloc(sizeof(*dir));
++ dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
+ if (dir == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+ goto error;
+@@ -1604,7 +1604,7 @@ void fs__opendir(uv_fs_t* req) {
+ else
+ fmt = L"%s\\*";
+
+- find_path = uv__malloc(sizeof(WCHAR) * (len + 4));
++ find_path = (WCHAR*)uv__malloc(sizeof(WCHAR) * (len + 4));
+ if (find_path == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+ goto error;
+@@ -1641,7 +1641,7 @@ void fs__readdir(uv_fs_t* req) {
+ int r;
+
+ req->flags |= UV_FS_FREE_PTR;
+- dir = req->ptr;
++ dir = (uv_dir_t*)req->ptr;
+ dirents = dir->dirents;
+ memset(dirents, 0, dir->nentries * sizeof(*dir->dirents));
+ find_data = &dir->find_data;
+@@ -1698,7 +1698,7 @@ error:
+ void fs__closedir(uv_fs_t* req) {
+ uv_dir_t* dir;
+
+- dir = req->ptr;
++ dir = (uv_dir_t*)req->ptr;
+ FindClose(dir->dir_handle);
+ uv__free(req->ptr);
+ SET_REQ_RESULT(req, 0);
+@@ -2627,7 +2627,7 @@ static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) {
+ return -1;
+ }
+
+- w_realpath_buf = uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
++ w_realpath_buf = (WCHAR*)uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
+ if (w_realpath_buf == NULL) {
+ SetLastError(ERROR_OUTOFMEMORY);
+ return -1;
+@@ -2738,7 +2738,7 @@ retry_get_disk_free_space:
+ }
+
+ len = MAX_PATH + 1;
+- pathw = uv__malloc(len * sizeof(*pathw));
++ pathw = (WCHAR*)uv__malloc(len * sizeof(*pathw));
+ if (pathw == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+ return;
+@@ -2754,7 +2754,7 @@ retry_get_full_path_name:
+ return;
+ } else if (ret > len) {
+ len = ret;
+- pathw = uv__reallocf(pathw, len * sizeof(*pathw));
++ pathw = (WCHAR*)uv__reallocf(pathw, len * sizeof(*pathw));
+ if (pathw == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+ return;
+@@ -2770,7 +2770,7 @@ retry_get_full_path_name:
+ uv__free(pathw);
+ }
+
+- stat_fs = uv__malloc(sizeof(*stat_fs));
++ stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
+ if (stat_fs == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+ return;
+@@ -2929,7 +2929,7 @@ int uv_fs_read(uv_loop_t* loop,
+ req->fs.info.nbufs = nbufs;
+ req->fs.info.bufs = req->fs.info.bufsml;
+ if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
+- req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
++ req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+
+ if (req->fs.info.bufs == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+@@ -2962,7 +2962,7 @@ int uv_fs_write(uv_loop_t* loop,
+ req->fs.info.nbufs = nbufs;
+ req->fs.info.bufs = req->fs.info.bufsml;
+ if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
+- req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
++ req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+
+ if (req->fs.info.bufs == NULL) {
+ SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+diff --git a/src/win/pipe.c b/src/win/pipe.c
+index 99846181..cd77061a 100644
+--- a/src/win/pipe.c
++++ b/src/win/pipe.c
+@@ -728,7 +728,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
+
+ /* Convert name to UTF16. */
+ nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR);
+- handle->name = uv__malloc(nameSize);
++ handle->name = (WCHAR*)uv__malloc(nameSize);
+ if (!handle->name) {
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+ }
+@@ -841,7 +841,7 @@ void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
+
+ /* Convert name to UTF16. */
+ nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR);
+- handle->name = uv__malloc(nameSize);
++ handle->name = (WCHAR*)uv__malloc(nameSize);
+ if (!handle->name) {
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+ }
+@@ -1453,7 +1453,7 @@ static int uv__build_coalesced_write_req(uv_write_t* user_req,
+ data_length; /* (c) */
+
+ /* Allocate buffer. */
+- heap_buffer = uv__malloc(heap_buffer_length);
++ heap_buffer = (char*)uv__malloc(heap_buffer_length);
+ if (heap_buffer == NULL)
+ return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
+
+@@ -1698,7 +1698,7 @@ int uv__pipe_write_ipc(uv_loop_t* loop,
+ bufs = stack_bufs;
+ } else {
+ /* Use heap-allocated buffer array. */
+- bufs = uv__calloc(buf_count, sizeof(uv_buf_t));
++ bufs = (uv_buf_t*)uv__calloc(buf_count, sizeof(uv_buf_t));
+ if (bufs == NULL)
+ return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
+ }
+@@ -2430,7 +2430,7 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size)
+ FileNameInformation);
+ if (nt_status == STATUS_BUFFER_OVERFLOW) {
+ name_size = sizeof(*name_info) + tmp_name_info.FileNameLength;
+- name_info = uv__malloc(name_size);
++ name_info = (FILE_NAME_INFORMATION*)uv__malloc(name_size);
+ if (!name_info) {
+ *size = 0;
+ err = UV_ENOMEM;
+diff --git a/src/win/process.c b/src/win/process.c
+index 24c63339..e857db3e 100644
+--- a/src/win/process.c
++++ b/src/win/process.c
+@@ -616,8 +616,8 @@ error:
+
+
+ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
+- wchar_t* a_eq;
+- wchar_t* b_eq;
++ const wchar_t* a_eq;
++ const wchar_t* b_eq;
+ wchar_t* A;
+ wchar_t* B;
+ int nb;
+@@ -634,8 +634,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
+ assert(b_eq);
+ nb = b_eq - b;
+
+- A = alloca((na+1) * sizeof(wchar_t));
+- B = alloca((nb+1) * sizeof(wchar_t));
++ A = (wchar_t*)alloca((na+1) * sizeof(wchar_t));
++ B = (wchar_t*)alloca((nb+1) * sizeof(wchar_t));
+
+ r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na);
+ assert(r==na);
+@@ -718,7 +718,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
+ if (dst_copy == NULL && env_len > 0) {
+ return ERROR_OUTOFMEMORY;
+ }
+- env_copy = alloca(env_block_count * sizeof(WCHAR*));
++ env_copy = (WCHAR**)alloca(env_block_count * sizeof(WCHAR*));
+
+ ptr = dst_copy;
+ ptr_copy = env_copy;
+@@ -772,7 +772,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
+ }
+
+ /* final pass: copy, in sort order, and inserting required variables */
+- dst = uv__malloc((1+env_len) * sizeof(WCHAR));
++ dst = (WCHAR*)uv__malloc((1+env_len) * sizeof(WCHAR));
+ if (!dst) {
+ uv__free(dst_copy);
+ return ERROR_OUTOFMEMORY;
+diff --git a/src/win/tcp.c b/src/win/tcp.c
+index b6aa4c51..4cccee42 100644
+--- a/src/win/tcp.c
++++ b/src/win/tcp.c
+@@ -612,7 +612,7 @@ int uv__tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
+
+ if (handle->tcp.serv.accept_reqs == NULL) {
+ handle->tcp.serv.accept_reqs =
+- uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
++ (uv_tcp_accept_t*)uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
+ if (!handle->tcp.serv.accept_reqs) {
+ uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+ }
+diff --git a/src/win/thread.c b/src/win/thread.c
+index d3b1c96b..9ad60c91 100644
+--- a/src/win/thread.c
++++ b/src/win/thread.c
+@@ -98,7 +98,7 @@ static UINT __stdcall uv__thread_start(void* arg) {
+ struct thread_ctx *ctx_p;
+ struct thread_ctx ctx;
+
+- ctx_p = arg;
++ ctx_p = (struct thread_ctx*)arg;
+ ctx = *ctx_p;
+ uv__free(ctx_p);
+
+@@ -141,7 +141,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
+ return UV_EINVAL;
+ }
+
+- ctx = uv__malloc(sizeof(*ctx));
++ ctx = (struct thread_ctx*)uv__malloc(sizeof(*ctx));
+ if (ctx == NULL)
+ return UV_ENOMEM;
+
+diff --git a/src/win/util.c b/src/win/util.c
+index 99432053..c655f532 100644
+--- a/src/win/util.c
++++ b/src/win/util.c
+@@ -164,7 +164,7 @@ int uv_cwd(char* buffer, size_t* size) {
+ if (utf16_len == 0) {
+ return uv_translate_sys_error(GetLastError());
+ }
+- utf16_buffer = uv__malloc(utf16_len * sizeof(WCHAR));
++ utf16_buffer = (WCHAR*)uv__malloc(utf16_len * sizeof(WCHAR));
+ if (utf16_buffer == NULL) {
+ return UV_ENOMEM;
+ }
+@@ -242,7 +242,7 @@ int uv_chdir(const char* dir) {
+ if (utf16_len == 0) {
+ return uv_translate_sys_error(GetLastError());
+ }
+- utf16_buffer = uv__malloc(utf16_len * sizeof(WCHAR));
++ utf16_buffer = (WCHAR*)uv__malloc(utf16_len * sizeof(WCHAR));
+ if (utf16_buffer == NULL) {
+ return UV_ENOMEM;
+ }
+@@ -268,7 +268,7 @@ int uv_chdir(const char* dir) {
+ new_utf16_len = GetCurrentDirectoryW(utf16_len, utf16_buffer);
+ if (new_utf16_len > utf16_len ) {
+ uv__free(utf16_buffer);
+- utf16_buffer = uv__malloc(new_utf16_len * sizeof(WCHAR));
++ utf16_buffer = (WCHAR*)uv__malloc(new_utf16_len * sizeof(WCHAR));
+ if (utf16_buffer == NULL) {
+ /* When updating the environment variable fails, return UV_OK anyway.
+ * We did successfully change current working directory, only updating
+@@ -573,14 +573,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
+ GetSystemInfo(&system_info);
+ cpu_count = system_info.dwNumberOfProcessors;
+
+- cpu_infos = uv__calloc(cpu_count, sizeof *cpu_infos);
++ cpu_infos = (uv_cpu_info_t*)uv__calloc(cpu_count, sizeof *cpu_infos);
+ if (cpu_infos == NULL) {
+ err = ERROR_OUTOFMEMORY;
+ goto error;
+ }
+
+ sppi_size = cpu_count * sizeof(*sppi);
+- sppi = uv__malloc(sppi_size);
++ sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)uv__malloc(sppi_size);
+ if (sppi == NULL) {
+ err = ERROR_OUTOFMEMORY;
+ goto error;
+@@ -802,7 +802,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
+ case ERROR_BUFFER_OVERFLOW:
+ /* This happens when win_address_buf is NULL or too small to hold all
+ * adapters. */
+- win_address_buf = uv__malloc(win_address_buf_size);
++ win_address_buf =
++ (IP_ADAPTER_ADDRESSES*)uv__malloc(win_address_buf_size);
+ if (win_address_buf == NULL)
+ return UV_ENOMEM;
+
+@@ -810,7 +811,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
+
+ case ERROR_NO_DATA: {
+ /* No adapters were found. */
+- uv_address_buf = uv__malloc(1);
++ uv_address_buf = (uv_interface_address_t*)uv__malloc(1);
+ if (uv_address_buf == NULL)
+ return UV_ENOMEM;
+
+@@ -887,7 +888,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
+ }
+
+ /* Allocate space to store interface data plus adapter names. */
+- uv_address_buf = uv__malloc(uv_address_buf_size);
++ uv_address_buf = (uv_interface_address_t*)uv__malloc(uv_address_buf_size);
+ if (uv_address_buf == NULL) {
+ uv__free(win_address_buf);
+ return UV_ENOMEM;
+@@ -1131,7 +1132,7 @@ int uv_os_tmpdir(char* buffer, size_t* size) {
+ }
+ /* Include space for terminating null char. */
+ len += 1;
+- path = uv__malloc(len * sizeof(wchar_t));
++ path = (wchar_t*)uv__malloc(len * sizeof(wchar_t));
+ if (path == NULL) {
+ return UV_ENOMEM;
+ }
+@@ -1221,7 +1222,7 @@ int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8) {
+ /* Allocate the destination buffer adding an extra byte for the terminating
+ * NULL. If utf16len is not -1 WideCharToMultiByte will not add it, so
+ * we do it ourselves always, just in case. */
+- *utf8 = uv__malloc(bufsize + 1);
++ *utf8 = (char*)uv__malloc(bufsize + 1);
+
+ if (*utf8 == NULL)
+ return UV_ENOMEM;
+@@ -1269,7 +1270,7 @@ int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16) {
+ /* Allocate the destination buffer adding an extra byte for the terminating
+ * NULL. If utf8len is not -1 MultiByteToWideChar will not add it, so
+ * we do it ourselves always, just in case. */
+- *utf16 = uv__malloc(sizeof(WCHAR) * (bufsize + 1));
++ *utf16 = (WCHAR*)uv__malloc(sizeof(WCHAR) * (bufsize + 1));
+
+ if (*utf16 == NULL)
+ return UV_ENOMEM;
+@@ -1310,7 +1311,7 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
+ return uv_translate_sys_error(r);
+ }
+
+- path = uv__malloc(bufsize * sizeof(wchar_t));
++ path = (wchar_t*)uv__malloc(bufsize * sizeof(wchar_t));
+ if (path == NULL) {
+ CloseHandle(token);
+ return UV_ENOMEM;
+@@ -1381,7 +1382,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
+
+ for (penv = env, i = 0; *penv != L'\0'; penv += wcslen(penv) + 1, i++);
+
+- *envitems = uv__calloc(i, sizeof(**envitems));
++ *envitems = (uv_env_item_t*)uv__calloc(i, sizeof(**envitems));
+ if (*envitems == NULL) {
+ FreeEnvironmentStringsW(env);
+ return UV_ENOMEM;
+@@ -1471,7 +1472,7 @@ int uv_os_getenv(const char* name, char* buffer, size_t* size) {
+ uv__free(var);
+
+ varlen = 1 + len;
+- var = uv__malloc(varlen * sizeof(*var));
++ var = (wchar_t*)uv__malloc(varlen * sizeof(*var));
+
+ if (var == NULL) {
+ r = UV_ENOMEM;
diff --git a/upstream_utils/libuv_patches/0002-Fix-warnings.patch b/upstream_utils/libuv_patches/0002-Fix-warnings.patch
new file mode 100644
index 0000000..fedaea0
--- /dev/null
+++ b/upstream_utils/libuv_patches/0002-Fix-warnings.patch
@@ -0,0 +1,365 @@
+From f7b4492d37b35a64a3a6c5bbbdb375494095b6ff Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:09:43 -0400
+Subject: [PATCH 2/9] Fix warnings
+
+---
+ include/uv/win.h | 5 +++
+ src/idna.c | 2 +-
+ src/inet.c | 4 ++
+ src/threadpool.c | 4 ++
+ src/unix/core.c | 12 ++++-
+ src/unix/darwin.c | 106 +++++++++++++++++++++++---------------------
+ src/unix/internal.h | 4 +-
+ src/unix/thread.c | 6 ---
+ src/uv-common.c | 8 ++++
+ src/win/fs-event.c | 2 +
+ src/win/fs.c | 2 +
+ src/win/pipe.c | 2 +
+ src/win/process.c | 2 +
+ src/win/tty.c | 2 +
+ 14 files changed, 99 insertions(+), 62 deletions(-)
+
+diff --git a/include/uv/win.h b/include/uv/win.h
+index 56a4cf11..10d5e8f1 100644
+--- a/include/uv/win.h
++++ b/include/uv/win.h
+@@ -201,11 +201,16 @@ typedef int (WSAAPI* LPFN_WSARECVFROM)
+ LPWSAOVERLAPPED overlapped,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
+
++#pragma warning(push)
++#pragma warning(disable : 28251)
++
+ #ifndef _NTDEF_
+ typedef LONG NTSTATUS;
+ typedef NTSTATUS *PNTSTATUS;
+ #endif
+
++#pragma warning(pop)
++
+ #ifndef RTL_CONDITION_VARIABLE_INIT
+ typedef PVOID CONDITION_VARIABLE, *PCONDITION_VARIABLE;
+ #endif
+diff --git a/src/idna.c b/src/idna.c
+index 93d982ca..36a39a08 100644
+--- a/src/idna.c
++++ b/src/idna.c
+@@ -106,7 +106,7 @@ static int uv__idna_toascii_label(const char* s, const char* se,
+ char** d, char* de) {
+ static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz0123456789";
+ const char* ss;
+- unsigned c;
++ unsigned c = 0;
+ unsigned h;
+ unsigned k;
+ unsigned n;
+diff --git a/src/inet.c b/src/inet.c
+index ca8b6ac8..1b190255 100644
+--- a/src/inet.c
++++ b/src/inet.c
+@@ -27,6 +27,10 @@
+ #include "uv.h"
+ #include "uv-common.h"
+
++#ifdef _WIN32
++#pragma warning(disable : 6001)
++#endif
++
+ #define UV__INET_ADDRSTRLEN 16
+ #define UV__INET6_ADDRSTRLEN 46
+
+diff --git a/src/threadpool.c b/src/threadpool.c
+index 1241ace1..718972c3 100644
+--- a/src/threadpool.c
++++ b/src/threadpool.c
+@@ -27,6 +27,10 @@
+
+ #include <stdlib.h>
+
++#ifdef _WIN32
++#pragma warning(disable: 6001 6011)
++#endif
++
+ #define MAX_THREADPOOL_SIZE 1024
+
+ static uv_once_t once = UV_ONCE_INIT;
+diff --git a/src/unix/core.c b/src/unix/core.c
+index 6353b0e3..223c5513 100644
+--- a/src/unix/core.c
++++ b/src/unix/core.c
+@@ -544,6 +544,16 @@ int uv__accept(int sockfd) {
+ return peerfd;
+ }
+
++#if defined(__APPLE__)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
++#if defined(__LP64__)
++ extern "C" int close$NOCANCEL(int);
++#else
++ extern "C" int close$NOCANCEL$UNIX2003(int);
++#endif
++#pragma GCC diagnostic pop
++#endif
+
+ /* close() on macos has the "interesting" quirk that it fails with EINTR
+ * without closing the file descriptor when a thread is in the cancel state.
+@@ -558,10 +568,8 @@ int uv__close_nocancel(int fd) {
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
+ #if defined(__LP64__) || TARGET_OS_IPHONE
+- extern int close$NOCANCEL(int);
+ return close$NOCANCEL(fd);
+ #else
+- extern int close$NOCANCEL$UNIX2003(int);
+ return close$NOCANCEL$UNIX2003(fd);
+ #endif
+ #pragma GCC diagnostic pop
+diff --git a/src/unix/darwin.c b/src/unix/darwin.c
+index 5fbf7342..eeb35720 100644
+--- a/src/unix/darwin.c
++++ b/src/unix/darwin.c
+@@ -253,64 +253,68 @@ static int uv__get_cpu_speed(uint64_t* speed) {
+
+ #define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8)
+
+- kr = pIOMasterPort(MACH_PORT_NULL, &mach_port);
+- assert(kr == KERN_SUCCESS);
+- CFMutableDictionaryRef classes_to_match
+- = pIOServiceMatching("IOPlatformDevice");
+- kr = pIOServiceGetMatchingServices(mach_port, classes_to_match, &it);
+- assert(kr == KERN_SUCCESS);
+- service = pIOIteratorNext(it);
+-
+- CFStringRef device_type_str = S("device_type");
+- CFStringRef clock_frequency_str = S("clock-frequency");
+-
+- while (service != 0) {
+- CFDataRef data;
+- data = pIORegistryEntryCreateCFProperty(service,
+- device_type_str,
+- NULL,
+- 0);
+- if (data) {
+- const UInt8* raw = pCFDataGetBytePtr(data);
+- if (strncmp((char*)raw, "cpu", 3) == 0 ||
+- strncmp((char*)raw, "processor", 9) == 0) {
+- CFDataRef freq_ref;
+- freq_ref = pIORegistryEntryCreateCFProperty(service,
+- clock_frequency_str,
+- NULL,
+- 0);
+- if (freq_ref) {
+- const UInt8* freq_ref_ptr = pCFDataGetBytePtr(freq_ref);
+- CFIndex len = pCFDataGetLength(freq_ref);
+- if (len == 8)
+- memcpy(speed, freq_ref_ptr, 8);
+- else if (len == 4) {
+- uint32_t v;
+- memcpy(&v, freq_ref_ptr, 4);
+- *speed = v;
+- } else {
+- *speed = 0;
+- }
++ // Braces ensure goto doesn't jump into device_type_str's and
++ // clock_frequency_str's lifetimes after their initialization
++ {
++ kr = pIOMasterPort(MACH_PORT_NULL, &mach_port);
++ assert(kr == KERN_SUCCESS);
++ CFMutableDictionaryRef classes_to_match
++ = pIOServiceMatching("IOPlatformDevice");
++ kr = pIOServiceGetMatchingServices(mach_port, classes_to_match, &it);
++ assert(kr == KERN_SUCCESS);
++ service = pIOIteratorNext(it);
+
+- pCFRelease(freq_ref);
+- pCFRelease(data);
+- break;
++ CFStringRef device_type_str = S("device_type");
++ CFStringRef clock_frequency_str = S("clock-frequency");
++
++ while (service != 0) {
++ CFDataRef data;
++ data = pIORegistryEntryCreateCFProperty(service,
++ device_type_str,
++ NULL,
++ 0);
++ if (data) {
++ const UInt8* raw = pCFDataGetBytePtr(data);
++ if (strncmp((char*)raw, "cpu", 3) == 0 ||
++ strncmp((char*)raw, "processor", 9) == 0) {
++ CFDataRef freq_ref;
++ freq_ref = pIORegistryEntryCreateCFProperty(service,
++ clock_frequency_str,
++ NULL,
++ 0);
++ if (freq_ref) {
++ const UInt8* freq_ref_ptr = pCFDataGetBytePtr(freq_ref);
++ CFIndex len = pCFDataGetLength(freq_ref);
++ if (len == 8)
++ memcpy(speed, freq_ref_ptr, 8);
++ else if (len == 4) {
++ uint32_t v;
++ memcpy(&v, freq_ref_ptr, 4);
++ *speed = v;
++ } else {
++ *speed = 0;
++ }
++
++ pCFRelease(freq_ref);
++ pCFRelease(data);
++ break;
++ }
+ }
++ pCFRelease(data);
+ }
+- pCFRelease(data);
+- }
+
+- service = pIOIteratorNext(it);
+- }
++ service = pIOIteratorNext(it);
++ }
+
+- pIOObjectRelease(it);
++ pIOObjectRelease(it);
+
+- err = 0;
++ err = 0;
+
+- if (device_type_str != NULL)
+- pCFRelease(device_type_str);
+- if (clock_frequency_str != NULL)
+- pCFRelease(clock_frequency_str);
++ if (device_type_str != NULL)
++ pCFRelease(device_type_str);
++ if (clock_frequency_str != NULL)
++ pCFRelease(clock_frequency_str);
++ }
+
+ out:
+ if (core_foundation_handle != NULL)
+diff --git a/src/unix/internal.h b/src/unix/internal.h
+index cee35c21..f9d1666d 100644
+--- a/src/unix/internal.h
++++ b/src/unix/internal.h
+@@ -312,8 +312,8 @@ UV_UNUSED(static void uv__update_time(uv_loop_t* loop)) {
+ loop->time = uv__hrtime(UV_CLOCK_FAST) / 1000000;
+ }
+
+-UV_UNUSED(static char* uv__basename_r(const char* path)) {
+- char* s;
++UV_UNUSED(static const char* uv__basename_r(const char* path)) {
++ const char* s;
+
+ s = strrchr(path, '/');
+ if (s == NULL)
+diff --git a/src/unix/thread.c b/src/unix/thread.c
+index 759cd0c2..64726bd6 100644
+--- a/src/unix/thread.c
++++ b/src/unix/thread.c
+@@ -244,12 +244,6 @@ int uv_thread_create_ex(uv_thread_t* tid,
+ size_t stack_size;
+ size_t min_stack_size;
+
+- /* Used to squelch a -Wcast-function-type warning. */
+- union {
+- void (*in)(void*);
+- void* (*out)(void*);
+- } f;
+-
+ stack_size =
+ params->flags & UV_THREAD_HAS_STACK_SIZE ? params->stack_size : 0;
+
+diff --git a/src/uv-common.c b/src/uv-common.c
+index dfb606e3..49026c03 100644
+--- a/src/uv-common.c
++++ b/src/uv-common.c
+@@ -758,6 +758,10 @@ void uv__fs_readdir_cleanup(uv_fs_t* req) {
+ }
+ }
+
++#ifdef __clang__
++# pragma clang diagnostic push
++# pragma clang diagnostic ignored "-Wvarargs"
++#endif
+
+ int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) {
+ va_list ap;
+@@ -771,6 +775,10 @@ int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) {
+ return err;
+ }
+
++#ifdef __clang__
++# pragma clang diagnostic pop
++#endif
++
+
+ static uv_loop_t default_loop_struct;
+ static uv_loop_t* default_loop_ptr;
+diff --git a/src/win/fs-event.c b/src/win/fs-event.c
+index 15046731..3244a4e4 100644
+--- a/src/win/fs-event.c
++++ b/src/win/fs-event.c
+@@ -19,6 +19,8 @@
+ * IN THE SOFTWARE.
+ */
+
++#define _CRT_NONSTDC_NO_WARNINGS
++
+ #include <assert.h>
+ #include <errno.h>
+ #include <stdio.h>
+diff --git a/src/win/fs.c b/src/win/fs.c
+index 8374012f..f71b3c04 100644
+--- a/src/win/fs.c
++++ b/src/win/fs.c
+@@ -19,6 +19,8 @@
+ * IN THE SOFTWARE.
+ */
+
++#define _CRT_NONSTDC_NO_WARNINGS
++
+ #include <assert.h>
+ #include <stdlib.h>
+ #include <direct.h>
+diff --git a/src/win/pipe.c b/src/win/pipe.c
+index cd77061a..f413a72d 100644
+--- a/src/win/pipe.c
++++ b/src/win/pipe.c
+@@ -19,6 +19,8 @@
+ * IN THE SOFTWARE.
+ */
+
++#define _CRT_NONSTDC_NO_WARNINGS
++
+ #include <assert.h>
+ #include <io.h>
+ #include <stdio.h>
+diff --git a/src/win/process.c b/src/win/process.c
+index e857db3e..a49016f6 100644
+--- a/src/win/process.c
++++ b/src/win/process.c
+@@ -19,6 +19,8 @@
+ * IN THE SOFTWARE.
+ */
+
++#define _CRT_NONSTDC_NO_WARNINGS
++
+ #include <assert.h>
+ #include <io.h>
+ #include <stdio.h>
+diff --git a/src/win/tty.c b/src/win/tty.c
+index 267ca645..d7522668 100644
+--- a/src/win/tty.c
++++ b/src/win/tty.c
+@@ -19,6 +19,8 @@
+ * IN THE SOFTWARE.
+ */
+
++#define _CRT_NONSTDC_NO_WARNINGS
++
+ #include <assert.h>
+ #include <io.h>
+ #include <string.h>
diff --git a/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch b/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch
new file mode 100644
index 0000000..f55f5cc
--- /dev/null
+++ b/upstream_utils/libuv_patches/0003-Preprocessor-cleanup.patch
@@ -0,0 +1,179 @@
+From dec4f95751a103f132e9674adf184188ec69176f Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:19:14 -0400
+Subject: [PATCH 3/9] Preprocessor cleanup
+
+---
+ include/uv.h | 18 +-----------------
+ include/uv/unix.h | 8 --------
+ include/uv/win.h | 6 +-----
+ src/unix/internal.h | 2 ++
+ src/win/fs.c | 1 +
+ src/win/tty.c | 2 ++
+ src/win/util.c | 8 ++++++++
+ src/win/winsock.c | 1 +
+ 8 files changed, 16 insertions(+), 30 deletions(-)
+
+diff --git a/include/uv.h b/include/uv.h
+index ee1c94cc..dbaeb1e9 100644
+--- a/include/uv.h
++++ b/include/uv.h
+@@ -23,9 +23,6 @@
+
+ #ifndef UV_H
+ #define UV_H
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+
+ #if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED)
+ #error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both."
+@@ -56,11 +53,7 @@ extern "C" {
+ #include <stddef.h>
+ #include <stdio.h>
+
+-#if defined(_MSC_VER) && _MSC_VER < 1600
+-# include "uv/stdint-msvc2008.h"
+-#else
+-# include <stdint.h>
+-#endif
++#include <stdint.h>
+
+ #if defined(_WIN32)
+ # include "uv/win.h"
+@@ -767,16 +760,10 @@ UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
+ UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state);
+ UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state);
+
+-#ifdef __cplusplus
+-extern "C++" {
+-
+ inline int uv_tty_set_mode(uv_tty_t* handle, int mode) {
+ return uv_tty_set_mode(handle, static_cast<uv_tty_mode_t>(mode));
+ }
+
+-}
+-#endif
+-
+ UV_EXTERN uv_handle_type uv_guess_handle(uv_file file);
+
+ /*
+@@ -1844,7 +1831,4 @@ UV_EXTERN void uv_loop_set_data(uv_loop_t*, void* data);
+ #undef UV_LOOP_PRIVATE_PLATFORM_FIELDS
+ #undef UV__ERR
+
+-#ifdef __cplusplus
+-}
+-#endif
+ #endif /* UV_H */
+diff --git a/include/uv/unix.h b/include/uv/unix.h
+index 420be86c..256fef37 100644
+--- a/include/uv/unix.h
++++ b/include/uv/unix.h
+@@ -47,14 +47,6 @@
+
+ #if defined(__linux__)
+ # include "uv/linux.h"
+-#elif defined (__MVS__)
+-# include "uv/os390.h"
+-#elif defined(__PASE__) /* __PASE__ and _AIX are both defined on IBM i */
+-# include "uv/posix.h" /* IBM i needs uv/posix.h, not uv/aix.h */
+-#elif defined(_AIX)
+-# include "uv/aix.h"
+-#elif defined(__sun)
+-# include "uv/sunos.h"
+ #elif defined(__APPLE__)
+ # include "uv/darwin.h"
+ #elif defined(__DragonFly__) || \
+diff --git a/include/uv/win.h b/include/uv/win.h
+index 10d5e8f1..0a33366f 100644
+--- a/include/uv/win.h
++++ b/include/uv/win.h
+@@ -60,11 +60,7 @@ typedef struct pollfd {
+ #include <fcntl.h>
+ #include <sys/stat.h>
+
+-#if defined(_MSC_VER) && _MSC_VER < 1600
+-# include "uv/stdint-msvc2008.h"
+-#else
+-# include <stdint.h>
+-#endif
++#include <stdint.h>
+
+ #include "uv/tree.h"
+ #include "uv/threadpool.h"
+diff --git a/src/unix/internal.h b/src/unix/internal.h
+index f9d1666d..2b654157 100644
+--- a/src/unix/internal.h
++++ b/src/unix/internal.h
+@@ -192,6 +192,8 @@ struct uv__stream_queued_fds_s {
+ #if defined(__linux__) && O_NDELAY != O_NONBLOCK
+ #undef uv__nonblock
+ #define uv__nonblock uv__nonblock_fcntl
++#undef UV__NONBLOCK_IS_IOCTL
++#define UV__NONBLOCK_IS_FCNTL
+ #endif
+
+ /* core */
+diff --git a/src/win/fs.c b/src/win/fs.c
+index f71b3c04..71c9b169 100644
+--- a/src/win/fs.c
++++ b/src/win/fs.c
+@@ -38,6 +38,7 @@
+ #include "handle-inl.h"
+ #include "fs-fd-hash-inl.h"
+
++#pragma comment(lib, "Advapi32.lib")
+
+ #define UV_FS_FREE_PATHS 0x0002
+ #define UV_FS_FREE_PTR 0x0008
+diff --git a/src/win/tty.c b/src/win/tty.c
+index d7522668..9753784d 100644
+--- a/src/win/tty.c
++++ b/src/win/tty.c
+@@ -42,6 +42,8 @@
+ #include "stream-inl.h"
+ #include "req-inl.h"
+
++#pragma comment(lib, "User32.lib")
++
+ #ifndef InterlockedOr
+ # define InterlockedOr _InterlockedOr
+ #endif
+diff --git a/src/win/util.c b/src/win/util.c
+index c655f532..7a5dd2ef 100644
+--- a/src/win/util.c
++++ b/src/win/util.c
+@@ -63,12 +63,20 @@
+
+
+ /* A RtlGenRandom() by any other name... */
++extern "C" {
+ extern BOOLEAN NTAPI SystemFunction036(PVOID Buffer, ULONG BufferLength);
++}
+
+ /* Cached copy of the process title, plus a mutex guarding it. */
+ static char *process_title;
+ static CRITICAL_SECTION process_title_lock;
+
++#pragma comment(lib, "Advapi32.lib")
++#pragma comment(lib, "IPHLPAPI.lib")
++#pragma comment(lib, "Psapi.lib")
++#pragma comment(lib, "Userenv.lib")
++#pragma comment(lib, "kernel32.lib")
++
+ /* Frequency of the high-resolution clock. */
+ static uint64_t hrtime_frequency_ = 0;
+
+diff --git a/src/win/winsock.c b/src/win/winsock.c
+index a68b0953..7843e9f1 100644
+--- a/src/win/winsock.c
++++ b/src/win/winsock.c
+@@ -25,6 +25,7 @@
+ #include "uv.h"
+ #include "internal.h"
+
++#pragma comment(lib, "Ws2_32.lib")
+
+ /* Whether there are any non-IFS LSPs stacked on TCP */
+ int uv_tcp_non_ifs_lsp_ipv4;
diff --git a/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch b/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch
new file mode 100644
index 0000000..a29043b
--- /dev/null
+++ b/upstream_utils/libuv_patches/0004-Cleanup-problematic-language.patch
@@ -0,0 +1,61 @@
+From 2d06f216dec3abbeaaabb465b945e09856d1b687 Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:24:47 -0400
+Subject: [PATCH 4/9] Cleanup problematic language
+
+---
+ src/unix/tty.c | 21 +++++++++++----------
+ 1 file changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/src/unix/tty.c b/src/unix/tty.c
+index b4150525..ed81e26a 100644
+--- a/src/unix/tty.c
++++ b/src/unix/tty.c
+@@ -79,7 +79,7 @@ int uv__tcsetattr(int fd, int how, const struct termios *term) {
+ return 0;
+ }
+
+-static int uv__tty_is_slave(const int fd) {
++static int uv__tty_is_peripheral(const int fd) {
+ int result;
+ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ int dummy;
+@@ -91,15 +91,16 @@ static int uv__tty_is_slave(const int fd) {
+ result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0;
+ #elif defined(__NetBSD__)
+ /*
+- * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the slave
+- * device name for both descriptors, the master one and slave one.
++ * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the
++ * peripheral device name for both descriptors, the controller one and
++ * peripheral one.
+ *
+ * Implement function to compare major device number with pts devices.
+ *
+ * The major numbers are machine-dependent, on NetBSD/amd64 they are
+ * respectively:
+- * - master tty: ptc - major 6
+- * - slave tty: pts - major 5
++ * - controller tty: ptc - major 6
++ * - peripheral tty: pts - major 5
+ */
+
+ struct stat sb;
+@@ -174,12 +175,12 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) {
+ * other processes.
+ */
+ if (type == UV_TTY) {
+- /* Reopening a pty in master mode won't work either because the reopened
+- * pty will be in slave mode (*BSD) or reopening will allocate a new
+- * master/slave pair (Linux). Therefore check if the fd points to a
+- * slave device.
++ /* Reopening a pty in controller mode won't work either because the reopened
++ * pty will be in peripheral mode (*BSD) or reopening will allocate a new
++ * controller/peripheral pair (Linux). Therefore check if the fd points to a
++ * peripheral device.
+ */
+- if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0)
++ if (uv__tty_is_peripheral(fd) && ttyname_r(fd, path, sizeof(path)) == 0)
+ r = uv__open_cloexec(path, mode | O_NOCTTY);
+ else
+ r = -1;
diff --git a/upstream_utils/libuv_patches/0005-Use-roborio-time.patch b/upstream_utils/libuv_patches/0005-Use-roborio-time.patch
new file mode 100644
index 0000000..46cc46f
--- /dev/null
+++ b/upstream_utils/libuv_patches/0005-Use-roborio-time.patch
@@ -0,0 +1,42 @@
+From 690d487df2e60a01ab811aba34587466a38caead Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:26:03 -0400
+Subject: [PATCH 5/9] Use roborio time
+
+---
+ src/unix/linux-core.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c
+index 85f3fc01..12ed7ff1 100644
+--- a/src/unix/linux-core.c
++++ b/src/unix/linux-core.c
+@@ -67,6 +67,10 @@
+ # define CLOCK_MONOTONIC_COARSE 6
+ #endif
+
++#ifdef __FRC_ROBORIO__
++#include "wpi/timestamp.h"
++#endif
++
+ /* This is rather annoying: CLOCK_BOOTTIME lives in <linux/time.h> but we can't
+ * include that file because it conflicts with <time.h>. We'll just have to
+ * define it ourselves.
+@@ -118,6 +122,9 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
+
+
+ uint64_t uv__hrtime(uv_clocktype_t type) {
++#ifdef __FRC_ROBORIO__
++ return wpi::Now() * 1000u;
++#else
+ static clock_t fast_clock_id = -1;
+ struct timespec t;
+ clock_t clock_id;
+@@ -151,6 +158,7 @@ done:
+ return 0; /* Not really possible. */
+
+ return t.tv_sec * (uint64_t) 1e9 + t.tv_nsec;
++#endif
+ }
+
+
diff --git a/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch b/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch
new file mode 100644
index 0000000..964d944
--- /dev/null
+++ b/upstream_utils/libuv_patches/0006-Style-comments-cleanup.patch
@@ -0,0 +1,102 @@
+From ad60aa8e1c03cc5f0c88159d37f63b0c063927c7 Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:28:52 -0400
+Subject: [PATCH 6/9] Style / comments cleanup
+
+---
+ src/fs-poll.c | 1 +
+ src/unix/core.c | 1 +
+ src/unix/thread.c | 3 +--
+ src/uv-common.c | 1 +
+ src/win/process.c | 1 -
+ src/win/winsock.c | 1 +
+ 6 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/fs-poll.c b/src/fs-poll.c
+index 5a39daed..1a7ca70d 100644
+--- a/src/fs-poll.c
++++ b/src/fs-poll.c
+@@ -34,6 +34,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+
++
+ struct poll_ctx {
+ uv_fs_poll_t* parent_handle;
+ int busy_polling;
+diff --git a/src/unix/core.c b/src/unix/core.c
+index 223c5513..4c23f608 100644
+--- a/src/unix/core.c
++++ b/src/unix/core.c
+@@ -544,6 +544,7 @@ int uv__accept(int sockfd) {
+ return peerfd;
+ }
+
++
+ #if defined(__APPLE__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
+diff --git a/src/unix/thread.c b/src/unix/thread.c
+index 64726bd6..392a0715 100644
+--- a/src/unix/thread.c
++++ b/src/unix/thread.c
+@@ -85,7 +85,6 @@ error2:
+ return rc;
+ }
+
+-
+ int uv_barrier_wait(uv_barrier_t* barrier) {
+ struct _uv_barrier* b;
+ int last;
+@@ -94,6 +93,7 @@ int uv_barrier_wait(uv_barrier_t* barrier) {
+ return UV_EINVAL;
+
+ b = barrier->b;
++ /* Lock the mutex*/
+ uv_mutex_lock(&b->mutex);
+
+ if (++b->in == b->threshold) {
+@@ -113,7 +113,6 @@ int uv_barrier_wait(uv_barrier_t* barrier) {
+ return last;
+ }
+
+-
+ void uv_barrier_destroy(uv_barrier_t* barrier) {
+ struct _uv_barrier* b;
+
+diff --git a/src/uv-common.c b/src/uv-common.c
+index 49026c03..c9a32c03 100644
+--- a/src/uv-common.c
++++ b/src/uv-common.c
+@@ -758,6 +758,7 @@ void uv__fs_readdir_cleanup(uv_fs_t* req) {
+ }
+ }
+
++
+ #ifdef __clang__
+ # pragma clang diagnostic push
+ # pragma clang diagnostic ignored "-Wvarargs"
+diff --git a/src/win/process.c b/src/win/process.c
+index a49016f6..8e7835a5 100644
+--- a/src/win/process.c
++++ b/src/win/process.c
+@@ -35,7 +35,6 @@
+ #include "handle-inl.h"
+ #include "req-inl.h"
+
+-
+ #define SIGKILL 9
+
+
+diff --git a/src/win/winsock.c b/src/win/winsock.c
+index 7843e9f1..cda82bc3 100644
+--- a/src/win/winsock.c
++++ b/src/win/winsock.c
+@@ -25,6 +25,7 @@
+ #include "uv.h"
+ #include "internal.h"
+
++
+ #pragma comment(lib, "Ws2_32.lib")
+
+ /* Whether there are any non-IFS LSPs stacked on TCP */
diff --git a/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch b/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch
new file mode 100644
index 0000000..92032da
--- /dev/null
+++ b/upstream_utils/libuv_patches/0007-Squelch-GCC-12.1-warnings.patch
@@ -0,0 +1,52 @@
+From ee8a72764f602928cc08d16d661602c0aefde050 Mon Sep 17 00:00:00 2001
+From: Tyler Veness <calcmogul@gmail.com>
+Date: Tue, 17 May 2022 21:36:57 -0700
+Subject: [PATCH 7/9] Squelch GCC 12.1 warnings
+
+---
+ src/unix/stream.c | 9 +++++++++
+ src/uv-common.c | 9 +++++++++
+ 2 files changed, 18 insertions(+)
+
+diff --git a/src/unix/stream.c b/src/unix/stream.c
+index c6cc50e7..fa25812a 100644
+--- a/src/unix/stream.c
++++ b/src/unix/stream.c
+@@ -938,7 +938,16 @@ static void uv__write_callbacks(uv_stream_t* stream) {
+ if (QUEUE_EMPTY(&stream->write_completed_queue))
+ return;
+
++// FIXME: GCC 12.1 gives a possibly real warning, but we don't know how to fix
++// it
++#if __GNUC__ >= 12
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wdangling-pointer="
++#endif // __GNUC__ >= 12
+ QUEUE_MOVE(&stream->write_completed_queue, &pq);
++#if __GNUC__ >= 12
++#pragma GCC diagnostic pop
++#endif // __GNUC__ >= 12
+
+ while (!QUEUE_EMPTY(&pq)) {
+ /* Pop a req off write_completed_queue. */
+diff --git a/src/uv-common.c b/src/uv-common.c
+index c9a32c03..8ab600df 100644
+--- a/src/uv-common.c
++++ b/src/uv-common.c
+@@ -504,7 +504,16 @@ void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) {
+ QUEUE* q;
+ uv_handle_t* h;
+
++// FIXME: GCC 12.1 gives a possibly real warning, but we don't know how to fix
++// it
++#if __GNUC__ >= 12
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wdangling-pointer="
++#endif // __GNUC__ >= 12
+ QUEUE_MOVE(&loop->handle_queue, &queue);
++#if __GNUC__ >= 12
++#pragma GCC diagnostic pop
++#endif // __GNUC__ >= 12
+ while (!QUEUE_EMPTY(&queue)) {
+ q = QUEUE_HEAD(&queue);
+ h = QUEUE_DATA(q, uv_handle_t, handle_queue);
diff --git a/upstream_utils/libuv_patches/0008-Fix-Win32-warning-suppression-pragma.patch b/upstream_utils/libuv_patches/0008-Fix-Win32-warning-suppression-pragma.patch
new file mode 100644
index 0000000..bdc5f61
--- /dev/null
+++ b/upstream_utils/libuv_patches/0008-Fix-Win32-warning-suppression-pragma.patch
@@ -0,0 +1,22 @@
+From 49d5945dde1d182fd2d75cdf550120951796cb1f Mon Sep 17 00:00:00 2001
+From: Tyler Veness <calcmogul@gmail.com>
+Date: Sat, 21 May 2022 22:58:06 -0700
+Subject: [PATCH 8/9] Fix Win32 warning suppression pragma
+
+---
+ src/win/util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/win/util.c b/src/win/util.c
+index 7a5dd2ef..d9888aec 100644
+--- a/src/win/util.c
++++ b/src/win/util.c
+@@ -1750,7 +1750,7 @@ int uv_os_uname(uv_utsname_t* buffer) {
+ } else {
+ /* Silence GetVersionEx() deprecation warning. */
+ #ifdef _MSC_VER
+- #pragma warning(suppress : 4996)
++ #pragma warning(disable : 4996)
+ #endif
+ if (GetVersionExW(&os_info) == 0) {
+ r = uv_translate_sys_error(GetLastError());
diff --git a/upstream_utils/libuv_patches/0009-Avoid-unused-variable-warning-on-Mac.patch b/upstream_utils/libuv_patches/0009-Avoid-unused-variable-warning-on-Mac.patch
new file mode 100644
index 0000000..8db2deb
--- /dev/null
+++ b/upstream_utils/libuv_patches/0009-Avoid-unused-variable-warning-on-Mac.patch
@@ -0,0 +1,21 @@
+From d83eaeff1f53bc3dede8a46a05cdb3ca94d1aac4 Mon Sep 17 00:00:00 2001
+From: Peter Johnson <johnson.peter@gmail.com>
+Date: Sun, 5 Jun 2022 15:40:35 -0700
+Subject: [PATCH 9/9] Avoid unused variable warning on Mac
+
+---
+ src/unix/darwin.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/unix/darwin.c b/src/unix/darwin.c
+index eeb35720..ed51a6ad 100644
+--- a/src/unix/darwin.c
++++ b/src/unix/darwin.c
+@@ -257,6 +257,7 @@ static int uv__get_cpu_speed(uint64_t* speed) {
+ // clock_frequency_str's lifetimes after their initialization
+ {
+ kr = pIOMasterPort(MACH_PORT_NULL, &mach_port);
++ (void) kr;
+ assert(kr == KERN_SUCCESS);
+ CFMutableDictionaryRef classes_to_match
+ = pIOServiceMatching("IOPlatformDevice");