Fix NLOHMANN_DEFINE_TYPE_* macros for zero-member types
This pull request solves the issue #4041 using the changes made in the closed PR #4323
- [x] The changes are described in detail, both the what and why.
- [x] If applicable, an existing issue is referenced.
- [x] The Code coverage remained at 100%. A test case for every new line of code.
- [ ] If applicable, the documentation is updated.
- [x] The source code is amalgamated by running
make amalgamate.
When any of the NLOHMANN_DEFINE_TYPE_* macros are used with no data members, the preprocessor currently expands VA_ARGS to an empty token. This leads to invalid code which breaks compilation for empty types.
This PR adjusts the macro_scope so that the zero-member case is handled explicitly. It finishes the work made in #4323 keeping the new changes like "Generate template functions with NLOHMANN_DEFINE_TYPE macros (#4597)" and to keep the documentations added.
Because develop has moved on since #4323, the changes were reapplied and adjusted manually rather than via a direct merge.
Tests has been included.
🔴 Amalgamation check failed! 🔴
The source code has not been amalgamated. @chelseadzdr Please read and follow the Contribution Guidelines.
coverage: 99.191%. remained the same when pulling 4c1689c52c6948e83b5ba9d2e275739b223c05d3 on chelseadzdr:fix-serialization into 49026f799983840d7cf1a8109ffffe7eb4b1012c on nlohmann:develop.
🔴 Amalgamation check failed! 🔴
The source code has not been amalgamated. @chelseadzdr Please read and follow the Contribution Guidelines.