quicktype
quicktype copied to clipboard
c++ warning unused parameter ‘j’ for empty object
I have this minimal json schema:
{
"type": "object",
"additionalProperties": false
}
which render as following code:
// ...
struct Nop {};
inline void from_json(const json & j, Nop& x) {}
inline void to_json(json & j, const Nop & x) {
j = json::object();
}
The compiler raise warning about j or x are not used. And since I use the -Werror option, it turns into an error.
I can use #pragma GCC diagnostic … to change compiler warning behavior, but it is not satisfying and not portable. It will be better if the generated code does not create any warning.