Skip to content

Tweak some macro definition on Windows #5606

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

Closed
wants to merge 1 commit into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented May 20, 2020

Does this seem reasonable @cmb69 ?
The change for HAVE_GRP_H is that because instead of doing an #ifdef we used #if making this feature disabled on Windows although it should have been enabled.

@KalleZ
Copy link
Member

KalleZ commented May 20, 2020

Reading over at the MSDN docs, it does sound to me like wspiapi.h is always available as of Windows 2000, which is way below our minimum required version of Windows, which I guess could mean we could simplify the IPV6 support check at the same time in config.w32 a little.

For HAVE_GRP_H we supply our own minimalistic header in win32/grp.h, so even if we mark HAVE_GRP_H as 1, any preprocessor checks needs to still check for PHP_WIN32 to conditionally include that file instead, so I think it might be better left as it is to not give a false illusion that it exists. When I implemented the nice() functionality, I opted to define HAVE_NICE as its a single function, not a header and I think we should follow the same principle here. On a similar note, I think we do the same for unistd.h too (provide our own, don't define HAVE_UNISTD_H).

Looking at the 3 files that uses HAVE_GRP_H all have a conditional check for Windows inside it, so yes it should enable some functionality, but I think the checks should be changed instead with an #elif defined(PHP_WIN32).

@Girgias
Copy link
Member Author

Girgias commented May 20, 2020

Reading over at the MSDN docs, it does sound to me like wspiapi.h is always available as of Windows 2000, which is way below our minimum required version of Windows, which I guess could mean we could simplify the IPV6 support check at the same time in config.w32 a little.

For HAVE_GRP_H we supply our own minimalistic header in win32/grp.h, so even if we mark HAVE_GRP_H as 1, any preprocessor checks needs to still check for PHP_WIN32 to conditionally include that file instead, so I think it might be better left as it is to not give a false illusion that it exists. When I implemented the nice() functionality, I opted to define HAVE_NICE as its a single function, not a header and I think we should follow the same principle here. On a similar note, I think we do the same for unistd.h too (provide our own, don't define HAVE_UNISTD_H).

Looking at the 3 files that uses HAVE_GRP_H all have a conditional check for Windows inside it, so yes it should enable some functionality, but I think the checks should be changed instead with an #elif defined(PHP_WIN32).

Seems reasonable I'll amend the PR with a change to elif.

@cmb69
Copy link
Member

cmb69 commented May 22, 2020

It seems to me that setting HAVE_GRP_H on Windows is currently absolutely useless, since none of the respective functions are available, and I consider it somewhat unlikely that they ever will. Why do we even have win32/grp.h in the first place?

@nikic
Copy link
Member

nikic commented Aug 6, 2020

Based on @cmb69's comment, it looks like the correct action is the other way around: Keep HAVE_GRP_H=0 and remove the win32/grp.h header, which is currently unused (included only in dead paths).

@Girgias Girgias force-pushed the windows-build-macros branch from b4e6cab to 30743f8 Compare August 6, 2020 15:13
@Girgias Girgias force-pushed the windows-build-macros branch from 30743f8 to 591f3f4 Compare September 22, 2020 17:20
@Girgias Girgias requested a review from cmb69 September 22, 2020 17:20
@php-pulls php-pulls closed this in 1e9db80 Sep 22, 2020
@Girgias Girgias deleted the windows-build-macros branch September 22, 2020 22:06
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

Successfully merging this pull request may close these issues.

4 participants