Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/common/va_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,3 @@
#define PP_THIRD_ARG(a,b,c,...) c
#define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(,),true,false,)
#define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?)

// VA_ARGS_COMMAPREFIX(): VA_ARGS_COMMAPREFIX(__VA_ARGS__) expands to __VA_ARGS__ with a comma in
// front if more than one argument, else nothing.
// If __VA_OPT__ supported, use that. Else, use GCC's ,## hack
#if VA_OPT_SUPPORTED
# define VA_ARGS_COMMAPREFIX(...) __VA_OPT__(,) __VA_ARGS__
#else
# define VA_ARGS_COMMAPREFIX(...) , ## __VA_ARGS__
#endif

12 changes: 6 additions & 6 deletions src/serialization/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ inline auto do_serialize(Archive &ar, T &v, Args&&... args)
* VARINT_FIELD_F(). Otherwise, this macro is similar to
* BEGIN_SERIALIZE_OBJECT(), as you should list only field serializations.
*/
#define BEGIN_SERIALIZE_OBJECT_FN(stype, ...) \
template <bool W, template <bool> class Archive> \
bool do_serialize_object(Archive<W> &ar, stype &v VA_ARGS_COMMAPREFIX(__VA_ARGS__)) {
#define BEGIN_SERIALIZE_OBJECT_FN(stype) \
template <bool W, template <bool> class Archive> \
bool do_serialize_object(Archive<W> &ar, stype &v) {

/*! \macro PREPARE_CUSTOM_VECTOR_SERIALIZATION
*/
Expand All @@ -211,10 +211,10 @@ inline auto do_serialize(Archive &ar, T &v, Args&&... args)
*
* \brief serializes a field \a f tagged \a t
*/
#define FIELD_N(t, f, ...) \
#define FIELD_N(t, f) \
do { \
ar.tag(t); \
bool r = do_serialize(ar, f VA_ARGS_COMMAPREFIX(__VA_ARGS__)); \
bool r = do_serialize(ar, f); \
if (!r || !ar.good()) return false; \
} while(0);

Expand All @@ -233,7 +233,7 @@ inline auto do_serialize(Archive &ar, T &v, Args&&... args)
*
* \brief tags the field with the variable name and then serializes it (for use in a free function)
*/
#define FIELD_F(f, ...) FIELD_N(#f, v.f VA_ARGS_COMMAPREFIX(__VA_ARGS__))
#define FIELD_F(f) FIELD_N(#f, v.f)

/*! \macro FIELDS(f)
*
Expand Down