Skip to content

Detect if afunix.h exists #2145

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

Merged
merged 1 commit into from
May 24, 2025
Merged

Detect if afunix.h exists #2145

merged 1 commit into from
May 24, 2025

Conversation

p1-0tr
Copy link
Contributor

@p1-0tr p1-0tr commented May 21, 2025

Older versions of the windows 10 SDK may not have afunix.h. So add logic to detect if the header exists, and enable AF_UNIX only on supported windows versions.

@p1-0tr
Copy link
Contributor Author

p1-0tr commented May 23, 2025

@yhirose I'm not sure why the abidiff step is failing. My change does not touch any function definitions, so it should not fail.

@yhirose
Copy link
Owner

yhirose commented May 23, 2025

@p1-0tr you don't need to worry about the abidiff error.

@@ -192,8 +192,11 @@ using ssize_t = long;
#include <winsock2.h>
#include <ws2tcpip.h>

#if __has_include(<afunix.h>)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p1-0tr this is not compatible with C++11.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it only got standardised as of c++17, but has been supported by all major compilers before that. I've added an additional check that should protect against errors on compilers that do not support that macro.

httplib.h Outdated
// afunix.h uses types declared in winsock2.h, so has to be included after it.
#include <afunix.h>
#define HAVE_AFUNIX 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p1-0tr could you please rename it to CPPHTTPLIB_HAVE_AFUNIX_H?

Signed-off-by: Piotr Stankiewicz <[email protected]>
@p1-0tr p1-0tr force-pushed the ps-detect-af-unix branch from e8a70f7 to fac7c9e Compare May 23, 2025 10:44
@yhirose
Copy link
Owner

yhirose commented May 24, 2025

@p1-0tr thanks for the adjustments!

@yhirose yhirose merged commit 4a7aae5 into yhirose:master May 24, 2025
8 of 9 checks passed
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.

2 participants