From d94b530fec8f7fbaa00bce7261603fcd95951cb2 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Wed, 26 Feb 2025 11:47:39 -0500 Subject: [PATCH 01/17] Test commit --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 000000000000..b6f2dfbaed5c --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +This is a test file to confirm my fork is working From 794032fe1207fa77c4095bbec701864b9211dc39 Mon Sep 17 00:00:00 2001 From: Aiden2244 Date: Wed, 26 Feb 2025 12:00:04 -0500 Subject: [PATCH 02/17] Test commit 2 --- test.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index b6f2dfbaed5c..000000000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -This is a test file to confirm my fork is working From c02966ef6ddd70e7114e9df34b7ea10a5ca085e4 Mon Sep 17 00:00:00 2001 From: Aiden2244 Date: Wed, 26 Feb 2025 13:00:36 -0500 Subject: [PATCH 03/17] Test commit 3 --- .DS_Store | Bin 0 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fa5e55bf1d7f7c94a653b30e703ff3becb435bd6 GIT binary patch literal 6148 zcmeH~J!->15QX2wE(~c@y4=PG$PE_boWK`I;ov67U`XmcdfxmrQCtTR-oVV;nbjca zE3_H_cKp1&026>6-4zE93p3^$T=9wKR-Zu6BDuL4gIGh=1KV!yT}A|L`HAOa#F z0xKerr#N=cD|#k9iU^3nItcjpq0wD?=}3)F2Sbbi)Gf Date: Mon, 3 Mar 2025 09:44:15 -0500 Subject: [PATCH 04/17] untracked venv --- .gitignore | 1 + venv | 1 + 2 files changed, 2 insertions(+) create mode 120000 venv diff --git a/.gitignore b/.gitignore index d9dd610777e7..6be50a9ad5bc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ # User-specified configuration /user.bazelrc +/venv \ No newline at end of file diff --git a/venv b/venv new file mode 120000 index 000000000000..441688f6087d --- /dev/null +++ b/venv @@ -0,0 +1 @@ +/private/var/tmp/_bazel_aiden.mccormack/9598f1a1c587a95262ff87f0aa2eecbc.drake_python/venv.drake \ No newline at end of file From 8859802cdfce909886f0f08a3c79e0a09f1aa18c Mon Sep 17 00:00:00 2001 From: Aiden2244 Date: Tue, 4 Mar 2025 15:39:32 -0500 Subject: [PATCH 05/17] undid a change I made to gitignore --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6be50a9ad5bc..39808e1ffd8d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,4 @@ /gen/ # User-specified configuration -/user.bazelrc -/venv \ No newline at end of file +/user.bazelrc \ No newline at end of file From 4b71cfae97f4d03d8b0505efab82e120f5ad1177 Mon Sep 17 00:00:00 2001 From: Aiden2244 Date: Tue, 4 Mar 2025 23:17:46 -0500 Subject: [PATCH 06/17] Squashed commit of the following: commit 223582512aa95d8c344219a2c1c2a3322fe218c5 Author: Aiden2244 Date: Tue Mar 4 22:40:54 2025 -0500 fixed comma spacing errors in macos.py commit 44251d8d02eb53bbde50fe705ddfb833c79d5bb0 Author: Aiden2244 Date: Tue Mar 4 15:52:00 2025 -0500 added blank line in .gitignore commit 5c8408ec99e6f27ea7acfaf3a7b273398777a59c Author: Aiden2244 Date: Tue Mar 4 15:50:52 2025 -0500 removed env variables and hopefully escaped git hell commit 006d4eea68d0f576c4c8d43f5e89ee783f7be99c Merge: ec68da87b 8859802cd Author: Aiden2244 Date: Tue Mar 4 15:46:39 2025 -0500 Merge branch 'master' into bug-brew-no-lock modified local gitignore, reverted change on local master branch commit ec68da87ba8b0eb46a50444201be8e44c1af67db Author: Aiden2244 Date: Tue Mar 4 15:43:15 2025 -0500 Revert "removed references to brew lockfiles" This reverts commit 14ac2d476b643386bd057eede2a80ee9abaa2530. commit e774794d98d94e76950bbfe1f568a16f4c6187cc Author: Aiden2244 Date: Tue Mar 4 15:38:00 2025 -0500 modified gitignore commit e5789ad00402b3ea4baf3ea8bee0631bc8b15787 Author: Aiden2244 Date: Tue Mar 4 15:31:31 2025 -0500 removed irrelevant changes commit 14ac2d476b643386bd057eede2a80ee9abaa2530 Author: Aiden2244 Date: Tue Mar 4 15:29:17 2025 -0500 removed references to brew lockfiles commit a6da02a1e6c67813d6501d42f86a96683bcd98a0 Author: Aiden2244 Date: Tue Mar 4 15:27:19 2025 -0500 addressed an instance of '--no-lock' in python build script commit ebc06c7d1679004d1ce5ab374fdedcfb005a392a Author: Aiden2244 Date: Tue Mar 4 15:17:46 2025 -0500 removed venv from gitignore commit 0d0f8205d45d06063ff3304591630f4c418e885a Author: Aiden2244 Date: Tue Mar 4 15:10:01 2025 -0500 removed --no-lock from source distribution build script commit 0ba270e990f4523af3513de3423483403809fc4b Author: Aiden2244 Date: Tue Mar 4 14:47:21 2025 -0500 added homebrew env variable and removed deprecated flag Fixed brew lockfile issues --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 +- setup/mac/binary_distribution/install_prereqs.sh | 2 +- setup/mac/source_distribution/install_prereqs.sh | 2 +- tools/wheel/wheel_builder/macos.py | 2 +- venv | 1 - 6 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 .DS_Store delete mode 120000 venv diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index fa5e55bf1d7f7c94a653b30e703ff3becb435bd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~J!->15QX2wE(~c@y4=PG$PE_boWK`I;ov67U`XmcdfxmrQCtTR-oVV;nbjca zE3_H_cKp1&026>6-4zE93p3^$T=9wKR-Zu6BDuL4gIGh=1KV!yT}A|L`HAOa#F z0xKerr#N=cD|#k9iU^3nItcjpq0wD?=}3)F2Sbbi)Gf/dev/null; then echo 'ERROR: pip3.12 is NOT installed. The post-install step for the python@3.12 formula may have failed.' >&2 diff --git a/setup/mac/source_distribution/install_prereqs.sh b/setup/mac/source_distribution/install_prereqs.sh index 7bd3392ee873..56a05f7932dc 100755 --- a/setup/mac/source_distribution/install_prereqs.sh +++ b/setup/mac/source_distribution/install_prereqs.sh @@ -32,4 +32,4 @@ if ! command -v brew &>/dev/null; then exit 4 fi -brew bundle --file="${BASH_SOURCE%/*}/Brewfile" --no-lock +brew bundle --file="${BASH_SOURCE%/*}/Brewfile" diff --git a/tools/wheel/wheel_builder/macos.py b/tools/wheel/wheel_builder/macos.py index 99748107ace7..735d409fe467 100644 --- a/tools/wheel/wheel_builder/macos.py +++ b/tools/wheel/wheel_builder/macos.py @@ -72,7 +72,7 @@ def _provision(python_targets): Prepares wheel build environment. """ packages_path = os.path.join(resource_root, 'image', 'packages-macos') - command = ['brew', 'bundle', f'--file={packages_path}', '--no-lock'] + command = ['brew', 'bundle', f'--file={packages_path}',] subprocess.check_call(command) for t in python_targets: diff --git a/venv b/venv deleted file mode 120000 index 441688f6087d..000000000000 --- a/venv +++ /dev/null @@ -1 +0,0 @@ -/private/var/tmp/_bazel_aiden.mccormack/9598f1a1c587a95262ff87f0aa2eecbc.drake_python/venv.drake \ No newline at end of file From ceba3df7d5651f4f47d0e97b02505867e5de94db Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Fri, 7 Mar 2025 13:14:34 -0500 Subject: [PATCH 07/17] added c++ style changes to comply with new cpplint target --- common/hash.h | 15 ++++++++++++++- common/identifier.h | 1 + common/sorted_pair.h | 1 + common/symbolic/chebyshev_basis_element.h | 1 + common/symbolic/chebyshev_polynomial.h | 1 + common/symbolic/expression/expression.h | 1 + common/symbolic/expression/formula.h | 1 + common/symbolic/expression/variable.h | 1 + common/symbolic/expression/variables.h | 1 + common/symbolic/generic_polynomial.h | 1 + common/symbolic/monomial.h | 1 + common/symbolic/monomial_basis_element.h | 1 + common/symbolic/polynomial.h | 1 + common/type_safe_index.h | 1 + geometry/render/render_label.h | 1 + geometry/render_gl/internal_buffer_dim.h | 1 + math/rigid_transform.h | 1 + math/roll_pitch_yaw.h | 1 + math/rotation_matrix.h | 1 + multibody/mpm/particle_sorter.cc | 4 ++-- multibody/mpm/particle_sorter.h | 9 +++++---- solvers/binding.h | 1 + solvers/evaluator_base.h | 2 +- solvers/solver_id.h | 1 + 24 files changed, 42 insertions(+), 8 deletions(-) diff --git a/common/hash.h b/common/hash.h index 7b3c0aacbe2b..338628830091 100644 --- a/common/hash.h +++ b/common/hash.h @@ -77,12 +77,14 @@ namespace drake { template std::enable_if_t> hash_append( +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { hasher(std::addressof(item), sizeof(item)); } /// Provides @ref hash_append for bare pointers. template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const T* item) noexcept { hash_append(hasher, reinterpret_cast(item)); }; @@ -91,6 +93,7 @@ void hash_append(HashAlgorithm& hasher, const T* item) noexcept { template std::enable_if_t> hash_append( +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { hasher(std::addressof(item), sizeof(item)); } @@ -99,6 +102,7 @@ hash_append( template std::enable_if_t> hash_append( +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { // Hashing a NaN makes no sense, since they cannot compare as equal. DRAKE_ASSERT(!std::isnan(item)); @@ -115,6 +119,7 @@ hash_append( /// (Technically, any string based on `CharT = char`.) template void hash_append( +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, const std::basic_string& item) noexcept { using drake::hash_append; @@ -133,6 +138,7 @@ void hash_append( /// Provides @ref hash_append for std::pair. template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::pair& item) noexcept; /// Provides @ref hash_append for std::optional. @@ -142,6 +148,7 @@ void hash_append(HashAlgorithm& hasher, const std::pair& item) noexcept; /// same hash as that of the value `v` itself. Hash operations implemented /// with this `hash_append` do *not* provide that invariant. template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept; /// Provides @ref hash_append for std::map. @@ -151,6 +158,7 @@ void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept; /// for details. template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::map& item) noexcept; @@ -160,12 +168,14 @@ void hash_append(HashAlgorithm& hasher, /// [N3980](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html#unordered) /// for details. template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::set& item) noexcept; // Now that all of the templated hashers are declared, we can define them. template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::pair& item) noexcept { using drake::hash_append; @@ -174,6 +184,7 @@ void hash_append(HashAlgorithm& hasher, } template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept { if (item) { hash_append(hasher, *item); @@ -184,7 +195,7 @@ void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept { /// Provides @ref hash_append for a range, as given by two iterators. template void hash_append_range( - // NOLINTNEXTLINE(runtime/references) Per hash_append convention. +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, Iter begin, Iter end) noexcept { using drake::hash_append; size_t count{0}; @@ -198,12 +209,14 @@ void hash_append_range( template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::map& item) noexcept { return hash_append_range(hasher, item.begin(), item.end()); }; template +// NOLINTNEXTLINE (runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::set& item) noexcept { return hash_append_range(hasher, item.begin(), item.end()); diff --git a/common/identifier.h b/common/identifier.h index 859f8f235618..8abf343100dd 100644 --- a/common/identifier.h +++ b/common/identifier.h @@ -194,6 +194,7 @@ class Identifier { confirm it is valid before using it as a key (or other hashing application). */ template + // NOLINTNEXTLINE (runtime/references) friend void hash_append(HashAlgorithm& hasher, const Identifier& i) noexcept { using drake::hash_append; hash_append(hasher, i.value_); diff --git a/common/sorted_pair.h b/common/sorted_pair.h index 7a8adb7faed0..546709703051 100644 --- a/common/sorted_pair.h +++ b/common/sorted_pair.h @@ -100,6 +100,7 @@ struct SortedPair { /// Implements the @ref hash_append concept. template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const SortedPair& p) noexcept { using drake::hash_append; hash_append(hasher, p.first_); diff --git a/common/symbolic/chebyshev_basis_element.h b/common/symbolic/chebyshev_basis_element.h index 953ac20bc2c7..9293c04a0918 100644 --- a/common/symbolic/chebyshev_basis_element.h +++ b/common/symbolic/chebyshev_basis_element.h @@ -102,6 +102,7 @@ class ChebyshevBasisElement : public PolynomialBasisElement { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const ChebyshevBasisElement& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/chebyshev_polynomial.h b/common/symbolic/chebyshev_polynomial.h index 4d2b413e0574..163889d09550 100644 --- a/common/symbolic/chebyshev_polynomial.h +++ b/common/symbolic/chebyshev_polynomial.h @@ -100,6 +100,7 @@ class ChebyshevPolynomial { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) friend void hash_append(HashAlgorithm& hasher, const ChebyshevPolynomial& item) noexcept { if (item.degree() == 0) { diff --git a/common/symbolic/expression/expression.h b/common/symbolic/expression/expression.h index df8288e775cf..9c4a4f5b7015 100644 --- a/common/symbolic/expression/expression.h +++ b/common/symbolic/expression/expression.h @@ -332,6 +332,7 @@ class Expression { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Expression& item) noexcept { DelegatingHasher delegating_hasher( diff --git a/common/symbolic/expression/formula.h b/common/symbolic/expression/formula.h index 1862ff05644f..a16897cf0202 100644 --- a/common/symbolic/expression/formula.h +++ b/common/symbolic/expression/formula.h @@ -210,6 +210,7 @@ class Formula { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Formula& item) noexcept { DelegatingHasher delegating_hasher( [&hasher](const void* data, const size_t length) { diff --git a/common/symbolic/expression/variable.h b/common/symbolic/expression/variable.h index 78dfd6ff1686..d556484422a6 100644 --- a/common/symbolic/expression/variable.h +++ b/common/symbolic/expression/variable.h @@ -93,6 +93,7 @@ class Variable { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Variable& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/expression/variables.h b/common/symbolic/expression/variables.h index a0a3b332b4c2..7b15fe33553b 100644 --- a/common/symbolic/expression/variables.h +++ b/common/symbolic/expression/variables.h @@ -59,6 +59,7 @@ class Variables { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Variables& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/generic_polynomial.h b/common/symbolic/generic_polynomial.h index 352ae7e259ad..3a8234b699c5 100644 --- a/common/symbolic/generic_polynomial.h +++ b/common/symbolic/generic_polynomial.h @@ -257,6 +257,7 @@ class GenericPolynomial { /** Implements the @ref hash_append concept. */ template friend void hash_append( + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, const GenericPolynomial& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/monomial.h b/common/symbolic/monomial.h index 7ffef972f096..a8972ce54ea7 100644 --- a/common/symbolic/monomial.h +++ b/common/symbolic/monomial.h @@ -128,6 +128,7 @@ class Monomial { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Monomial& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/monomial_basis_element.h b/common/symbolic/monomial_basis_element.h index 6945e62427fe..ea0c637316ff 100644 --- a/common/symbolic/monomial_basis_element.h +++ b/common/symbolic/monomial_basis_element.h @@ -130,6 +130,7 @@ class MonomialBasisElement : public PolynomialBasisElement { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const MonomialBasisElement& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/polynomial.h b/common/symbolic/polynomial.h index a7fbe733e23e..f02301533825 100644 --- a/common/symbolic/polynomial.h +++ b/common/symbolic/polynomial.h @@ -377,6 +377,7 @@ class Polynomial { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Polynomial& item) noexcept { using drake::hash_append; diff --git a/common/type_safe_index.h b/common/type_safe_index.h index 77f0f0f0ae0d..8f372c5664ac 100644 --- a/common/type_safe_index.h +++ b/common/type_safe_index.h @@ -489,6 +489,7 @@ class TypeSafeIndex { /// the user to confirm it is valid before using it as a key (or other hashing /// application). template + // NOLINTNEXTLINE (runtime/references) friend void hash_append(HashAlgorithm& hasher, const TypeSafeIndex& i) noexcept { using drake::hash_append; diff --git a/geometry/render/render_label.h b/geometry/render/render_label.h index 2097bcecd88a..c7d153c41f4c 100644 --- a/geometry/render/render_label.h +++ b/geometry/render/render_label.h @@ -106,6 +106,7 @@ class RenderLabel { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RenderLabel& item) noexcept { using drake::hash_append; diff --git a/geometry/render_gl/internal_buffer_dim.h b/geometry/render_gl/internal_buffer_dim.h index 3ae0ce513dbb..b32f6ccc815d 100644 --- a/geometry/render_gl/internal_buffer_dim.h +++ b/geometry/render_gl/internal_buffer_dim.h @@ -25,6 +25,7 @@ class BufferDim { /* Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) friend void hash_append(HashAlgorithm& hasher, const BufferDim& dim) noexcept { using drake::hash_append; diff --git a/math/rigid_transform.h b/math/rigid_transform.h index be086a0634fa..27f34cd52b2e 100644 --- a/math/rigid_transform.h +++ b/math/rigid_transform.h @@ -644,6 +644,7 @@ class RigidTransform { /// Implements the @ref hash_append concept. /// @pre T implements the hash_append concept. template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RigidTransform& X) noexcept { using drake::hash_append; diff --git a/math/roll_pitch_yaw.h b/math/roll_pitch_yaw.h index 2e557e24ba23..9c673089a95b 100644 --- a/math/roll_pitch_yaw.h +++ b/math/roll_pitch_yaw.h @@ -414,6 +414,7 @@ class RollPitchYaw { /// Implements the @ref hash_append concept. /// @pre T implements the hash_append concept. template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RollPitchYaw& rpy) noexcept { const T* begin = rpy.roll_pitch_yaw_.data(); diff --git a/math/rotation_matrix.h b/math/rotation_matrix.h index 879ebe403879..25e07bc0dc31 100644 --- a/math/rotation_matrix.h +++ b/math/rotation_matrix.h @@ -723,6 +723,7 @@ class RotationMatrix { /// Implements the @ref hash_append concept. /// @pre T implements the hash_append concept. template + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RotationMatrix& R) noexcept { const T* begin = R.R_AB_.data(); diff --git a/multibody/mpm/particle_sorter.cc b/multibody/mpm/particle_sorter.cc index 1c9c38e3204c..debaf50f1e74 100644 --- a/multibody/mpm/particle_sorter.cc +++ b/multibody/mpm/particle_sorter.cc @@ -76,12 +76,12 @@ void ParticleSorter::ComputeBitInformation(const SpGridFlags& flags, // TODO(xuchenhan-tri): This should be checked when we register particles to // the MPM model. /* Confirm that index_bits_ is enough to store num_particles. */ - const uint64_t capacity = (uint64_t(1) << index_bits_); + const uint64_t capacity = (static_cast(1) << index_bits_); DRAKE_DEMAND(capacity > static_cast(num_particles)); } void ParticleSorter::UnpackResults() { - const uint64_t index_mask = ((uint64_t(1) << index_bits_) - 1); + const uint64_t index_mask = ((static_cast(1) << index_bits_) - 1); for (int p = 0; p < static_cast(particle_sorters_.size()); ++p) { /* Lower bits store the particle's original index. */ diff --git a/multibody/mpm/particle_sorter.h b/multibody/mpm/particle_sorter.h index 13b7b87a16c4..319f308163da 100644 --- a/multibody/mpm/particle_sorter.h +++ b/multibody/mpm/particle_sorter.h @@ -215,11 +215,12 @@ class ParticleSorter { base_node_offsets_[p] = spgrid.CoordinateToOffset(base_node[0], base_node[1], base_node[2]); /* Confirm the data bits of the base node offset are all zero. */ - DRAKE_ASSERT( - (base_node_offsets_[p] & ((uint64_t(1) << data_bits_) - 1)) == 0); - /* Confirm the left most bits in the page bits are unused. */ DRAKE_ASSERT((base_node_offsets_[p] & - ~((uint64_t(1) << (64 - zero_page_bits_)) - 1)) == 0); + ((static_cast(1) << data_bits_) - 1)) == 0); + /* Confirm the left most bits in the page bits are unused. */ + DRAKE_ASSERT( + (base_node_offsets_[p] & + ~((static_cast(1) << (64 - zero_page_bits_)) - 1)) == 0); particle_sorters_[p] = (base_node_offsets_[p] << zero_page_bits_) + p; } } diff --git a/solvers/binding.h b/solvers/binding.h index 3437cf67b549..1c14a32765e6 100644 --- a/solvers/binding.h +++ b/solvers/binding.h @@ -119,6 +119,7 @@ class Binding { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) friend void hash_append(HashAlgorithm& hasher, const Binding& item) noexcept { using drake::hash_append; diff --git a/solvers/evaluator_base.h b/solvers/evaluator_base.h index 8f86926facfa..7d05dd92a957 100644 --- a/solvers/evaluator_base.h +++ b/solvers/evaluator_base.h @@ -315,7 +315,7 @@ class FunctionEvaluator : public EvaluatorBase { * @param args Arguments to be forwarded to EvaluatorBase constructor. */ template - FunctionEvaluator(FF&& f, Args&&... args) + explicit FunctionEvaluator(FF&& f, Args&&... args) : EvaluatorBase(internal::FunctionTraits::numOutputs(f), internal::FunctionTraits::numInputs(f), std::forward(args)...), diff --git a/solvers/solver_id.h b/solvers/solver_id.h index 06d04cd82f77..123d14a272ae 100644 --- a/solvers/solver_id.h +++ b/solvers/solver_id.h @@ -35,6 +35,7 @@ class SolverId { /** Implements the @ref hash_append concept. */ template + // NOLINTNEXTLINE (runtime/references) friend void hash_append(HashAlgorithm& hasher, const SolverId& item) noexcept { using drake::hash_append; From 5b45bb5f9208871c8a0fab7b133f6ec4432c7724 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Fri, 7 Mar 2025 13:24:24 -0500 Subject: [PATCH 08/17] addressed whitespace/newline errors --- common/schema/stochastic.cc | 4 +++- common/test/identifier_test.cc | 16 ++++++++++++---- common/test_utilities/limit_malloc.cc | 12 +++++++++--- common/test_utilities/test/limit_malloc_test.cc | 12 +++++++++--- geometry/scene_graph_config.cc | 4 +++- systems/analysis/simulator_config_functions.cc | 4 +++- .../framework/test_utilities/scalar_conversion.h | 4 +++- 7 files changed, 42 insertions(+), 14 deletions(-) diff --git a/common/schema/stochastic.cc b/common/schema/stochastic.cc index ebb2af546bbb..d84dd032fbde 100644 --- a/common/schema/stochastic.cc +++ b/common/schema/stochastic.cc @@ -107,7 +107,9 @@ double UniformDiscrete::Mean() const { "Cannot Mean() empty UniformDiscrete distribution."); } double sum = 0; - for (double value : values) { sum += value; } + for (double value : values) { + sum += value; + } return sum / values.size(); } diff --git a/common/test/identifier_test.cc b/common/test/identifier_test.cc index e0f0cb1db7dc..e45ddd4018df 100644 --- a/common/test/identifier_test.cc +++ b/common/test/identifier_test.cc @@ -247,7 +247,9 @@ TEST_F(IdentifierTests, Convertible) { // Attempting to acquire the value is an error. TEST_F(IdentifierTests, InvalidGetValueCall) { - if (kDrakeAssertIsDisarmed) { return; } + if (kDrakeAssertIsDisarmed) { + return; + } AId invalid; DRAKE_EXPECT_THROWS_MESSAGE( invalid.get_value(), @@ -256,14 +258,18 @@ TEST_F(IdentifierTests, InvalidGetValueCall) { // Comparison of invalid ids is an error. TEST_F(IdentifierTests, InvalidEqualityCompare) { - if (kDrakeAssertIsDisarmed) { return; } + if (kDrakeAssertIsDisarmed) { + return; + } AId invalid; DRAKE_EXPECT_THROWS_MESSAGE(invalid == a1_, ".*is_valid.*failed.*"); } // Comparison of invalid ids is an error. TEST_F(IdentifierTests, InvalidInequalityCompare) { - if (kDrakeAssertIsDisarmed) { return; } + if (kDrakeAssertIsDisarmed) { + return; + } AId invalid; DRAKE_EXPECT_THROWS_MESSAGE(invalid != a1_, ".*is_valid.*failed.*"); } @@ -290,7 +296,9 @@ TEST_F(IdentifierTests, InvalidHash) { // Streaming an invalid id is an error. TEST_F(IdentifierTests, InvalidStream) { - if (kDrakeAssertIsDisarmed) { return; } + if (kDrakeAssertIsDisarmed) { + return; + } AId invalid; std::stringstream ss; DRAKE_EXPECT_THROWS_MESSAGE(ss << invalid, ".*is_valid.*failed.*"); diff --git a/common/test_utilities/limit_malloc.cc b/common/test_utilities/limit_malloc.cc index f880393dacbd..5499aff1dd7d 100644 --- a/common/test_utilities/limit_malloc.cc +++ b/common/test_utilities/limit_malloc.cc @@ -178,7 +178,9 @@ class ActiveMonitor { }; void Monitor::ObserveAllocation() { - if (!IsSupportedConfiguration()) { return; } + if (!IsSupportedConfiguration()) { + return; + } bool failure = false; @@ -191,7 +193,9 @@ void Monitor::ObserveAllocation() { // TODO(jwnimmer-tri) Add more limits (requested bytes?) here. - if (!failure) { return; } + if (!failure) { + return; + } // Non-fatal breakpoint action; use with helper script: // tools/dynamic_analysis/dump_limit_malloc_stacks @@ -284,7 +288,9 @@ void* realloc(void* ptr, size_t size) { } static void EvaluateMinNumAllocations(int observed, int min_num_allocations) { - if (!drake::test::IsSupportedConfiguration()) { return; } + if (!drake::test::IsSupportedConfiguration()) { + return; + } if ((min_num_allocations >= 0) && (observed < min_num_allocations)) { std::cerr << "abort due to scope end with " diff --git a/common/test_utilities/test/limit_malloc_test.cc b/common/test_utilities/test/limit_malloc_test.cc index 2c4a978807ac..a61fe237577f 100644 --- a/common/test_utilities/test/limit_malloc_test.cc +++ b/common/test_utilities/test/limit_malloc_test.cc @@ -18,7 +18,9 @@ void CallMalloc() { void* dummy = malloc(16); g_dummy = dummy; free(dummy); - if (g_dummy == nullptr) { throw std::runtime_error("null dummy"); } + if (g_dummy == nullptr) { + throw std::runtime_error("null dummy"); + } } // Calls calloc (and then immediately frees). @@ -26,7 +28,9 @@ void CallCalloc() { void* dummy = calloc(1, 16); g_dummy = dummy; free(dummy); - if (g_dummy == nullptr) { throw std::runtime_error("null dummy"); } + if (g_dummy == nullptr) { + throw std::runtime_error("null dummy"); + } } // Calls realloc (and then immediately frees). @@ -34,7 +38,9 @@ void CallRealloc() { void* dummy = realloc(nullptr, 16); g_dummy = dummy; free(dummy); - if (g_dummy == nullptr) { throw std::runtime_error("null dummy"); } + if (g_dummy == nullptr) { + throw std::runtime_error("null dummy"); + } } // A value-parameterized test fixture. diff --git a/geometry/scene_graph_config.cc b/geometry/scene_graph_config.cc index ff60af5228bb..6d823790a51a 100644 --- a/geometry/scene_graph_config.cc +++ b/geometry/scene_graph_config.cc @@ -26,7 +26,9 @@ void ThrowUnlessAbsentOr( std::string_view name, std::optional property, Condition condition) { - if (!property.has_value()) { return; } + if (!property.has_value()) { + return; + } double value = *property; std::string_view condition_name; bool should_throw{false}; diff --git a/systems/analysis/simulator_config_functions.cc b/systems/analysis/simulator_config_functions.cc index d6645ea74591..562c5e8c3ac8 100644 --- a/systems/analysis/simulator_config_functions.cc +++ b/systems/analysis/simulator_config_functions.cc @@ -64,7 +64,9 @@ string GetIntegratorName() { string result; for (char ch : camel_name) { if (std::isupper(ch)) { - if (!result.empty()) { result.push_back('_'); } + if (!result.empty()) { + result.push_back('_'); + } result.push_back(std::tolower(ch)); } else { result.push_back(ch); diff --git a/systems/framework/test_utilities/scalar_conversion.h b/systems/framework/test_utilities/scalar_conversion.h index 89ab91fc33e7..0fbf9f85a6ba 100644 --- a/systems/framework/test_utilities/scalar_conversion.h +++ b/systems/framework/test_utilities/scalar_conversion.h @@ -44,7 +44,9 @@ ::testing::AssertionResult is_convertible_to( dut.template ToScalarTypeMaybe(); ::testing::AssertionResult result = is_dynamic_castable>(converted); - if (!result) { return result; } + if (!result) { + return result; + } // Allow calling code to specify additional tests on the converted System. const S& downcast = From b7c4a71fef6f815cae97ea8fba75c1f2c4736c42 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Fri, 7 Mar 2025 13:52:10 -0500 Subject: [PATCH 09/17] additional style change --- multibody/mpm/sparse_grid.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/multibody/mpm/sparse_grid.cc b/multibody/mpm/sparse_grid.cc index 9aafbf31a14e..d26c40d95d09 100644 --- a/multibody/mpm/sparse_grid.cc +++ b/multibody/mpm/sparse_grid.cc @@ -1,6 +1,4 @@ -#include "sparse_grid.h" - -#include +#include "drake/multibody/mpm/sparse_grid.h" namespace drake { namespace multibody { From 92f03839f32e1ccd90b2fe81504db3a6f46e818e Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Fri, 7 Mar 2025 14:18:29 -0500 Subject: [PATCH 10/17] minor build tweak --- common/symbolic/generic_polynomial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/symbolic/generic_polynomial.h b/common/symbolic/generic_polynomial.h index 3a8234b699c5..baec331e15b3 100644 --- a/common/symbolic/generic_polynomial.h +++ b/common/symbolic/generic_polynomial.h @@ -257,7 +257,7 @@ class GenericPolynomial { /** Implements the @ref hash_append concept. */ template friend void hash_append( - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE (runtime/references) Per hash_append convention. HashAlgorithm& hasher, const GenericPolynomial& item) noexcept { using drake::hash_append; From 74c6d9a0abb0412209b388d334c8d69abb5cbc4e Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Fri, 7 Mar 2025 16:33:47 -0500 Subject: [PATCH 11/17] Revert "addressed whitespace/newline errors" This reverts commit 5b45bb5f9208871c8a0fab7b133f6ec4432c7724. revert whitespace/newline changes --- common/schema/stochastic.cc | 4 +--- common/test/identifier_test.cc | 16 ++++------------ common/test_utilities/limit_malloc.cc | 12 +++--------- common/test_utilities/test/limit_malloc_test.cc | 12 +++--------- geometry/scene_graph_config.cc | 4 +--- systems/analysis/simulator_config_functions.cc | 4 +--- .../framework/test_utilities/scalar_conversion.h | 4 +--- 7 files changed, 14 insertions(+), 42 deletions(-) diff --git a/common/schema/stochastic.cc b/common/schema/stochastic.cc index d84dd032fbde..ebb2af546bbb 100644 --- a/common/schema/stochastic.cc +++ b/common/schema/stochastic.cc @@ -107,9 +107,7 @@ double UniformDiscrete::Mean() const { "Cannot Mean() empty UniformDiscrete distribution."); } double sum = 0; - for (double value : values) { - sum += value; - } + for (double value : values) { sum += value; } return sum / values.size(); } diff --git a/common/test/identifier_test.cc b/common/test/identifier_test.cc index e45ddd4018df..e0f0cb1db7dc 100644 --- a/common/test/identifier_test.cc +++ b/common/test/identifier_test.cc @@ -247,9 +247,7 @@ TEST_F(IdentifierTests, Convertible) { // Attempting to acquire the value is an error. TEST_F(IdentifierTests, InvalidGetValueCall) { - if (kDrakeAssertIsDisarmed) { - return; - } + if (kDrakeAssertIsDisarmed) { return; } AId invalid; DRAKE_EXPECT_THROWS_MESSAGE( invalid.get_value(), @@ -258,18 +256,14 @@ TEST_F(IdentifierTests, InvalidGetValueCall) { // Comparison of invalid ids is an error. TEST_F(IdentifierTests, InvalidEqualityCompare) { - if (kDrakeAssertIsDisarmed) { - return; - } + if (kDrakeAssertIsDisarmed) { return; } AId invalid; DRAKE_EXPECT_THROWS_MESSAGE(invalid == a1_, ".*is_valid.*failed.*"); } // Comparison of invalid ids is an error. TEST_F(IdentifierTests, InvalidInequalityCompare) { - if (kDrakeAssertIsDisarmed) { - return; - } + if (kDrakeAssertIsDisarmed) { return; } AId invalid; DRAKE_EXPECT_THROWS_MESSAGE(invalid != a1_, ".*is_valid.*failed.*"); } @@ -296,9 +290,7 @@ TEST_F(IdentifierTests, InvalidHash) { // Streaming an invalid id is an error. TEST_F(IdentifierTests, InvalidStream) { - if (kDrakeAssertIsDisarmed) { - return; - } + if (kDrakeAssertIsDisarmed) { return; } AId invalid; std::stringstream ss; DRAKE_EXPECT_THROWS_MESSAGE(ss << invalid, ".*is_valid.*failed.*"); diff --git a/common/test_utilities/limit_malloc.cc b/common/test_utilities/limit_malloc.cc index 5499aff1dd7d..f880393dacbd 100644 --- a/common/test_utilities/limit_malloc.cc +++ b/common/test_utilities/limit_malloc.cc @@ -178,9 +178,7 @@ class ActiveMonitor { }; void Monitor::ObserveAllocation() { - if (!IsSupportedConfiguration()) { - return; - } + if (!IsSupportedConfiguration()) { return; } bool failure = false; @@ -193,9 +191,7 @@ void Monitor::ObserveAllocation() { // TODO(jwnimmer-tri) Add more limits (requested bytes?) here. - if (!failure) { - return; - } + if (!failure) { return; } // Non-fatal breakpoint action; use with helper script: // tools/dynamic_analysis/dump_limit_malloc_stacks @@ -288,9 +284,7 @@ void* realloc(void* ptr, size_t size) { } static void EvaluateMinNumAllocations(int observed, int min_num_allocations) { - if (!drake::test::IsSupportedConfiguration()) { - return; - } + if (!drake::test::IsSupportedConfiguration()) { return; } if ((min_num_allocations >= 0) && (observed < min_num_allocations)) { std::cerr << "abort due to scope end with " diff --git a/common/test_utilities/test/limit_malloc_test.cc b/common/test_utilities/test/limit_malloc_test.cc index a61fe237577f..2c4a978807ac 100644 --- a/common/test_utilities/test/limit_malloc_test.cc +++ b/common/test_utilities/test/limit_malloc_test.cc @@ -18,9 +18,7 @@ void CallMalloc() { void* dummy = malloc(16); g_dummy = dummy; free(dummy); - if (g_dummy == nullptr) { - throw std::runtime_error("null dummy"); - } + if (g_dummy == nullptr) { throw std::runtime_error("null dummy"); } } // Calls calloc (and then immediately frees). @@ -28,9 +26,7 @@ void CallCalloc() { void* dummy = calloc(1, 16); g_dummy = dummy; free(dummy); - if (g_dummy == nullptr) { - throw std::runtime_error("null dummy"); - } + if (g_dummy == nullptr) { throw std::runtime_error("null dummy"); } } // Calls realloc (and then immediately frees). @@ -38,9 +34,7 @@ void CallRealloc() { void* dummy = realloc(nullptr, 16); g_dummy = dummy; free(dummy); - if (g_dummy == nullptr) { - throw std::runtime_error("null dummy"); - } + if (g_dummy == nullptr) { throw std::runtime_error("null dummy"); } } // A value-parameterized test fixture. diff --git a/geometry/scene_graph_config.cc b/geometry/scene_graph_config.cc index 6d823790a51a..ff60af5228bb 100644 --- a/geometry/scene_graph_config.cc +++ b/geometry/scene_graph_config.cc @@ -26,9 +26,7 @@ void ThrowUnlessAbsentOr( std::string_view name, std::optional property, Condition condition) { - if (!property.has_value()) { - return; - } + if (!property.has_value()) { return; } double value = *property; std::string_view condition_name; bool should_throw{false}; diff --git a/systems/analysis/simulator_config_functions.cc b/systems/analysis/simulator_config_functions.cc index 562c5e8c3ac8..d6645ea74591 100644 --- a/systems/analysis/simulator_config_functions.cc +++ b/systems/analysis/simulator_config_functions.cc @@ -64,9 +64,7 @@ string GetIntegratorName() { string result; for (char ch : camel_name) { if (std::isupper(ch)) { - if (!result.empty()) { - result.push_back('_'); - } + if (!result.empty()) { result.push_back('_'); } result.push_back(std::tolower(ch)); } else { result.push_back(ch); diff --git a/systems/framework/test_utilities/scalar_conversion.h b/systems/framework/test_utilities/scalar_conversion.h index 0fbf9f85a6ba..89ab91fc33e7 100644 --- a/systems/framework/test_utilities/scalar_conversion.h +++ b/systems/framework/test_utilities/scalar_conversion.h @@ -44,9 +44,7 @@ ::testing::AssertionResult is_convertible_to( dut.template ToScalarTypeMaybe(); ::testing::AssertionResult result = is_dynamic_castable>(converted); - if (!result) { - return result; - } + if (!result) { return result; } // Allow calling code to specify additional tests on the converted System. const S& downcast = From 037f6c28030c2e8498e75d9fef7197033843fc69 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Fri, 7 Mar 2025 16:48:17 -0500 Subject: [PATCH 12/17] removed whitespace in cpplint comments --- common/hash.h | 28 +++++++++++------------ common/identifier.h | 2 +- common/sorted_pair.h | 2 +- common/symbolic/chebyshev_basis_element.h | 2 +- common/symbolic/chebyshev_polynomial.h | 2 +- common/symbolic/expression/expression.h | 2 +- common/symbolic/expression/formula.h | 2 +- common/symbolic/expression/variable.h | 2 +- common/symbolic/expression/variables.h | 2 +- common/symbolic/generic_polynomial.h | 2 +- common/symbolic/monomial.h | 2 +- common/symbolic/monomial_basis_element.h | 2 +- common/symbolic/polynomial.h | 2 +- common/type_safe_index.h | 2 +- geometry/render/render_label.h | 2 +- geometry/render_gl/internal_buffer_dim.h | 2 +- math/rigid_transform.h | 2 +- math/roll_pitch_yaw.h | 2 +- math/rotation_matrix.h | 2 +- solvers/binding.h | 2 +- solvers/solver_id.h | 2 +- 21 files changed, 34 insertions(+), 34 deletions(-) diff --git a/common/hash.h b/common/hash.h index 338628830091..6cc1b7e80f0f 100644 --- a/common/hash.h +++ b/common/hash.h @@ -77,14 +77,14 @@ namespace drake { template std::enable_if_t> hash_append( -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { hasher(std::addressof(item), sizeof(item)); } /// Provides @ref hash_append for bare pointers. template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const T* item) noexcept { hash_append(hasher, reinterpret_cast(item)); }; @@ -93,7 +93,7 @@ void hash_append(HashAlgorithm& hasher, const T* item) noexcept { template std::enable_if_t> hash_append( -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { hasher(std::addressof(item), sizeof(item)); } @@ -102,7 +102,7 @@ hash_append( template std::enable_if_t> hash_append( -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { // Hashing a NaN makes no sense, since they cannot compare as equal. DRAKE_ASSERT(!std::isnan(item)); @@ -119,7 +119,7 @@ hash_append( /// (Technically, any string based on `CharT = char`.) template void hash_append( -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const std::basic_string& item) noexcept { using drake::hash_append; @@ -138,7 +138,7 @@ void hash_append( /// Provides @ref hash_append for std::pair. template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::pair& item) noexcept; /// Provides @ref hash_append for std::optional. @@ -148,7 +148,7 @@ void hash_append(HashAlgorithm& hasher, const std::pair& item) noexcept; /// same hash as that of the value `v` itself. Hash operations implemented /// with this `hash_append` do *not* provide that invariant. template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept; /// Provides @ref hash_append for std::map. @@ -158,7 +158,7 @@ void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept; /// for details. template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::map& item) noexcept; @@ -168,14 +168,14 @@ void hash_append(HashAlgorithm& hasher, /// [N3980](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html#unordered) /// for details. template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::set& item) noexcept; // Now that all of the templated hashers are declared, we can define them. template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::pair& item) noexcept { using drake::hash_append; @@ -184,7 +184,7 @@ void hash_append(HashAlgorithm& hasher, } template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept { if (item) { hash_append(hasher, *item); @@ -195,7 +195,7 @@ void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept { /// Provides @ref hash_append for a range, as given by two iterators. template void hash_append_range( -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, Iter begin, Iter end) noexcept { using drake::hash_append; size_t count{0}; @@ -209,14 +209,14 @@ void hash_append_range( template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::map& item) noexcept { return hash_append_range(hasher, item.begin(), item.end()); }; template -// NOLINTNEXTLINE (runtime/references) Per hash_append convention. +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void hash_append(HashAlgorithm& hasher, const std::set& item) noexcept { return hash_append_range(hasher, item.begin(), item.end()); diff --git a/common/identifier.h b/common/identifier.h index 8abf343100dd..f4088e2f1ff7 100644 --- a/common/identifier.h +++ b/common/identifier.h @@ -194,7 +194,7 @@ class Identifier { confirm it is valid before using it as a key (or other hashing application). */ template - // NOLINTNEXTLINE (runtime/references) + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const Identifier& i) noexcept { using drake::hash_append; hash_append(hasher, i.value_); diff --git a/common/sorted_pair.h b/common/sorted_pair.h index 546709703051..f65b2bff51cd 100644 --- a/common/sorted_pair.h +++ b/common/sorted_pair.h @@ -100,7 +100,7 @@ struct SortedPair { /// Implements the @ref hash_append concept. template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const SortedPair& p) noexcept { using drake::hash_append; hash_append(hasher, p.first_); diff --git a/common/symbolic/chebyshev_basis_element.h b/common/symbolic/chebyshev_basis_element.h index 9293c04a0918..da38865a562e 100644 --- a/common/symbolic/chebyshev_basis_element.h +++ b/common/symbolic/chebyshev_basis_element.h @@ -102,7 +102,7 @@ class ChebyshevBasisElement : public PolynomialBasisElement { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const ChebyshevBasisElement& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/chebyshev_polynomial.h b/common/symbolic/chebyshev_polynomial.h index 163889d09550..3ff4fc5001b3 100644 --- a/common/symbolic/chebyshev_polynomial.h +++ b/common/symbolic/chebyshev_polynomial.h @@ -100,7 +100,7 @@ class ChebyshevPolynomial { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const ChebyshevPolynomial& item) noexcept { if (item.degree() == 0) { diff --git a/common/symbolic/expression/expression.h b/common/symbolic/expression/expression.h index 9c4a4f5b7015..c8b4cc11495a 100644 --- a/common/symbolic/expression/expression.h +++ b/common/symbolic/expression/expression.h @@ -332,7 +332,7 @@ class Expression { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Expression& item) noexcept { DelegatingHasher delegating_hasher( diff --git a/common/symbolic/expression/formula.h b/common/symbolic/expression/formula.h index a16897cf0202..3019d69324a6 100644 --- a/common/symbolic/expression/formula.h +++ b/common/symbolic/expression/formula.h @@ -210,7 +210,7 @@ class Formula { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Formula& item) noexcept { DelegatingHasher delegating_hasher( [&hasher](const void* data, const size_t length) { diff --git a/common/symbolic/expression/variable.h b/common/symbolic/expression/variable.h index d556484422a6..291a33055555 100644 --- a/common/symbolic/expression/variable.h +++ b/common/symbolic/expression/variable.h @@ -93,7 +93,7 @@ class Variable { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Variable& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/expression/variables.h b/common/symbolic/expression/variables.h index 7b15fe33553b..9fc38a947ec4 100644 --- a/common/symbolic/expression/variables.h +++ b/common/symbolic/expression/variables.h @@ -59,7 +59,7 @@ class Variables { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Variables& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/generic_polynomial.h b/common/symbolic/generic_polynomial.h index baec331e15b3..0183db4f1600 100644 --- a/common/symbolic/generic_polynomial.h +++ b/common/symbolic/generic_polynomial.h @@ -257,7 +257,7 @@ class GenericPolynomial { /** Implements the @ref hash_append concept. */ template friend void hash_append( - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const GenericPolynomial& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/monomial.h b/common/symbolic/monomial.h index a8972ce54ea7..7f78a8448da5 100644 --- a/common/symbolic/monomial.h +++ b/common/symbolic/monomial.h @@ -128,7 +128,7 @@ class Monomial { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Monomial& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/monomial_basis_element.h b/common/symbolic/monomial_basis_element.h index ea0c637316ff..75166176d514 100644 --- a/common/symbolic/monomial_basis_element.h +++ b/common/symbolic/monomial_basis_element.h @@ -130,7 +130,7 @@ class MonomialBasisElement : public PolynomialBasisElement { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const MonomialBasisElement& item) noexcept { using drake::hash_append; diff --git a/common/symbolic/polynomial.h b/common/symbolic/polynomial.h index f02301533825..4c0d3674e6fb 100644 --- a/common/symbolic/polynomial.h +++ b/common/symbolic/polynomial.h @@ -377,7 +377,7 @@ class Polynomial { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Polynomial& item) noexcept { using drake::hash_append; diff --git a/common/type_safe_index.h b/common/type_safe_index.h index 8f372c5664ac..2e22b058a9eb 100644 --- a/common/type_safe_index.h +++ b/common/type_safe_index.h @@ -489,7 +489,7 @@ class TypeSafeIndex { /// the user to confirm it is valid before using it as a key (or other hashing /// application). template - // NOLINTNEXTLINE (runtime/references) + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const TypeSafeIndex& i) noexcept { using drake::hash_append; diff --git a/geometry/render/render_label.h b/geometry/render/render_label.h index c7d153c41f4c..b0e3394f8504 100644 --- a/geometry/render/render_label.h +++ b/geometry/render/render_label.h @@ -106,7 +106,7 @@ class RenderLabel { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RenderLabel& item) noexcept { using drake::hash_append; diff --git a/geometry/render_gl/internal_buffer_dim.h b/geometry/render_gl/internal_buffer_dim.h index b32f6ccc815d..181b8650078e 100644 --- a/geometry/render_gl/internal_buffer_dim.h +++ b/geometry/render_gl/internal_buffer_dim.h @@ -25,7 +25,7 @@ class BufferDim { /* Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const BufferDim& dim) noexcept { using drake::hash_append; diff --git a/math/rigid_transform.h b/math/rigid_transform.h index 27f34cd52b2e..22b95f656d3c 100644 --- a/math/rigid_transform.h +++ b/math/rigid_transform.h @@ -644,7 +644,7 @@ class RigidTransform { /// Implements the @ref hash_append concept. /// @pre T implements the hash_append concept. template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RigidTransform& X) noexcept { using drake::hash_append; diff --git a/math/roll_pitch_yaw.h b/math/roll_pitch_yaw.h index 9c673089a95b..c11694002fb7 100644 --- a/math/roll_pitch_yaw.h +++ b/math/roll_pitch_yaw.h @@ -414,7 +414,7 @@ class RollPitchYaw { /// Implements the @ref hash_append concept. /// @pre T implements the hash_append concept. template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RollPitchYaw& rpy) noexcept { const T* begin = rpy.roll_pitch_yaw_.data(); diff --git a/math/rotation_matrix.h b/math/rotation_matrix.h index 25e07bc0dc31..ff4b9d2265b1 100644 --- a/math/rotation_matrix.h +++ b/math/rotation_matrix.h @@ -723,7 +723,7 @@ class RotationMatrix { /// Implements the @ref hash_append concept. /// @pre T implements the hash_append concept. template - // NOLINTNEXTLINE (runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const RotationMatrix& R) noexcept { const T* begin = R.R_AB_.data(); diff --git a/solvers/binding.h b/solvers/binding.h index 1c14a32765e6..797525b86cbe 100644 --- a/solvers/binding.h +++ b/solvers/binding.h @@ -119,7 +119,7 @@ class Binding { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const Binding& item) noexcept { using drake::hash_append; diff --git a/solvers/solver_id.h b/solvers/solver_id.h index 123d14a272ae..a3ced5d53927 100644 --- a/solvers/solver_id.h +++ b/solvers/solver_id.h @@ -35,7 +35,7 @@ class SolverId { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE (runtime/references) + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const SolverId& item) noexcept { using drake::hash_append; From d299bb1069d1eb66a878c85cca9a3cb3c0e89d39 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Mon, 10 Mar 2025 09:25:21 -0400 Subject: [PATCH 13/17] added explanatory clause to NOLINTNEXTLINE comments --- bindings/pydrake/common/ref_cycle_pybind.h | 4 ++-- .../pydrake/systems/builder_life_support_pybind.h | 2 +- common/identifier.h | 2 +- common/symbolic/chebyshev_polynomial.h | 2 +- common/type_safe_index.h | 2 +- common/value.h | 4 ++-- geometry/benchmarking/render_benchmark.cc | 6 +++--- geometry/render_gl/internal_buffer_dim.h | 2 +- multibody/benchmarking/cassie.cc | 12 ++++++------ solvers/binding.h | 2 +- solvers/solver_id.h | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bindings/pydrake/common/ref_cycle_pybind.h b/bindings/pydrake/common/ref_cycle_pybind.h index b872943f5b74..d1e224cd7651 100644 --- a/bindings/pydrake/common/ref_cycle_pybind.h +++ b/bindings/pydrake/common/ref_cycle_pybind.h @@ -75,7 +75,7 @@ class process_attribute> : public process_attribute_default< drake::pydrake::internal::ref_cycle> { public: - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. static void precall(function_call& call) { // Only generate code if this invocation doesn't need the return value. if constexpr (!needs_return_value()) { @@ -83,7 +83,7 @@ class process_attribute> } } - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. static void postcall(function_call& call, handle ret) { // Only generate code if this invocation *does* need the return value. if constexpr (needs_return_value()) { diff --git a/bindings/pydrake/systems/builder_life_support_pybind.h b/bindings/pydrake/systems/builder_life_support_pybind.h index 98693b52a056..8ceefa525034 100644 --- a/bindings/pydrake/systems/builder_life_support_pybind.h +++ b/bindings/pydrake/systems/builder_life_support_pybind.h @@ -138,7 +138,7 @@ class process_attribute< : public process_attribute_default< drake::pydrake::internal::builder_life_support_stash> { public: - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. static void postcall(function_call& call, handle ret) { drake::pydrake::internal::builder_life_support_stash_impl( Builder, call, ret); diff --git a/common/identifier.h b/common/identifier.h index f4088e2f1ff7..a63454133b01 100644 --- a/common/identifier.h +++ b/common/identifier.h @@ -194,7 +194,7 @@ class Identifier { confirm it is valid before using it as a key (or other hashing application). */ template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Identifier& i) noexcept { using drake::hash_append; hash_append(hasher, i.value_); diff --git a/common/symbolic/chebyshev_polynomial.h b/common/symbolic/chebyshev_polynomial.h index 3ff4fc5001b3..735acc06c2c3 100644 --- a/common/symbolic/chebyshev_polynomial.h +++ b/common/symbolic/chebyshev_polynomial.h @@ -100,7 +100,7 @@ class ChebyshevPolynomial { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const ChebyshevPolynomial& item) noexcept { if (item.degree() == 0) { diff --git a/common/type_safe_index.h b/common/type_safe_index.h index 2e22b058a9eb..ad6d562a43bd 100644 --- a/common/type_safe_index.h +++ b/common/type_safe_index.h @@ -489,7 +489,7 @@ class TypeSafeIndex { /// the user to confirm it is valid before using it as a key (or other hashing /// application). template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const TypeSafeIndex& i) noexcept { using drake::hash_append; diff --git a/common/value.h b/common/value.h index c2a96cb4ea6c..f081f70d78b3 100644 --- a/common/value.h +++ b/common/value.h @@ -624,7 +624,7 @@ struct ValueTraitsImpl { return *other; } static const T& access(const Storage& storage) { return storage; } - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. static T& access(Storage& storage) { return storage; } }; @@ -655,7 +655,7 @@ struct ValueTraitsImpl { return Storage{std::move(other)}; } static const T& access(const Storage& storage) { return *storage; } - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. static T& access(Storage& storage) { return *storage; } }; diff --git a/geometry/benchmarking/render_benchmark.cc b/geometry/benchmarking/render_benchmark.cc index 30c14cb67913..0d73471f55a7 100644 --- a/geometry/benchmarking/render_benchmark.cc +++ b/geometry/benchmarking/render_benchmark.cc @@ -77,7 +77,7 @@ class RenderBenchmark : public benchmark::Fixture { void SetUp(::benchmark::State&) { depth_cameras_.clear(); } template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void ColorImage(::benchmark::State& state, const std::string& name) { auto renderer = MakeEngine(bg_rgb_); auto [sphere_count, camera_count, width, height] = ReadState(state); @@ -110,7 +110,7 @@ class RenderBenchmark : public benchmark::Fixture { } template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void DepthImage(::benchmark::State& state, const std::string& name) { auto renderer = MakeEngine(bg_rgb_); auto [sphere_count, camera_count, width, height] = ReadState(state); @@ -139,7 +139,7 @@ class RenderBenchmark : public benchmark::Fixture { } template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void LabelImage(::benchmark::State& state, const std::string& name) { auto renderer = MakeEngine(bg_rgb_); auto [sphere_count, camera_count, width, height] = ReadState(state); diff --git a/geometry/render_gl/internal_buffer_dim.h b/geometry/render_gl/internal_buffer_dim.h index 181b8650078e..09852614be60 100644 --- a/geometry/render_gl/internal_buffer_dim.h +++ b/geometry/render_gl/internal_buffer_dim.h @@ -25,7 +25,7 @@ class BufferDim { /* Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const BufferDim& dim) noexcept { using drake::hash_append; diff --git a/multibody/benchmarking/cassie.cc b/multibody/benchmarking/cassie.cc index 7e9a7f083335..5db503a3d2af 100644 --- a/multibody/benchmarking/cassie.cc +++ b/multibody/benchmarking/cassie.cc @@ -78,7 +78,7 @@ class Cassie : public benchmark::Fixture { // For T=double, any request for gradients is an error. // For T=AutoDiffXd, sets the specified gradients to the identity matrix. // For T=Expression, sets the specified quantities to symbolic variables. - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void SetUpGradientsOrVariables(benchmark::State& state); // Use these functions to invalidate input- or state-dependent computations @@ -97,7 +97,7 @@ class Cassie : public benchmark::Fixture { } // Runs the PositionKinematics benchmark. - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void DoPositionKinematics(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); DRAKE_DEMAND(want_grad_u(state) == false); @@ -111,7 +111,7 @@ class Cassie : public benchmark::Fixture { } // Runs the PosAndVelKinematics benchmark. - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void DoPosAndVelKinematics(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); DRAKE_DEMAND(want_grad_u(state) == false); @@ -126,7 +126,7 @@ class Cassie : public benchmark::Fixture { } // Runs the MassMatrix benchmark. - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void DoMassMatrix(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); DRAKE_DEMAND(want_grad_u(state) == false); @@ -137,7 +137,7 @@ class Cassie : public benchmark::Fixture { } // Runs the InverseDynamics benchmark. - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void DoInverseDynamics(benchmark::State& state) { DRAKE_DEMAND(want_grad_u(state) == false); for (auto _ : state) { @@ -147,7 +147,7 @@ class Cassie : public benchmark::Fixture { } // Runs the ForwardDynamics benchmark. - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. void DoForwardDynamics(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); for (auto _ : state) { diff --git a/solvers/binding.h b/solvers/binding.h index 797525b86cbe..967e459d2684 100644 --- a/solvers/binding.h +++ b/solvers/binding.h @@ -119,7 +119,7 @@ class Binding { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Binding& item) noexcept { using drake::hash_append; diff --git a/solvers/solver_id.h b/solvers/solver_id.h index a3ced5d53927..7cc7b71c5f17 100644 --- a/solvers/solver_id.h +++ b/solvers/solver_id.h @@ -35,7 +35,7 @@ class SolverId { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) +// NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const SolverId& item) noexcept { using drake::hash_append; From f8e673fdabe2fa9cb7aac19d62fe5c2e39505b31 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Mon, 10 Mar 2025 09:35:47 -0400 Subject: [PATCH 14/17] Revert "added explanatory clause to NOLINTNEXTLINE comments" This reverts commit d299bb1069d1eb66a878c85cca9a3cb3c0e89d39. revert broadstroke change --- bindings/pydrake/common/ref_cycle_pybind.h | 4 ++-- .../pydrake/systems/builder_life_support_pybind.h | 2 +- common/identifier.h | 2 +- common/symbolic/chebyshev_polynomial.h | 2 +- common/type_safe_index.h | 2 +- common/value.h | 4 ++-- geometry/benchmarking/render_benchmark.cc | 6 +++--- geometry/render_gl/internal_buffer_dim.h | 2 +- multibody/benchmarking/cassie.cc | 12 ++++++------ solvers/binding.h | 2 +- solvers/solver_id.h | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bindings/pydrake/common/ref_cycle_pybind.h b/bindings/pydrake/common/ref_cycle_pybind.h index d1e224cd7651..b872943f5b74 100644 --- a/bindings/pydrake/common/ref_cycle_pybind.h +++ b/bindings/pydrake/common/ref_cycle_pybind.h @@ -75,7 +75,7 @@ class process_attribute> : public process_attribute_default< drake::pydrake::internal::ref_cycle> { public: -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) static void precall(function_call& call) { // Only generate code if this invocation doesn't need the return value. if constexpr (!needs_return_value()) { @@ -83,7 +83,7 @@ class process_attribute> } } -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) static void postcall(function_call& call, handle ret) { // Only generate code if this invocation *does* need the return value. if constexpr (needs_return_value()) { diff --git a/bindings/pydrake/systems/builder_life_support_pybind.h b/bindings/pydrake/systems/builder_life_support_pybind.h index 8ceefa525034..98693b52a056 100644 --- a/bindings/pydrake/systems/builder_life_support_pybind.h +++ b/bindings/pydrake/systems/builder_life_support_pybind.h @@ -138,7 +138,7 @@ class process_attribute< : public process_attribute_default< drake::pydrake::internal::builder_life_support_stash> { public: -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) static void postcall(function_call& call, handle ret) { drake::pydrake::internal::builder_life_support_stash_impl( Builder, call, ret); diff --git a/common/identifier.h b/common/identifier.h index a63454133b01..f4088e2f1ff7 100644 --- a/common/identifier.h +++ b/common/identifier.h @@ -194,7 +194,7 @@ class Identifier { confirm it is valid before using it as a key (or other hashing application). */ template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const Identifier& i) noexcept { using drake::hash_append; hash_append(hasher, i.value_); diff --git a/common/symbolic/chebyshev_polynomial.h b/common/symbolic/chebyshev_polynomial.h index 735acc06c2c3..3ff4fc5001b3 100644 --- a/common/symbolic/chebyshev_polynomial.h +++ b/common/symbolic/chebyshev_polynomial.h @@ -100,7 +100,7 @@ class ChebyshevPolynomial { /** Implements the @ref hash_append concept. */ template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const ChebyshevPolynomial& item) noexcept { if (item.degree() == 0) { diff --git a/common/type_safe_index.h b/common/type_safe_index.h index ad6d562a43bd..2e22b058a9eb 100644 --- a/common/type_safe_index.h +++ b/common/type_safe_index.h @@ -489,7 +489,7 @@ class TypeSafeIndex { /// the user to confirm it is valid before using it as a key (or other hashing /// application). template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const TypeSafeIndex& i) noexcept { using drake::hash_append; diff --git a/common/value.h b/common/value.h index f081f70d78b3..c2a96cb4ea6c 100644 --- a/common/value.h +++ b/common/value.h @@ -624,7 +624,7 @@ struct ValueTraitsImpl { return *other; } static const T& access(const Storage& storage) { return storage; } -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) static T& access(Storage& storage) { return storage; } }; @@ -655,7 +655,7 @@ struct ValueTraitsImpl { return Storage{std::move(other)}; } static const T& access(const Storage& storage) { return *storage; } -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) static T& access(Storage& storage) { return *storage; } }; diff --git a/geometry/benchmarking/render_benchmark.cc b/geometry/benchmarking/render_benchmark.cc index 0d73471f55a7..30c14cb67913 100644 --- a/geometry/benchmarking/render_benchmark.cc +++ b/geometry/benchmarking/render_benchmark.cc @@ -77,7 +77,7 @@ class RenderBenchmark : public benchmark::Fixture { void SetUp(::benchmark::State&) { depth_cameras_.clear(); } template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void ColorImage(::benchmark::State& state, const std::string& name) { auto renderer = MakeEngine(bg_rgb_); auto [sphere_count, camera_count, width, height] = ReadState(state); @@ -110,7 +110,7 @@ class RenderBenchmark : public benchmark::Fixture { } template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void DepthImage(::benchmark::State& state, const std::string& name) { auto renderer = MakeEngine(bg_rgb_); auto [sphere_count, camera_count, width, height] = ReadState(state); @@ -139,7 +139,7 @@ class RenderBenchmark : public benchmark::Fixture { } template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void LabelImage(::benchmark::State& state, const std::string& name) { auto renderer = MakeEngine(bg_rgb_); auto [sphere_count, camera_count, width, height] = ReadState(state); diff --git a/geometry/render_gl/internal_buffer_dim.h b/geometry/render_gl/internal_buffer_dim.h index 09852614be60..181b8650078e 100644 --- a/geometry/render_gl/internal_buffer_dim.h +++ b/geometry/render_gl/internal_buffer_dim.h @@ -25,7 +25,7 @@ class BufferDim { /* Implements the @ref hash_append concept. */ template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const BufferDim& dim) noexcept { using drake::hash_append; diff --git a/multibody/benchmarking/cassie.cc b/multibody/benchmarking/cassie.cc index 5db503a3d2af..7e9a7f083335 100644 --- a/multibody/benchmarking/cassie.cc +++ b/multibody/benchmarking/cassie.cc @@ -78,7 +78,7 @@ class Cassie : public benchmark::Fixture { // For T=double, any request for gradients is an error. // For T=AutoDiffXd, sets the specified gradients to the identity matrix. // For T=Expression, sets the specified quantities to symbolic variables. -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void SetUpGradientsOrVariables(benchmark::State& state); // Use these functions to invalidate input- or state-dependent computations @@ -97,7 +97,7 @@ class Cassie : public benchmark::Fixture { } // Runs the PositionKinematics benchmark. -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void DoPositionKinematics(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); DRAKE_DEMAND(want_grad_u(state) == false); @@ -111,7 +111,7 @@ class Cassie : public benchmark::Fixture { } // Runs the PosAndVelKinematics benchmark. -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void DoPosAndVelKinematics(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); DRAKE_DEMAND(want_grad_u(state) == false); @@ -126,7 +126,7 @@ class Cassie : public benchmark::Fixture { } // Runs the MassMatrix benchmark. -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void DoMassMatrix(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); DRAKE_DEMAND(want_grad_u(state) == false); @@ -137,7 +137,7 @@ class Cassie : public benchmark::Fixture { } // Runs the InverseDynamics benchmark. -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void DoInverseDynamics(benchmark::State& state) { DRAKE_DEMAND(want_grad_u(state) == false); for (auto _ : state) { @@ -147,7 +147,7 @@ class Cassie : public benchmark::Fixture { } // Runs the ForwardDynamics benchmark. -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) void DoForwardDynamics(benchmark::State& state) { DRAKE_DEMAND(want_grad_vdot(state) == false); for (auto _ : state) { diff --git a/solvers/binding.h b/solvers/binding.h index 967e459d2684..797525b86cbe 100644 --- a/solvers/binding.h +++ b/solvers/binding.h @@ -119,7 +119,7 @@ class Binding { /** Implements the @ref hash_append concept. */ template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const Binding& item) noexcept { using drake::hash_append; diff --git a/solvers/solver_id.h b/solvers/solver_id.h index 7cc7b71c5f17..a3ced5d53927 100644 --- a/solvers/solver_id.h +++ b/solvers/solver_id.h @@ -35,7 +35,7 @@ class SolverId { /** Implements the @ref hash_append concept. */ template -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) friend void hash_append(HashAlgorithm& hasher, const SolverId& item) noexcept { using drake::hash_append; From 8cee50c24da3b20f7222bc1316e1780209c0b34e Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Mon, 10 Mar 2025 10:55:45 -0400 Subject: [PATCH 15/17] fixed NOLINTNEXTLINE comment nits --- common/hash.h | 10 +++++----- common/identifier.h | 2 +- common/symbolic/chebyshev_polynomial.h | 2 +- common/type_safe_index.h | 2 +- geometry/render_gl/internal_buffer_dim.h | 2 +- solvers/binding.h | 2 +- solvers/solver_id.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/hash.h b/common/hash.h index 6cc1b7e80f0f..caf813ae611c 100644 --- a/common/hash.h +++ b/common/hash.h @@ -77,7 +77,7 @@ namespace drake { template std::enable_if_t> hash_append( -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { hasher(std::addressof(item), sizeof(item)); } @@ -93,7 +93,7 @@ void hash_append(HashAlgorithm& hasher, const T* item) noexcept { template std::enable_if_t> hash_append( -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { hasher(std::addressof(item), sizeof(item)); } @@ -102,7 +102,7 @@ hash_append( template std::enable_if_t> hash_append( -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const T& item) noexcept { // Hashing a NaN makes no sense, since they cannot compare as equal. DRAKE_ASSERT(!std::isnan(item)); @@ -119,7 +119,7 @@ hash_append( /// (Technically, any string based on `CharT = char`.) template void hash_append( -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, const std::basic_string& item) noexcept { using drake::hash_append; @@ -195,7 +195,7 @@ void hash_append(HashAlgorithm& hasher, const std::optional& item) noexcept { /// Provides @ref hash_append for a range, as given by two iterators. template void hash_append_range( -// NOLINTNEXTLINE(runtime/references) Per hash_append convention. + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. HashAlgorithm& hasher, Iter begin, Iter end) noexcept { using drake::hash_append; size_t count{0}; diff --git a/common/identifier.h b/common/identifier.h index f4088e2f1ff7..13763725f52d 100644 --- a/common/identifier.h +++ b/common/identifier.h @@ -194,7 +194,7 @@ class Identifier { confirm it is valid before using it as a key (or other hashing application). */ template - // NOLINTNEXTLINE(runtime/references) + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Identifier& i) noexcept { using drake::hash_append; hash_append(hasher, i.value_); diff --git a/common/symbolic/chebyshev_polynomial.h b/common/symbolic/chebyshev_polynomial.h index 3ff4fc5001b3..996161522841 100644 --- a/common/symbolic/chebyshev_polynomial.h +++ b/common/symbolic/chebyshev_polynomial.h @@ -100,7 +100,7 @@ class ChebyshevPolynomial { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const ChebyshevPolynomial& item) noexcept { if (item.degree() == 0) { diff --git a/common/type_safe_index.h b/common/type_safe_index.h index 2e22b058a9eb..7b94fdefba82 100644 --- a/common/type_safe_index.h +++ b/common/type_safe_index.h @@ -489,7 +489,7 @@ class TypeSafeIndex { /// the user to confirm it is valid before using it as a key (or other hashing /// application). template - // NOLINTNEXTLINE(runtime/references) + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const TypeSafeIndex& i) noexcept { using drake::hash_append; diff --git a/geometry/render_gl/internal_buffer_dim.h b/geometry/render_gl/internal_buffer_dim.h index 181b8650078e..63d357faff06 100644 --- a/geometry/render_gl/internal_buffer_dim.h +++ b/geometry/render_gl/internal_buffer_dim.h @@ -25,7 +25,7 @@ class BufferDim { /* Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const BufferDim& dim) noexcept { using drake::hash_append; diff --git a/solvers/binding.h b/solvers/binding.h index 797525b86cbe..4b2e0fc8602f 100644 --- a/solvers/binding.h +++ b/solvers/binding.h @@ -119,7 +119,7 @@ class Binding { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const Binding& item) noexcept { using drake::hash_append; diff --git a/solvers/solver_id.h b/solvers/solver_id.h index a3ced5d53927..d087f4f302bf 100644 --- a/solvers/solver_id.h +++ b/solvers/solver_id.h @@ -35,7 +35,7 @@ class SolverId { /** Implements the @ref hash_append concept. */ template - // NOLINTNEXTLINE(runtime/references) + // NOLINTNEXTLINE(runtime/references) Per hash_append convention. friend void hash_append(HashAlgorithm& hasher, const SolverId& item) noexcept { using drake::hash_append; From bd0bf87e8b77f78a4e697d6cbe02fc20ed3ef2b8 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Mon, 10 Mar 2025 10:59:30 -0400 Subject: [PATCH 16/17] updated arithmetic casts to match drake styleguide --- multibody/mpm/particle_sorter.cc | 4 ++-- multibody/mpm/particle_sorter.h | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/multibody/mpm/particle_sorter.cc b/multibody/mpm/particle_sorter.cc index debaf50f1e74..87bb5755ca3f 100644 --- a/multibody/mpm/particle_sorter.cc +++ b/multibody/mpm/particle_sorter.cc @@ -76,12 +76,12 @@ void ParticleSorter::ComputeBitInformation(const SpGridFlags& flags, // TODO(xuchenhan-tri): This should be checked when we register particles to // the MPM model. /* Confirm that index_bits_ is enough to store num_particles. */ - const uint64_t capacity = (static_cast(1) << index_bits_); + const uint64_t capacity = (uint64_t{1} << index_bits_); DRAKE_DEMAND(capacity > static_cast(num_particles)); } void ParticleSorter::UnpackResults() { - const uint64_t index_mask = ((static_cast(1) << index_bits_) - 1); + const uint64_t index_mask = ((uint64_t{1} << index_bits_) - 1); for (int p = 0; p < static_cast(particle_sorters_.size()); ++p) { /* Lower bits store the particle's original index. */ diff --git a/multibody/mpm/particle_sorter.h b/multibody/mpm/particle_sorter.h index 319f308163da..2d16c0df8a1f 100644 --- a/multibody/mpm/particle_sorter.h +++ b/multibody/mpm/particle_sorter.h @@ -215,12 +215,11 @@ class ParticleSorter { base_node_offsets_[p] = spgrid.CoordinateToOffset(base_node[0], base_node[1], base_node[2]); /* Confirm the data bits of the base node offset are all zero. */ - DRAKE_ASSERT((base_node_offsets_[p] & - ((static_cast(1) << data_bits_) - 1)) == 0); - /* Confirm the left most bits in the page bits are unused. */ DRAKE_ASSERT( - (base_node_offsets_[p] & - ~((static_cast(1) << (64 - zero_page_bits_)) - 1)) == 0); + (base_node_offsets_[p] & ((uint64_t{1} << data_bits_) - 1)) == 0); + /* Confirm the left most bits in the page bits are unused. */ + DRAKE_ASSERT((base_node_offsets_[p] & + ~((uint64_t{1} << (64 - zero_page_bits_)) - 1)) == 0); particle_sorters_[p] = (base_node_offsets_[p] << zero_page_bits_) + p; } } From ce8c869e9f805c9b4de6d2e7ce49a841dbba6377 Mon Sep 17 00:00:00 2001 From: Aiden McCormack Date: Mon, 10 Mar 2025 11:01:54 -0400 Subject: [PATCH 17/17] reintroduced utility stl header in sparse_grid.cc --- multibody/mpm/sparse_grid.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/multibody/mpm/sparse_grid.cc b/multibody/mpm/sparse_grid.cc index d26c40d95d09..7708ecb3440c 100644 --- a/multibody/mpm/sparse_grid.cc +++ b/multibody/mpm/sparse_grid.cc @@ -1,5 +1,7 @@ #include "drake/multibody/mpm/sparse_grid.h" +#include + namespace drake { namespace multibody { namespace mpm {