Merge pull request #10214

a817da5 serialization: revert va_args_commaprefix usage (jeffro256)
This commit is contained in:
tobtoht
2025-11-26 18:23:42 +00:00
2 changed files with 6 additions and 16 deletions

View File

@@ -33,13 +33,3 @@
#define PP_THIRD_ARG(a,b,c,...) c #define PP_THIRD_ARG(a,b,c,...) c
#define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(,),true,false,) #define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(,),true,false,)
#define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?) #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

View File

@@ -191,9 +191,9 @@ inline auto do_serialize(Archive &ar, T &v, Args&&... args)
* VARINT_FIELD_F(). Otherwise, this macro is similar to * VARINT_FIELD_F(). Otherwise, this macro is similar to
* BEGIN_SERIALIZE_OBJECT(), as you should list only field serializations. * BEGIN_SERIALIZE_OBJECT(), as you should list only field serializations.
*/ */
#define BEGIN_SERIALIZE_OBJECT_FN(stype, ...) \ #define BEGIN_SERIALIZE_OBJECT_FN(stype) \
template <bool W, template <bool> class Archive> \ template <bool W, template <bool> class Archive> \
bool do_serialize_object(Archive<W> &ar, stype &v VA_ARGS_COMMAPREFIX(__VA_ARGS__)) { bool do_serialize_object(Archive<W> &ar, stype &v) {
/*! \macro PREPARE_CUSTOM_VECTOR_SERIALIZATION /*! \macro PREPARE_CUSTOM_VECTOR_SERIALIZATION
*/ */
@@ -211,10 +211,10 @@ inline auto do_serialize(Archive &ar, T &v, Args&&... args)
* *
* \brief serializes a field \a f tagged \a t * \brief serializes a field \a f tagged \a t
*/ */
#define FIELD_N(t, f, ...) \ #define FIELD_N(t, f) \
do { \ do { \
ar.tag(t); \ 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; \ if (!r || !ar.good()) return false; \
} while(0); } while(0);
@@ -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) * \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) /*! \macro FIELDS(f)
* *