jeremy-rifkin / cpptrace

Simple, portable, and self-contained stacktrace library for C++11 and newer
MIT License
621 stars 64 forks source link

Variadic macros used in manner not compliant with ISO C++11 #107

Closed judemille closed 3 months ago

judemille commented 5 months ago

Compiling with -Wpedantic reveals a significant number of warnings surrounding the use of the assertion macros in utils/error.hpp. It seems that invoking such a macro without at least one argument for the ... is a violation of ISO C++11. It makes sense to me.

I can submit a PR to separate these macros out into versions with and without messages attached to them.

jeremy-rifkin commented 5 months ago

Hi, For any internal library code that is never included into end-user code I haven’t been concerned with -Wpedantic. Users FetchContnet’ing the library probably shouldn’t be imposing the flag on the library target and the library doesn't set it itself.

However, if this is the only thing, or one of few things, in the library that doesn’t get along with -Wpedantic and it would make a big difference for you I’d be happy to merge a PR.

marlowa commented 4 months ago

I'd like to see this addressed in the cpptrace header please. Use of the pedantic flag opens one up to issues like this where it is desirable to see pedantic warnings in a project but we get distractions from pedantic warnings in third party headers. It's worse when one is trying to clean up a codebase and have the pedantic warnings treated as errors because it means the project fails to build even though the code of the project itself might be ok.

jeremy-rifkin commented 4 months ago

If this is affecting multiple users then it's reasonable to try to resolve and support. I can try to resolve this since I haven't heard back from OP.

@marlowa Are you seeing pedantic warnings in cpptrace public-facing headers? (i.e. cpptrace.hpp and ctrace.h) If so, what compiler are you using? I wasn't able to reproduce any with a brief test https://godbolt.org/z/Tnj1G3Wbz.