-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(Clang CodeGen): remove warnings #582
Conversation
yumetodo
commented
Oct 14, 2017
./fmt/fmt/format.h(308,10): warning : unknown pragma ignored [-Wunknown-pragmas] # pragma intrinsic(_BitScanReverse) ^ 1 warning generated. format.cc In file included from fmt\fmt\format.cc:28: fmt\fmt/format.h(308,10): warning : unknown pragma ignored [-Wunknown-pragmas] # pragma intrinsic(_BitScanReverse) ^ fmt\fmt\format.cc(165,17): warning : 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations] buffer_ = strerror(error_code_); ^ C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(178,24) : note: 'strerror' has been explicitly marked deprecated here _ACRTIMP char* __cdecl strerror( ^ fmt\fmt\format.cc(78,37): warning : unused function 'strerror_s' [-Wunused-function] static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) { ^ 3 warnings generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR! Looks good but could you replace -Wunused-function
suppression with calling the dummy strerror_s
function as it is done for strerror_r
in
Line 175 in 933a33a
strerror_r(0, FMT_NULL, ""); |
@vitaut I've fixed that. However, it is too dirty to use dummy function call to remove |
I usually cast the function to |
Like this
without actually calling it? |
Yes |
@foonathan out of the question
|
Yeah, okay ːD |
We should consider #if FMT_HAS_CPP_ATTRIBUTE(maybe_unused)
# define FMT_HAS_CXX17_ATTRIBUTE_MAYBE_UNUSED
#elif defined(_MSVC_LANG) && _MSVC_LANG > 201402
# define FMT_HAS_CXX17_ATTRIBUTE_MAYBE_UNUSED
#endif
#ifdef FMT_HAS_CXX17_ATTRIBUTE_MAYBE_UNUSED
# define FMT_MAYBE_UNUSED [[maybe_unused]]
#elif defined(__GNUC__)
# define FMT_MAYBE_UNUSED __attribute__ ((unused))
#else
#define FMT_MAYBE_UNUSED
#endif FMT_MAYBE_UNUSED static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {
return fmt::internal::Null<>();
} |
Good idea. |
…of dummy function call
Merged in 708d950, thanks! |