Merge branch 'cygwin' of https://github.com/BorisSchaeling/pybind11 into BorisSchaeling-cygwin
diff --git a/.gitignore b/.gitignore
index a7a4956..1551bc2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
.DS_Store
/example/example.so
/example/example.pyd
+/example/example.dll
*.sln
*.sdf
*.opensdf
diff --git a/CMakeLists.txt b/CMakeLists.txt
index accee6d..b255045 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,7 +92,7 @@
if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
# Check for Link Time Optimization support (GCC/Clang)
check_cxx_compiler_flag("-flto" HAS_LTO_FLAG)
- if(HAS_LTO_FLAG)
+ if(HAS_LTO_FLAG AND NOT CYGWIN)
target_compile_options(${target_name} PRIVATE -flto)
endif()
@@ -138,7 +138,7 @@
if(MSVC)
target_compile_options(${target_name} PRIVATE /W4)
else()
- target_compile_options(${target_name} PRIVATE -Wall -Wextra)
+ target_compile_options(${target_name} PRIVATE -Wall -Wextra -Wconversion)
endif()
endfunction()
diff --git a/README.md b/README.md
index 08b58bf..d9505ac 100644
--- a/README.md
+++ b/README.md
@@ -90,6 +90,7 @@
2. GCC (any non-ancient version with C++11 support)
3. Microsoft Visual Studio 2015 or newer
4. Intel C++ compiler v15 or newer
+5. Cygwin
## About
diff --git a/example/example10.cpp b/example/example10.cpp
index cbe737e..06528c2 100644
--- a/example/example10.cpp
+++ b/example/example10.cpp
@@ -13,7 +13,7 @@
double my_func(int x, float y, double z) {
std::cout << "my_func(x:int=" << x << ", y:float=" << y << ", z:float=" << z << ")" << std::endl;
- return x*y*z;
+ return (float) x*y*z;
}
std::complex<double> my_func3(std::complex<double> c) {
diff --git a/example/example4.cpp b/example/example4.cpp
index 281eafe..7e17864 100644
--- a/example/example4.cpp
+++ b/example/example4.cpp
@@ -38,7 +38,7 @@
float test_function3(int i) {
std::cout << "test_function(" << i << ")" << std::endl;
- return i / 2.f;
+ return (float) i / 2.f;
}
py::bytes return_bytes() {
diff --git a/include/pybind11/common.h b/include/pybind11/common.h
index e60684f..272c207 100644
--- a/include/pybind11/common.h
+++ b/include/pybind11/common.h
@@ -262,7 +262,7 @@
std::unordered_map<const void *, void*> registered_instances; // void * -> PyObject*
std::unordered_set<std::pair<const PyObject *, const char *>, overload_hash> inactive_overload_cache;
#if defined(WITH_THREAD)
- int tstate = 0;
+ decltype(PyThread_create_key()) tstate = 0; // Usually an int but a long on Cygwin64 with Python 3.x
PyInterpreterState *istate = nullptr;
#endif
};
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index 690c635..7ac9e5c 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -1156,7 +1156,7 @@
gil_scoped_release(bool disassoc = false) : disassoc(disassoc) {
tstate = PyEval_SaveThread();
if (disassoc) {
- int key = detail::get_internals().tstate;
+ auto key = detail::get_internals().tstate;
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value(key);
#else
@@ -1169,7 +1169,7 @@
return;
PyEval_RestoreThread(tstate);
if (disassoc) {
- int key = detail::get_internals().tstate;
+ auto key = detail::get_internals().tstate;
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value(key);
#endif