Skip to content

Commit d16b2ea

Browse files
authored
fix: Fixes required to run with msvc 14.1 (vs2017) (#195)
1 parent 66feae7 commit d16b2ea

File tree

7 files changed

+22
-7
lines changed

7 files changed

+22
-7
lines changed

.github/actions/client-release/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ runs:
7474
if: runner.os == 'Windows'
7575
shell: bash
7676
env:
77-
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }}
77+
OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL'
7878
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
7979
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
8080
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

.github/workflows/client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- uses: ilammy/msvc-dev-cmd@v1
6060
- uses: ./.github/actions/ci
6161
env:
62-
OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }}
62+
OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL'
6363
BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
6464
BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3'
6565
with:

libs/common/include/launchdarkly/attributes_builder.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ class AttributesBuilder final {
6363
AttributesBuilder& operator=(AttributesBuilder const&) = delete;
6464
AttributesBuilder& operator=(AttributesBuilder&&) = delete;
6565

66-
AttributesBuilder(AttributesBuilder&& builder) noexcept = default;
66+
// This cannot be noexcept because of:
67+
// https://developercommunity.visualstudio.com/t/bug-in-stdmapstdpair-implementation-with-move-only/840554
68+
AttributesBuilder(AttributesBuilder&& builder) = default;
6769
~AttributesBuilder() = default;
6870

6971
/**

libs/common/include/launchdarkly/persistence/persistence.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <string>
4+
35
/**
46
* Interface for a data store that holds feature flag data and other SDK
57
* properties in a serialized form.

libs/common/include/launchdarkly/value.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,11 @@ class Value final {
413413
enum Type type_;
414414

415415
// Empty constants used when accessing the wrong type.
416-
inline static const std::string empty_string_;
417-
inline static const Array empty_vector_;
418-
inline static const Object empty_map_;
416+
// These are not inline static const because of this bug:
417+
// https://developercommunity.visualstudio.com/t/inline-static-destructors-are-called-multiple-time/1157794
418+
static const std::string empty_string_;
419+
static const Array empty_vector_;
420+
static const Object empty_map_;
419421
static const Value null_value_;
420422
};
421423

libs/common/src/config/app_info_builder.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ tl::expected<std::string, Error> AppInfoBuilder::Tag::Build() const {
2121
}
2222

2323
bool ValidChar(char c) {
24-
return std::isalnum(c) != 0 || c == '-' || c == '.' || c == '_';
24+
if(c > 0 && c < 255) {
25+
// The MSVC implementation of isalnum will assert if the number it outside
26+
// its lookup table.
27+
// iswalnum would not, but is less restrictive than desired.
28+
return std::isalnum(c) != 0 || c == '-' || c == '.' || c == '_';
29+
}
30+
return false;
2531
}
2632

2733
std::optional<Error> IsValidTag(std::string const& key,

libs/common/src/value.cpp

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

88
namespace launchdarkly {
99

10+
const std::string Value::empty_string_;
11+
const Value::Array Value::empty_vector_;
12+
const Value::Object Value::empty_map_;
1013
const Value Value::null_value_;
1114

1215
Value::Value() : type_(Value::Type::kNull), storage_{0.0} {}

0 commit comments

Comments
 (0)