-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore: collect all #define PYBIND11_HAS_...
macros in pybind11/detail/common.h
#5647
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
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 |
---|---|---|
|
@@ -12,22 +12,12 @@ | |
|
||
#include <string> | ||
|
||
#ifdef __has_include | ||
# if defined(PYBIND11_CPP17) | ||
# if __has_include(<filesystem>) | ||
# include <filesystem> | ||
# define PYBIND11_HAS_FILESYSTEM 1 | ||
# elif __has_include(<experimental/filesystem>) | ||
# include <experimental/filesystem> | ||
# define PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM 1 | ||
# endif | ||
# endif | ||
#endif | ||
|
||
#if !defined(PYBIND11_HAS_FILESYSTEM) && !defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM) \ | ||
&& !defined(PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL) | ||
# error \ | ||
"Neither #include <filesystem> nor #include <experimental/filesystem is available. (Use -DPYBIND11_HAS_FILESYSTEM_IS_OPTIONAL to ignore.)" | ||
#if defined(PYBIND11_HAS_FILESYSTEM) | ||
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. The removal of the PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL branch changes the behavior for environments where neither nor <experimental/filesystem> is available. Consider updating the documentation or migration notes to inform users of this breaking change. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback 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 reasoned this out with the help of Chat: https://chatgpt.com/share/681da436-a5fc-8008-8d13-402e8bcbaa8e ✅ Conclusion Removing a test-only macro, Consolidating detection macros in a single header, Ensuring that So: you’re not overlooking anything, and the PR is correct as is. |
||
# include <filesystem> | ||
#elif defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM) | ||
# include <experimental/filesystem> | ||
#else | ||
# error "Neither #include <filesystem> nor #include <experimental/filesystem is available." | ||
#endif | ||
|
||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) | ||
|
Uh oh!
There was an error while loading. Please reload this page.