-
Notifications
You must be signed in to change notification settings - Fork 279
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
On WIN32, fix compile errors on Clang with MSVC headers #718
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,7 +221,7 @@ static char *posixly_correct; | |
/* Avoid depending on library functions or files | ||
whose names are inconsistent. */ | ||
|
||
#ifndef getenv | ||
#if !defined(getenv) && !(defined(__clang__) && defined(_MSC_VER)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not too sure what this does, and why it doesn't work for your particular configuration. Maybe it can be removed completely? I think it catches some corner case that existed 30 years ago or something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems on Windows, using Clang with MSVC headers would cause
Which is defined as _Check_return_ _CRT_INSECURE_DEPRECATE(_dupenv_s)
_DCRTIMP char* __cdecl getenv(
_In_z_ char const* _VarName
); in <stdlib.h>. I think the best way to handle this error is to remove the extern declaration when it is clang and MSVC. |
||
extern char *getenv (const char * name); | ||
#endif | ||
|
||
|
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.
I think now it is only targeting when using Clang and MSVC headers, for MinGW headers contains unistd.h but MSVC ones does not. Adding cmake_policy is to suppress the warnings.