Skip to content

Commit 77aed48

Browse files
committed
Enable compiling with clang's -Wsuggest-override
When compiling step definitions with clang's `-Wsuggest-override`, clang warns about every step definition because the expanded `body()` from the macro overrides a virtual function, but isn't marked `override`.
1 parent dd424c1 commit 77aed48

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/cucumber-cpp/internal/RegistrationMacros.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#ifndef CUKE_REGISTRATIONMACROS_HPP_
22
#define CUKE_REGISTRATIONMACROS_HPP_
33

4+
#if __cplusplus >= 201103L
5+
#define CUKE_OVERRIDE override
6+
#else
7+
#define CUKE_OVERRIDE
8+
#endif
9+
410
// ************************************************************************** //
511
// ************** OBJECT NAMING MACROS ************** //
612
// ************************************************************************** //
@@ -24,7 +30,7 @@
2430
#define CUKE_OBJECT_(class_name, parent_class, registration_fn, args) \
2531
class class_name : public parent_class { \
2632
public: \
27-
void body() { \
33+
void body() CUKE_OVERRIDE { \
2834
return invokeWithArgs(*this, &class_name::bodyWithArgs); \
2935
} \
3036
void bodyWithArgs args; \

0 commit comments

Comments
 (0)