Skip to content

Commit

Permalink
fix compile on g++ 6 (microsoft#13290)
Browse files Browse the repository at this point in the history
  • Loading branch information
strega-nil authored Sep 4, 2020
1 parent d0d662b commit 12321df
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmake/utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int main() {}
int main() {}
]]
_VCPKG_USE_STD_FILESYSTEM)

if(_VCPKG_REQUIRE_LINK_CXXFS)
set(_VCPKG_CXXFS_LIBRARY "stdc++fs")
endif()
Expand Down
6 changes: 3 additions & 3 deletions include/vcpkg/base/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ namespace vcpkg::Json
underlying_t underlying_;
};

VCPKG_MSVC_WARNING(push);
VCPKG_MSVC_WARNING(disable : 4505);
VCPKG_MSVC_WARNING(push)
VCPKG_MSVC_WARNING(disable : 4505)

template<class Type>
Span<const StringView> IDeserializer<Type>::valid_fields() const
Expand Down Expand Up @@ -332,7 +332,7 @@ namespace vcpkg::Json
return nullopt;
}

VCPKG_MSVC_WARNING(pop);
VCPKG_MSVC_WARNING(pop)

struct ReaderError
{
Expand Down
3 changes: 3 additions & 0 deletions src/vcpkg/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ namespace vcpkg
return Configuration{std::move(registries)};
}

constexpr StringLiteral ConfigurationDeserializer::DEFAULT_REGISTRY;
constexpr StringLiteral ConfigurationDeserializer::REGISTRIES;

ConfigurationDeserializer::ConfigurationDeserializer(const VcpkgCmdArguments& args)
{
registries_enabled = args.registries_enabled();
Expand Down
1 change: 1 addition & 0 deletions src/vcpkg/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace vcpkg::Metrics
res.push_back(hex[(bits >> 0) & 0x0F]);
}
};
constexpr char append_hexits::hex[17];

// note: this ignores the bits of these numbers that would be where format and variant go
static std::string uuid_of_integers(uint64_t top, uint64_t bottom)
Expand Down
7 changes: 7 additions & 0 deletions src/vcpkg/registries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ namespace vcpkg

StringView RegistryImplDeserializer::type_name() const { return "a registry"; }

constexpr StringLiteral RegistryImplDeserializer::KIND;
constexpr StringLiteral RegistryImplDeserializer::PATH;
constexpr StringLiteral RegistryImplDeserializer::KIND_BUILTIN;
constexpr StringLiteral RegistryImplDeserializer::KIND_DIRECTORY;

Span<const StringView> RegistryImplDeserializer::valid_fields() const
{
static const StringView t[] = {KIND, PATH};
Expand Down Expand Up @@ -76,6 +81,8 @@ namespace vcpkg

StringView RegistryDeserializer::type_name() const { return "a registry"; }

constexpr StringLiteral RegistryDeserializer::PACKAGES;

Span<const StringView> RegistryDeserializer::valid_fields() const
{
static const StringView t[] = {
Expand Down
28 changes: 28 additions & 0 deletions src/vcpkg/sourceparagraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ namespace vcpkg
}
};

constexpr StringLiteral DependencyDeserializer::NAME;
constexpr StringLiteral DependencyDeserializer::FEATURES;
constexpr StringLiteral DependencyDeserializer::DEFAULT_FEATURES;
constexpr StringLiteral DependencyDeserializer::PLATFORM;

struct FeatureDeserializer : Json::IDeserializer<std::unique_ptr<FeatureParagraph>>
{
virtual StringView type_name() const override { return "a feature"; }
Expand Down Expand Up @@ -482,6 +487,10 @@ namespace vcpkg
}
};

constexpr StringLiteral FeatureDeserializer::NAME;
constexpr StringLiteral FeatureDeserializer::DESCRIPTION;
constexpr StringLiteral FeatureDeserializer::DEPENDENCIES;

// We "parse" this so that we can add actual license parsing at some point in the future
// without breaking anyone
struct LicenseExpressionDeserializer : Json::IDeserializer<std::string>
Expand Down Expand Up @@ -622,6 +631,10 @@ namespace vcpkg
}
};

constexpr StringView LicenseExpressionDeserializer::EXPRESSION_WORDS[];
constexpr StringView LicenseExpressionDeserializer::VALID_LICENSES[];
constexpr StringView LicenseExpressionDeserializer::VALID_EXCEPTIONS[];

struct ManifestDeserializer : Json::IDeserializer<std::unique_ptr<SourceControlFile>>
{
virtual StringView type_name() const override { return "a manifest"; }
Expand Down Expand Up @@ -721,6 +734,21 @@ namespace vcpkg
}
};

constexpr StringLiteral ManifestDeserializer::NAME;
constexpr StringLiteral ManifestDeserializer::VERSION;

constexpr StringLiteral ManifestDeserializer::PORT_VERSION;
constexpr StringLiteral ManifestDeserializer::MAINTAINERS;
constexpr StringLiteral ManifestDeserializer::DESCRIPTION;
constexpr StringLiteral ManifestDeserializer::HOMEPAGE;
constexpr StringLiteral ManifestDeserializer::DOCUMENTATION;
constexpr StringLiteral ManifestDeserializer::LICENSE;
constexpr StringLiteral ManifestDeserializer::DEPENDENCIES;
constexpr StringLiteral ManifestDeserializer::DEV_DEPENDENCIES;
constexpr StringLiteral ManifestDeserializer::FEATURES;
constexpr StringLiteral ManifestDeserializer::DEFAULT_FEATURES;
constexpr StringLiteral ManifestDeserializer::SUPPORTS;

Parse::ParseExpected<SourceControlFile> SourceControlFile::parse_manifest_file(const fs::path& path_to_manifest,
const Json::Object& manifest)
{
Expand Down
42 changes: 42 additions & 0 deletions src/vcpkg/vcpkgcmdarguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,4 +856,46 @@ namespace vcpkg
}
m_str.append(line_start, best_break);
}

// out-of-line definitions since C++14 doesn't allow inline constexpr static variables
constexpr StringLiteral VcpkgCmdArguments::VCPKG_ROOT_DIR_ENV;
constexpr StringLiteral VcpkgCmdArguments::VCPKG_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::MANIFEST_ROOT_DIR_ARG;

constexpr StringLiteral VcpkgCmdArguments::BUILDTREES_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::DOWNLOADS_ROOT_DIR_ENV;
constexpr StringLiteral VcpkgCmdArguments::DOWNLOADS_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::INSTALL_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::PACKAGES_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::SCRIPTS_ROOT_DIR_ARG;

constexpr StringLiteral VcpkgCmdArguments::DEFAULT_VISUAL_STUDIO_PATH_ENV;

constexpr StringLiteral VcpkgCmdArguments::TRIPLET_ENV;
constexpr StringLiteral VcpkgCmdArguments::TRIPLET_ARG;
constexpr StringLiteral VcpkgCmdArguments::OVERLAY_PORTS_ENV;
constexpr StringLiteral VcpkgCmdArguments::OVERLAY_PORTS_ARG;
constexpr StringLiteral VcpkgCmdArguments::OVERLAY_TRIPLETS_ARG;

constexpr StringLiteral VcpkgCmdArguments::BINARY_SOURCES_ARG;

constexpr StringLiteral VcpkgCmdArguments::DEBUG_SWITCH;
constexpr StringLiteral VcpkgCmdArguments::SEND_METRICS_SWITCH;
constexpr StringLiteral VcpkgCmdArguments::DISABLE_METRICS_ENV;
constexpr StringLiteral VcpkgCmdArguments::DISABLE_METRICS_SWITCH;
constexpr StringLiteral VcpkgCmdArguments::PRINT_METRICS_SWITCH;

constexpr StringLiteral VcpkgCmdArguments::WAIT_FOR_LOCK_SWITCH;

constexpr StringLiteral VcpkgCmdArguments::JSON_SWITCH;

constexpr StringLiteral VcpkgCmdArguments::FEATURE_FLAGS_ENV;
constexpr StringLiteral VcpkgCmdArguments::FEATURE_FLAGS_ARG;

constexpr StringLiteral VcpkgCmdArguments::FEATURE_PACKAGES_SWITCH;
constexpr StringLiteral VcpkgCmdArguments::BINARY_CACHING_FEATURE;
constexpr StringLiteral VcpkgCmdArguments::BINARY_CACHING_SWITCH;
constexpr StringLiteral VcpkgCmdArguments::COMPILER_TRACKING_FEATURE;
constexpr StringLiteral VcpkgCmdArguments::MANIFEST_MODE_FEATURE;
constexpr StringLiteral VcpkgCmdArguments::REGISTRIES_FEATURE;
}

0 comments on commit 12321df

Please sign in to comment.