Skip to content

Commit 47d80a4

Browse files
committed
Use POSIX API on Cygwin.
1 parent d8eca47 commit 47d80a4

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

build/Jamfile.v2

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rule select-windows-crypto-api ( properties * )
3939
{
4040
local result ;
4141

42-
if <target-os>windows in $(properties) || <target-os>cygwin in $(properties)
42+
if <target-os>windows in $(properties)
4343
{
4444
if ! [ has-config-flag BOOST_FILESYSTEM_DISABLE_BCRYPT : $(properties) ] &&
4545
[ configure.builds ../config//has_bcrypt : $(properties) : "has BCrypt API" ]
@@ -175,10 +175,6 @@ project
175175
<target-os>windows:<define>_WIN32_WINNT=0x0A00
176176
<target-os>windows:<define>WIN32_LEAN_AND_MEAN
177177
<target-os>windows:<define>NOMINMAX
178-
<target-os>cygwin:<define>BOOST_USE_WINDOWS_H
179-
<target-os>cygwin:<define>_WIN32_WINNT=0x0A00
180-
<target-os>cygwin:<define>WIN32_LEAN_AND_MEAN
181-
<target-os>cygwin:<define>NOMINMAX
182178

183179
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
184180
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105651
@@ -207,7 +203,7 @@ rule select-platform-specific-sources ( properties * )
207203
{
208204
local result ;
209205

210-
if <target-os>windows in $(properties) || <target-os>cygwin in $(properties)
206+
if <target-os>windows in $(properties)
211207
{
212208
result += <source>windows_file_codecvt.cpp ;
213209
}

include/boost/filesystem/config.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
#error BOOST_FILESYSTEM_WINDOWS_API and BOOST_FILESYSTEM_POSIX_API must not be defined by users
6060
#endif
6161

62-
// Cygwin is treated as Windows to minimize path character code conversions
63-
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
62+
#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
6463
#define BOOST_FILESYSTEM_WINDOWS_API
6564
#else
6665
#define BOOST_FILESYSTEM_POSIX_API

src/platform_config.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@
6868
#define _INCLUDE_STDCSOURCE_199901
6969
#endif
7070

71-
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) || \
72-
defined(__CYGWIN__)
71+
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
7372
// Define target Windows version macros before including any other headers
7473
#include <boost/winapi/config.hpp>
74+
#elif defined(__CYGWIN__)
75+
#define _POSIX_C_SOURCE 200809
7576
#endif
7677

7778
#ifndef BOOST_SYSTEM_NO_DEPRECATED

test/Jamfile.v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ rule check-mklink ( properties * )
4949
project
5050
: requirements
5151
<include>.
52+
<include>../src
5253
<target-os>windows:<define>_SCL_SECURE_NO_WARNINGS
5354
<target-os>windows:<define>_SCL_SECURE_NO_DEPRECATE
5455
<target-os>windows:<define>_CRT_SECURE_NO_WARNINGS

test/deprecated_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int cpp_main(int /*argc*/, char* /*argv*/[])
7878
// The choice of platform is make at runtime rather than compile-time
7979
// so that compile errors for all platforms will be detected even though
8080
// only the current platform is runtime tested.
81-
platform = (platform == "Win32" || platform == "Win64" || platform == "Cygwin") ? "Windows" : "POSIX";
81+
platform = (platform == "Win32" || platform == "Win64") ? "Windows" : "POSIX";
8282
std::cout << "Platform is " << platform << '\n';
8383

8484
l.push_back('s');

test/operations_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
// Library home page: http://www.boost.org/libs/filesystem
99

10+
#include "platform_config.hpp"
11+
1012
#include <boost/config/warning_disable.hpp>
1113

1214
// See deprecated_test for tests of deprecated features
@@ -729,10 +731,13 @@ void recursive_directory_iterator_tests()
729731
it != fs::recursive_directory_iterator();
730732
it.increment(ec))
731733
{
734+
std::cout << " iterator path: " << it->path().string() << std::endl;
732735
if (it->path().filename() == "d1f1")
733736
++d1f1_count;
734737
BOOST_TEST(it == it2); // verify single pass shallow copy semantics
735738
}
739+
if (ec)
740+
cout << " iterator increment returned error: " << ec << ", " << ec.message() << endl;
736741
BOOST_TEST(!ec);
737742
BOOST_TEST_EQ(d1f1_count, 1);
738743
BOOST_TEST(it == it2); // verify single pass shallow copy semantics

test/path_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2936,7 +2936,7 @@ int cpp_main(int, char*[])
29362936
// The choice of platform is make at runtime rather than compile-time
29372937
// so that compile errors for all platforms will be detected even though
29382938
// only the current platform is runtime tested.
2939-
platform = (platform == "Win32" || platform == "Win64" || platform == "Cygwin") ? "Windows" : "POSIX";
2939+
platform = (platform == "Win32" || platform == "Win64") ? "Windows" : "POSIX";
29402940
std::cout << "Platform is " << platform << '\n';
29412941

29422942
BOOST_TEST(p1.string() != p3.string());

0 commit comments

Comments
 (0)