Skip to content

Commit

Permalink
Require semicolons on statement-like macros (RobotLocomotion#21603)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri authored Jun 24, 2024
1 parent d990915 commit 7bc44f5
Show file tree
Hide file tree
Showing 840 changed files with 1,255 additions and 1,250 deletions.
4 changes: 2 additions & 2 deletions bindings/pydrake/common/serialize_pybind.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace internal {
template <typename PyClass, typename Docs>
class DefAttributesArchive {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(DefAttributesArchive)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(DefAttributesArchive);

using CxxClass = typename PyClass::type;

Expand Down Expand Up @@ -260,7 +260,7 @@ namespace internal {
// Helper for DefReprUsingSerialize.
class DefReprArchive {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(DefReprArchive)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(DefReprArchive);
DefReprArchive() = default;

// Appends the visited item's name to the list of names.
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/common/test/wrap_function_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ GTEST_TEST(WrapFunction, ChangeCallbackOnly) {

// Testing for #15505.
struct ArgNoCopyNoMove {
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(ArgNoCopyNoMove)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(ArgNoCopyNoMove);
ArgNoCopyNoMove() {}
};

Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/common/test/wrap_test_util_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool CheckTypeConversionExample(const TypeConversionExample& obj) {

class NotCopyable {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(NotCopyable)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(NotCopyable);
NotCopyable() {}
};

Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/systems/test/test_util_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DeleteListenerVector : public BasicVector<T> {
template <typename T>
class MyVector2 : public BasicVector<T> {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(MyVector2)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(MyVector2);

explicit MyVector2(const Vector2<T>& data) : BasicVector<T>(data) {}

Expand Down
19 changes: 10 additions & 9 deletions common/default_scalars.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
/// } // namespace sample
///
/// DRAKE_DECLARE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(
/// class ::sample::MySystem)
/// class ::sample::MySystem);
/// @endcode
///
/// Example `my_system.cc`:
/// @code
/// #include "my_system.h"
///
/// DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(
/// class ::sample::MySystem)
/// class ::sample::MySystem);
/// @endcode
///
/// See also @ref system_scalar_conversion.
Expand All @@ -79,31 +79,31 @@
SomeType) \
template SomeType<double>; \
template SomeType<::drake::AutoDiffXd>; \
template SomeType<::drake::symbolic::Expression>;
template SomeType<::drake::symbolic::Expression>

/// Defines template instantiations for Drake's default nonsymbolic scalars.
/// This should only be used in .cc files, never in .h files.
#define \
DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_NONSYMBOLIC_SCALARS( \
SomeType) \
template SomeType<double>; \
template SomeType<::drake::AutoDiffXd>;
template SomeType<::drake::AutoDiffXd>

/// Declares that template instantiations exist for Drake's default scalars.
/// This should only be used in .h files, never in .cc files.
#define DRAKE_DECLARE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS( \
SomeType) \
extern template SomeType<double>; \
extern template SomeType<::drake::AutoDiffXd>; \
extern template SomeType<::drake::symbolic::Expression>;
extern template SomeType<::drake::symbolic::Expression>

/// Declares that template instantiations exist for Drake's default nonsymbolic
/// scalars. This should only be used in .h files, never in .cc files.
#define \
DRAKE_DECLARE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_NONSYMBOLIC_SCALARS( \
SomeType) \
extern template SomeType<double>; \
extern template SomeType<::drake::AutoDiffXd>;
extern template SomeType<::drake::AutoDiffXd>

/// @}

Expand Down Expand Up @@ -168,7 +168,7 @@ extern template SomeType<::drake::AutoDiffXd>;
/// &Func1<T>,
/// &Func2<T, U>,
/// &SomeClass<T>::template cast<U>
/// ))
/// ));
///
/// } // namespace sample
/// @endcode
Expand Down Expand Up @@ -204,7 +204,7 @@ static constexpr auto Function_Femplates __attribute__((used)) = \
Make_Function_Pointers_Pack1< \
double, \
::drake::AutoDiffXd, \
::drake::symbolic::Expression>();
::drake::symbolic::Expression>()

/// Defines template instantiations for Drake's default nonsymbolic scalars.
/// This should only be used in .cc files, never in .h files.
Expand All @@ -223,9 +223,10 @@ template<typename... Ts> \
constexpr auto Make_Function_Pointers_Nonsym_Pack1() { \
return std::tuple_cat(Make_Function_Pointers_Nonsym_Pack2<Ts, Ts...>()...); \
} \
/* NOLINTNEXTLINE(readability/fn_size) */ \
static constexpr auto Function_Templates_Nonsym __attribute__((used)) = \
Make_Function_Pointers_Nonsym_Pack1< \
double, \
::drake::AutoDiffXd>();
::drake::AutoDiffXd>()

/// @}
2 changes: 1 addition & 1 deletion common/diagnostic_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ back from that method; typically, this means "return;" should follow its use.
*/
class DiagnosticPolicy {
public:
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(DiagnosticPolicy)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(DiagnosticPolicy);
DiagnosticPolicy() = default;

/* Triggers a warning. */
Expand Down
12 changes: 6 additions & 6 deletions common/drake_copyable.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ declaration, e.g.:
<pre>
class Foo {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Foo)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Foo);
// ...
};
Expand All @@ -34,7 +34,7 @@ class Foo {
Classname(const Classname&) = delete; \
void operator=(const Classname&) = delete; \
Classname(Classname&&) = delete; \
void operator=(Classname&&) = delete;
void operator=(Classname&&) = delete

/** DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN defaults the special member
functions for copy-construction, copy-assignment, move-construction, and
Expand All @@ -48,7 +48,7 @@ should invoke this macro in the public section of the class declaration, e.g.:
<pre>
class Foo {
public:
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Foo)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Foo);
// ...
};
Expand Down Expand Up @@ -87,7 +87,7 @@ that in a unit test.
&DrakeDefaultCopyAndMoveAndAssign_DoAssign, \
"This assertion is never false; its only purpose is to " \
"generate 'use of deleted function: operator=' errors " \
"when Classname is a template.");
"when Classname is a template.")

/** DRAKE_DECLARE_COPY_AND_MOVE_AND_ASSIGN declares the special member functions
for copy-construction, copy-assignment, move-construction, and move-assignment.
Expand All @@ -100,7 +100,7 @@ macro in the public section of the class declaration, e.g.:
<pre>
class Foo {
public:
DRAKE_DECLARE_COPY_AND_MOVE_AND_ASSIGN(Foo)
DRAKE_DECLARE_COPY_AND_MOVE_AND_ASSIGN(Foo);
// ...
};
Expand All @@ -111,4 +111,4 @@ Then the matching definitions should be placed in the associated .cc file.
Classname(const Classname&); \
Classname& operator=(const Classname&); \
Classname(Classname&&); \
Classname& operator=(Classname&&);
Classname& operator=(Classname&&)
2 changes: 1 addition & 1 deletion common/eigen_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class EigenPtr {
// `std::is_copy_assignable`.
class ReassignableRef {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(ReassignableRef)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(ReassignableRef);
ReassignableRef() {}
~ReassignableRef() {
reset();
Expand Down
2 changes: 1 addition & 1 deletion common/identifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int64_t get_new_identifier();
template <class Tag>
class Identifier {
public:
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Identifier)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Identifier);

/** Default constructor; the result is an _invalid_ identifier. This only
exists to satisfy demands of working with various container classes. */
Expand Down
2 changes: 1 addition & 1 deletion common/name_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace drake {
template <typename T>
class NameValue {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(NameValue)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(NameValue);

/// Type of the referenced value.
typedef T value_type;
Expand Down
4 changes: 2 additions & 2 deletions common/never_destroyed.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace drake {
/// @code
/// class Singleton {
/// public:
/// DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Singleton)
/// DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Singleton);
/// static Singleton& getInstance() {
/// static never_destroyed<Singleton> instance;
/// return instance.access();
Expand Down Expand Up @@ -80,7 +80,7 @@ namespace drake {
template <typename T>
class never_destroyed {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(never_destroyed)
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(never_destroyed);

/// Passes the constructor arguments along to T using perfect forwarding.
template <typename... Args>
Expand Down
2 changes: 1 addition & 1 deletion common/parallelism.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ unit test requires actual parallelism, use the `num_threads = N` attribute in
the `BUILD.bazel` file to declare a different value. */
class Parallelism {
public:
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Parallelism)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Parallelism);

/** Constructs a %Parallelism with no parallelism (i.e., num_threads=1).
Python note: This function is not bound in pydrake (due to its name); instead,
Expand Down
2 changes: 1 addition & 1 deletion common/polynomial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -854,4 +854,4 @@ Polynomial<T> Polynomial<T>::FromExpression(const Expression& e) {
} // namespace drake

DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(
class drake::Polynomial)
class drake::Polynomial);
2 changes: 1 addition & 1 deletion common/polynomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,4 +524,4 @@ struct formatter<drake::Polynomial<double>::Monomial>
} // namespace fmt

DRAKE_DECLARE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(
class drake::Polynomial)
class drake::Polynomial);
2 changes: 1 addition & 1 deletion common/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace drake {
/// https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
class RandomGenerator {
public:
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(RandomGenerator)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(RandomGenerator);

using result_type = std::mt19937::result_type;

Expand Down
2 changes: 1 addition & 1 deletion common/reset_after_move.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace drake {
/// <pre>
/// class Foo {
/// public:
/// DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Foo)
/// DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Foo);
/// Foo() = default;
///
/// private:
Expand Down
2 changes: 1 addition & 1 deletion common/reset_on_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace drake {
/// <pre>
/// class Foo {
/// public:
/// DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Foo)
/// DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Foo);
/// Foo() = default;
///
/// private:
Expand Down
10 changes: 5 additions & 5 deletions common/schema/rotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace schema {
/// details, especially the unusually public member fields.
class Rotation {
public:
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Rotation)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Rotation);

/// Constructs the Identity rotation.
Rotation() = default;
Expand All @@ -37,7 +37,7 @@ class Rotation {

/// No-op rotation.
struct Identity {
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Identity)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Identity);
Identity() = default;

template <typename Archive>
Expand All @@ -47,7 +47,7 @@ class Rotation {
/// A roll-pitch-yaw rotation, using the angle conventions of Drake's
/// RollPitchYaw.
struct Rpy {
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Rpy)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Rpy);
Rpy() = default;

template <typename Archive>
Expand All @@ -60,7 +60,7 @@ class Rotation {

/// Rotation constructed from a fixed axis and an angle.
struct AngleAxis {
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(AngleAxis)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(AngleAxis);
AngleAxis() = default;

template <typename Archive>
Expand All @@ -75,7 +75,7 @@ class Rotation {

/// Rotation sampled from a uniform distribution over SO(3).
struct Uniform {
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Uniform)
DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN(Uniform);
Uniform() = default;

template <typename Archive>
Expand Down
Loading

0 comments on commit 7bc44f5

Please sign in to comment.