Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings for strict variadic macro checks (stronger C++20 enforcement) #63

Open
RalphSteinhagen opened this issue Jan 7, 2022 · 0 comments

Comments

@RalphSteinhagen
Copy link
Contributor

While code-base spring cleaning I noticed that I (unwisely) ignored some refl-cpp variadic macro warnings that prevent gcc|clang compiling with more strict checks enabled (i.e. -Werror).

This shows up already for C++17 with the existing basic refl-cpp's default serialiser example and -pedantic compiler flags.
The corresponding sample output and warnings from running the tests at compiler-explorer:

  • gcc 10.2 or newer produces the following warning:
https://raw.githubusercontent.com/veselink1/refl-cpp/master/include/refl.hpp:4363:31: warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
  • clang 12.0 or newer produce a bit more understandable warning outputs:
https://raw.githubusercontent.com/veselink1/refl-cpp/master/include/refl.hpp:4363:5: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
    REFL_DETAIL_PRIMITIVE(char);
    ^
https://raw.githubusercontent.com/veselink1/refl-cpp/master/include/refl.hpp:4359:23: note: expanded from macro 'REFL_DETAIL_PRIMITIVE'
    REFL_TYPE(TypeName) \
                      ^

These checks seem to become more enforced for but also there seems to be a clean solution for C++20 #define FOO(x, ...) bar(x __VA_OPT__(,) __VA_ARGS__) as, for example, discussed in more detail here.
I was wondering whether this could be addressed under the premise that refl-cpp is C++17-based?

Any help would be much appreciated! Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant