loguru icon indicating copy to clipboard operation
loguru copied to clipboard

Also suppress clang warnings about unknown warnings

Open seanm opened this issue 4 years ago • 2 comments

Without this, older versions of clang will for example warn:

loguru.cpp:21:32: warning: unknown warning group '-Wzero-as-null-pointer-constant', ignored [-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" ^

seanm avatar Sep 28 '21 15:09 seanm

Why do we want to ignore these warnings?

bylowerik avatar Feb 21 '22 21:02 bylowerik

Without this patch, old versions of clang warn on the existing line:

#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"

Because old versions don't have -Wzero-as-null-pointer-constant so they say "what's this warning you want me to disable?! there is no such warning."

An alternative is to conditionalize the diagnostic ignored statements, for clang you could do like this:

#if __has_warning("-Wreserved-identifier")
	#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif

But I'm not sure about gcc....

seanm avatar Feb 21 '22 21:02 seanm