Skip to content

Commit a9b9f8e

Browse files
committed
Fixed various issues on OSX from TFS integration
1 parent 6b71d32 commit a9b9f8e

File tree

12 files changed

+53
-44
lines changed

12 files changed

+53
-44
lines changed

Release/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ if(IOS)
1818
"${CMAKE_SOURCE_DIR}/../openssl-ios/lib/libssl.a"
1919
)
2020

21+
# The cxx_flags must be set here, because the ios-cmake toolchain file unfortunately sets "-headerpad_max_install_names" which is not a valid clang flag.
22+
set(CMAKE_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
23+
2124
set(BUILD_SHARED_LIBS OFF)
2225
elseif(UNIX)
2326
find_package(Boost COMPONENTS system thread locale regex filesystem REQUIRED)
@@ -44,11 +47,11 @@ endif()
4447
if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") OR IOS)
4548
message("-- Setting clang options")
4649

47-
set(WARNINGS "-Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code")
48-
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-unused-function -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-unused-variable -Wno-unneeded-internal-declaration -Wno-return-type-c-linkage")
50+
set(WARNINGS "-Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls")
51+
set(OSX_SUPPRESSIONS "-Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32")
4952
set(WARNINGS "${WARNINGS} ${OSX_SUPPRESSIONS}")
5053

51-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage")
54+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
5255
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
5356
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
5457

Release/include/cpprest/xxpublic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ typedef void * HANDLE;
7575
#ifdef _MS_WINDOWS
7676
typedef void* FILE_HANDLE;
7777
#else
78+
#ifdef __clang__
79+
#include <cstdio>
80+
#endif
7881
typedef FILE* FILE_HANDLE;
7982
#endif
8083

Release/include/pplx/pplxlinux.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/***
22
* ==++==
33
*
4-
* Copyright (c) Microsoft Corporation. All rights reserved.
4+
* Copyright (c) Microsoft Corporation. All rights reserved.
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,11 +44,12 @@
4444
#include <dispatch/dispatch.h>
4545
#else
4646
#include "compat/linux_compat.h"
47+
#endif
48+
4749
#include "boost/thread/mutex.hpp"
4850
#include "boost/thread/condition_variable.hpp"
4951
#include "boost/date_time/posix_time/posix_time_types.hpp"
5052
#include "boost/bind/bind.hpp"
51-
#endif
5253

5354
#include "pplx/pplxinterface.h"
5455

@@ -92,7 +93,7 @@ namespace platform
9293
static const unsigned int timeout_infinite = 0xFFFFFFFF;
9394

9495
event_impl()
95-
: _signaled(false)
96+
: _signaled(false)
9697
{
9798
}
9899

@@ -221,7 +222,7 @@ namespace platform
221222
_M_cs.lock();
222223
_M_owner = id;
223224
_M_recursionCount = 1;
224-
}
225+
}
225226
}
226227

227228
void unlock()
@@ -235,14 +236,14 @@ namespace platform
235236
{
236237
_M_owner = -1;
237238
_M_cs.unlock();
238-
}
239+
}
239240
}
240241

241242
private:
242243
#if defined(__APPLE__)
243-
std::recursive_mutex _M_cs;
244+
std::mutex _M_cs;
244245
#else
245-
boost::mutex _M_cs;
246+
::boost::mutex _M_cs;
246247
#endif
247248
long _M_recursionCount;
248249
volatile long _M_owner;
@@ -277,7 +278,7 @@ namespace platform
277278
{
278279
public:
279280
_PPLXIMP virtual void schedule( TaskProc_t proc, _In_ void* param);
280-
281+
281282
virtual ~apple_scheduler();
282283
};
283284
#else
@@ -287,7 +288,7 @@ namespace platform
287288
_PPLXIMP virtual void schedule( TaskProc_t proc, _In_ void* param);
288289
};
289290
#endif
290-
291+
291292
/// <summary>
292293
/// Timer
293294
/// </summary>
@@ -325,11 +326,11 @@ namespace extensibility
325326
{
326327
typedef ::pplx::details::event_impl event_t;
327328

328-
#if defined(__APPLE__)
329-
typedef std::mutex critical_section_t;
330-
#else
329+
//#if defined(__APPLE__)
330+
// typedef std::mutex critical_section_t;
331+
//#else
331332
typedef ::boost::mutex critical_section_t;
332-
#endif
333+
//#endif
333334
typedef scoped_lock<critical_section_t> scoped_critical_section_t;
334335

335336
typedef ::pplx::details::reader_writer_lock_impl reader_writer_lock_t;
@@ -348,7 +349,7 @@ namespace extensibility
348349
#else
349350
typedef details::linux_scheduler default_scheduler_t;
350351
#endif
351-
352+
352353
namespace details
353354
{
354355
/// <summary>

Release/include/pplx/threadpool.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
#include <pthread.h>
2929
#include <vector>
3030

31+
#pragma clang diagnostic push
32+
#pragma clang diagnostic ignored "-Wconversion"
33+
#pragma clang diagnostic ignored "-Wunreachable-code"
3134
#include "boost/asio.hpp"
35+
#pragma clang diagnostic pop
3236

3337
namespace crossplat {
3438

Release/src/http/common/http_helpers.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,7 @@ namespace details
315315
#ifdef _MS_WINDOWS
316316
sprintf_s(buffer, 9, "%8IX", bytes_read);
317317
#else
318-
# if __x86_64__
319-
sprintf(buffer, "%8lX", bytes_read);
320-
# else
321-
sprintf(buffer, "%8X", bytes_read);
322-
# endif
318+
sprintf(buffer, "%8zX", bytes_read);
323319
#endif
324320
memcpy(&data[0], buffer, 8);
325321
while (data[offset] == ' ') ++offset;

Release/src/http/listener/http_linux_server.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
*/
1919
#include "stdafx.h"
2020
#include <boost/algorithm/string/find.hpp>
21+
#pragma clang diagnostic push
22+
#pragma clang diagnostic ignored "-Wcast-align"
2123
#include <boost/regex.hpp>
24+
#pragma clang diagnostic pop
2225
#include "cpprest/http_helpers.h"
2326
#include "cpprest/http_server_api.h"
2427
#include "cpprest/http_server.h"

Release/src/streams/linux/fileio_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ size_t _write_file_async(Concurrency::streams::details::_file_info_impl *fInfo,
364364

365365
pplx::create_task([=]() -> void
366366
{
367-
size_t abs_position;
367+
off_t abs_position;
368368
bool must_restore_pos;
369-
size_t orig_pos;
369+
off_t orig_pos;
370370
if( position == (size_t)-1 )
371371
{
372372
orig_pos = lseek(fInfo->m_handle, 0, SEEK_CUR);

Release/tests/Common/TestRunner/test_runner.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ int main(int argc, char* argv[])
532532
else
533533
{
534534
testRunner.RunTestsIf(
535-
tests,
535+
tests,
536536
[&](UnitTest::Test *pTest) -> bool
537537
{
538538
// Combine suite and test name
@@ -543,7 +543,7 @@ int main(int argc, char* argv[])
543543
if(IsTestIgnored(pTest) && !include_ignored_tests)
544544
return false;
545545
else
546-
return matched_properties(pTest->m_properties) &&
546+
return matched_properties(pTest->m_properties) &&
547547
std::regex_match(fullTestName, nameRegex);
548548
},
549549
g_individual_test_timeout);
@@ -602,7 +602,6 @@ int main(int argc, char* argv[])
602602
}
603603
}
604604

605-
tests.Clear();
606605
}
607606

608607
if( totalTestCount > 0 )

Release/tests/Functional/http/client/connections_and_errors.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ TEST_FIXTURE(uri_address, stream_timeout, "Ignore:Apple", "Bug 885080")
245245

246246
#pragma region Cancellation tests
247247

248-
TEST_FIXTURE(uri_address, cancel_before_request)
248+
TEST_FIXTURE(uri_address, cancel_before_request, "Ignore:Linux", "NYI", "Ignore:Apple", "NYI")
249249
{
250250
test_http_server::scoped_server scoped(m_uri);
251251
http_client c(m_uri);
@@ -258,9 +258,9 @@ TEST_FIXTURE(uri_address, cancel_before_request)
258258

259259
// This test can't be implemented with our test server so isn't avaliable on WinRT.
260260
#ifndef __cplusplus_winrt
261-
TEST_FIXTURE(uri_address, cancel_after_headers, "Ignore:Linux", "NYI")
261+
TEST_FIXTURE(uri_address, cancel_after_headers, "Ignore:Linux", "NYI", "Ignore:Apple", "NYI")
262262
{
263-
web::http::experimental::listener::http_listener listener(m_uri);
263+
web::http::experimental::listener::http_listener listener(m_uri);
264264
listener.open().wait();
265265
http_client c(m_uri);
266266
pplx::cancellation_token_source source;
@@ -290,7 +290,7 @@ TEST_FIXTURE(uri_address, cancel_after_headers, "Ignore:Linux", "NYI")
290290
}
291291
#endif
292292

293-
TEST_FIXTURE(uri_address, cancel_after_body, "Ignore:Linux", "NYI")
293+
TEST_FIXTURE(uri_address, cancel_after_body, "Ignore:Linux", "NYI", "Ignore:Apple", "NYI")
294294
{
295295
test_http_server::scoped_server scoped(m_uri);
296296
test_http_server * p_server = scoped.server();
@@ -311,22 +311,22 @@ TEST_FIXTURE(uri_address, cancel_after_body, "Ignore:Linux", "NYI")
311311
response.content_ready().wait();
312312
}
313313

314-
TEST_FIXTURE(uri_address, cancel_with_error, "Ignore:Linux", "NYI")
314+
TEST_FIXTURE(uri_address, cancel_with_error, "Ignore:Linux", "NYI", "Ignore:Apple", "NYI")
315315
{
316316
test_http_server server(m_uri);
317317
VERIFY_ARE_EQUAL(0, server.open());
318318
http_client c(m_uri);
319319
pplx::cancellation_token_source source;
320-
320+
321321
auto responseTask = c.request(methods::GET, U("/"), source.get_token());
322322
source.cancel();
323323
VERIFY_ARE_EQUAL(0, server.close());
324-
324+
325325
// All errors after cancellation are ignored.
326326
VERIFY_THROWS_HTTP_ERROR_CODE(responseTask.get(), std::errc::operation_canceled);
327327
}
328328

329-
TEST_FIXTURE(uri_address, cancel_while_uploading_data)
329+
TEST_FIXTURE(uri_address, cancel_while_uploading_data, "Ignore:Linux", "NYI", "Ignore:Apple", "NYI")
330330
{
331331
test_http_server::scoped_server scoped(m_uri);
332332
http_client c(m_uri);
@@ -343,7 +343,7 @@ TEST_FIXTURE(uri_address, cancel_while_uploading_data)
343343

344344
// This test can't be implemented with our test server since it doesn't stream data so isn't avaliable on WinRT.
345345
#ifndef __cplusplus_winrt
346-
TEST_FIXTURE(uri_address, cancel_while_downloading_data, "Ignore:Linux", "NYI")
346+
TEST_FIXTURE(uri_address, cancel_while_downloading_data, "Ignore:Linux", "NYI", "Ignore:Apple", "NYI")
347347
{
348348
web::http::experimental::listener::http_listener listener(m_uri);
349349
listener.open().wait();

Release/tests/Functional/http/listener/connections_and_errors.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ TEST(default_port_admin_access, "Ignore", "Manual")
144144
VERIFY_THROWS(listener.open().wait(), http_exception);
145145
}
146146

147-
TEST_FIXTURE(uri_address, try_port_already_in_use, "Ignore:Linux", "Bug 879077")
147+
TEST_FIXTURE(uri_address, try_port_already_in_use, "Ignore:Linux", "Bug 879077", "Ignore:Apple", "Bug 879077")
148148
{
149149
test_http_server::scoped_server scoped(m_uri);
150150
http_listener listener(m_uri);
@@ -165,7 +165,7 @@ TEST_FIXTURE(uri_address, reply_after_starting_close)
165165
request.reply(status_codes::OK).wait();
166166
});
167167
VERIFY_ARE_EQUAL(0, p_client->request(methods::GET, U("/path")));
168-
168+
169169
p_client->next_response().then([](test_response *p_response)
170170
{
171171
http_asserts::assert_test_response_equals(p_response, status_codes::OK);
@@ -203,7 +203,7 @@ static void close_stream_early_with_length_impl(const uri &u, bool useException)
203203
return response.extract_vector();
204204
}).then([=](pplx::task<std::vector<unsigned char>> bodyTask)
205205
{
206-
VERIFY_THROWS(bodyTask.get(), http_exception);
206+
VERIFY_THROWS(bodyTask.get(), http_exception);
207207
}).wait();
208208

209209
listener.close().wait();

0 commit comments

Comments
 (0)